Another 28X1 BOD Mystery

In an earlier thread I stumbled on the fact that enablebod and disablebod are actually inverted in the 28X1, which Technical confirmed and said would be fixed in the next software release (see http://www.picaxeforum.co.uk/showthread.php?t=9551).

I'm still working on ways to reduce power consumption in the 28X1, and I have again stumbled on another mystery (I stumble a lot!), this time related to the hibernate command (and probably not unrelated to the BOD inversion).

I have a simple circuit: LED on output 7, switch on ULPWU input (as per p.55 in the manual) and all unused inputs tied low.

In an attempt to measure current consumption during hibernation, I tried the following code:

Code:
main:
  setfreq k125
  high 7        ; blink LED
  pause 50    ; (make longer for higher freqs)
  low 7
  pause 250   ; allow time to check supply current
  hibernate 1  ; stay here until manual wake-up switch is pressed
  goto main
Upon reset, I measure 247uA after the LED blinks (which is what I would expect if the 28X1 is starting up with BOD disabled), and 0.1uA during the hibernation (which is pretty amazing if it's accurate!).

However, every subsequent iteration yields 326uA after the LED blinks (which makes sense if hibernate enables BOD when it exits), but (surprisingly) 133uA during hibernation. My guess is that somehow BOD never gets disabled again during hibernation, which is a mystery to me because I thought hibernate automatically disables BOD upon entry.

To see if I could force a "disablebod", I tried inserting an "enablebod" (go figure!) just before the hibernation, but all current measurements stay the same - so I'm stumped again.

To make matters even more confusing, the above code produces similar results at all internal resonator speeds I tried (of course, with higher currents at higher speeds), EXCEPT at 31k. In that case, it really gets strange - the LED never lights, and the supply current is a constant 108uA.

That result is mind-boggling, to say the least - I have no idea if the program is running or hibernating!

If anyone can shed any light on all this I would be eternally grateful, and if there is a bug in the hibernate command (related to the BOD inversion?), I hope it's also easily fixable in a software update.
 

Technical

Technical Support
Staff member
The 28X1 starts up by default with BOD enabled (not disabled) - this is the default state of the PIC upon a reset (PCON,SBOREN set).

The hibernate command disables the BOD by default as it starts (BCF PCON,SBOREN) and then always enables it again (BSF PCON,SBOREN) when woken up.

enablebod/disablebod commands have no effect on this process.

The compiler bug simply inverting the enablebod/disablebod will be fixed in the next release, it is not a firmware issue and unrelated to hibernate.
 
Technical - Thanks for the reply.

OK - I was just trying to understand what would account for the different supply current readings the first time through the loop, as compared to all subsequent iterations. The first time, I get 0.1 uA during hibernation (which is great), but every subsequent time I read 133 uA during hibernation (which is much higher than I would expect).

I also get different readings (first time vs. all others) during the "pause 250" before entering hibernation, but that's not as critical to me. What I want to figure out is how to get the 0.1 uA measurement (or anything close) every time the 28X1 goes into hibernation - or is that a totally unrealistic expectation for hibernation?

Ron
 
Top