Super low power mode... something not right
wanderingjeep
Posts: 3
When i start the program I set it to rcslow. Then at some points I set it to use the xtal at 80mhz then back to rcslow. When the program starts I draw 3.95ma when I switch to 80mhz and back to rcslow, it draws 6.87ma. Any ideas here?
Pub ClockSet(X) if x:=1 clkset( %01101000,80_000_000 ) 'Set to XTAL1 waitcnt(220000+cnt) clkset( %01101111,80_000_000 ) 'Set to XTAL1 + PLL16x waitcnt(3000000+cnt) return If X:=0 waitcnt(cnt+500_000) clkset(%0000001 , 20000) ' turn on crystal, but don't use it waitcnt(2000 + cnt) ' wait [at least] 10ms for PLL/crystal to stabilize
Comments
John Abshier
1. How you are measuring? Does it include *only* the prop, prop+EEPROM, prop+EEPROM+regulator, etc.?
2. Can we get the entire program?
Can you post the simplest program (in its entirety) that exhibits this behavior? It's hard to tell just from one subroutine what else might be going on in your code.
-Phil
You use if statements where you store X as a value. Are you sure you don't mean to compare X to the value? Use == instead of := if you do.
Your clkset()'s are wrong. Like the first one (I think, if I'm reading it right) would turn on XTAL1, but actually use RCFAST, and no matter if that last statement is right or not, you wouldn't be running at 80MHz, but you set your timing at that, thus your waitcnt will be performed differently than what you may think.
Check out my attached file, these are the methods I've been using to go into and come out of power save mode. It includes all the necessary waiting and whatnot. There are options to go to RCSLOW, RCFAST, 5MHz, 20MHz, 80MHz, etc.