CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Low Power, Configuring Peripherals for Sleep

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

Low Power, Configuring Peripherals for Sleep
PostPosted: Sun Nov 12, 2006 10:50 am     Reply with quote

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. Shocked

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
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

PostPosted: Sun Nov 12, 2006 3:26 pm     Reply with quote

Woo Hoo Very Happy

Found the culprit. The pin connected to the RS232 driver (MAX3232) RC1OUT pin is pulled up through a 47K resistor. I just assumed I'd set that to OUTPUT & HIGH. Apparently the MAX3232 doesn't like that! To the tune of 14.85mA.

DOWN TO 150uA SLEEP CURRENT!

John
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group