jecottrell
Joined: 16 Jan 2005 Posts: 559 Location: Tucson, AZ
|
Low Power, Configuring Peripherals for Sleep |
Posted: Sun Nov 12, 2006 10:50 am |
|
|
18F2525 (not LF) @ 3.3V (it works reliably, was stuffed on accident, will be LF in the future)
3.236
Hello All,
Continuing on the quest for a LOW power sleep configuration I've read all (or at least most) of the wisdom available in the forum.
I've followed the general guidlines of:
Setting all unconnected pins (3 total) output:low
Setting all other pins to output: direction of their pull
I'm using a LT1521 LDO w/ gnd pin I = 300uA max.
I've got a FET switching a second LDO (5V) for a peripheral MODEM.
... a RS232 driver supplied by a PIC pin (as suggested by Microchip).
... XBee radio that is put to sleep when necessary.
... a DS1337 RTC with battery BU and dual schottky diode protection for battery.
(MODEM and radio don't affect results, they are the same even if they're left unconnected.)
Full up operation current (PIC @40MHz and ZBee awake) = 80mA. This is pretty accurate 40mA for the PIC at 40MHz, and 40mA for the radio in RX.
So far I've been able to put the PIC to sleep and reduce current to 15mA.
That took a lot of effort and I was only able to figure that out after starting a new, minimal project and then transfering the code to my function that preps the PIC for sleep mode.
Can someone take a peak at the following and see if I may be missing something?
Code: | #fuses NOWDT,WDT256, H4, NOPROTECT, NOIESO, PUT, STVREN, BROWNOUT_NOSL, BORV20
#fuses NODEBUG, NOLVP, NOWRT, NOWRTD, NOWRTB, NOWRTC, NOCPD, NOCPB, NOEBTR, NOEBTRB
setup_uart(false);
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF|ADC_TAD_MUL_0);
setup_spi(FALSE);
setup_wdt(WDT_ON);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
setup_low_volt_detect(FALSE);
setup_oscillator(OSC_31KHZ|OSC_INTRC|OSC_PLL_OFF);
output_low(PIN_A0);
output_low(PIN_A1);
output_low(PIN_A2);
output_low(PIN_A3);
output_low(PIN_A4);
output_low(PIN_A5);
output_low(PIN_A6);
output_low(PIN_A7);
output_low(PIN_B0);
output_low(PIN_B0);
output_low(PIN_B0);
output_low(PIN_B0);
output_low(PIN_B0);
output_high(PIN_B5);
output_low(PIN_B6);
output_high(PIN_B7);
output_high(PIN_C0);
output_high(PIN_C1);
output_high(PIN_C2);
output_high(PIN_C3);
output_high(PIN_C4);
output_low(PIN_C5);
output_high(PIN_C6);
output_high(PIN_C7); |
My only other option is to stuff a fresh board and check current after each section is added.
Any suggestions would be greatly appreciated.
John |
|