View previous topic :: View next topic |
Author |
Message |
lguancho
Joined: 08 Sep 2003 Posts: 5
|
PIC18F452 in sleep Mode |
Posted: Thu Mar 24, 2005 1:36 am |
|
|
Hi, all. I am trying to put my PIC18F452 into sleep, with WDT enabled. The PIC is running on 20MHz clock (HS), at 5V It will wake up on WDT overflow or EXT INT on pin RB0.
Before going to sleep, I disable ADCmodule, Timer1 Oscillator, LVD module, whatever I could find. I set all unused pin to O/P, and all input pin tied high or low.
Having done all these things, I am still getting about 5mA Ipd. No other ICs except the maxim RS232 IC is active.
#include <18F452.h>
#device ADC=10
#use delay(clock=20000000,restart_WDT)
#fuses HS,NOLVP,WDT128,NOPUT,NOBROWNOUT
#use rs232(baud=9600,parity=N,BITS=8,xmit=PIN_C6,rcv=PIN_C7) //,enable=PIN_B4,ERRORS)
My sleep function is as follows:
void Going_to_sleep(void)
{
setup_ccp1(CCP_OFF);
setup_ccp2(CCP_OFF);
setup_timer_0(RTCC_OFF);
LVDEN_BIT=0;
ADON_BIT=0;
SSPEN_BIT=0;
setup_timer_1(T1_DISABLED);
setup_timer_3(T3_DISABLED);
T1OSCEN_BIT=0;
disable_interrupts(INT_TIMER0);
disable_interrupts(INT_RDA);
output_float(PIN_B0);
delay_us(10);
Timeout=FALSE;
ext_int_edge(H_TO_L);
INT0IF_BIT=0;
enable_interrupts(INT_EXT);
enable_interrupts(GLOBAL);
setup_wdt(WDT_ON);
restart_wdt();
}
I issues a sleep() after calling the sleep function.
Any idea why my Ipd is still so high(5mA)?
Regards
lguancho |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Thu Mar 24, 2005 1:53 am |
|
|
According to the specs RS-232 can draw up to something like 20mA for each transmitter. Have you tried meassuring the current before and after disconnecting the RS-232 cable? We use an RS232 driver chip from Maxim which disables itself after something like 0,5seconds of no data transmission. |
|
|
lguancho
Joined: 08 Sep 2003 Posts: 5
|
PIC18F452 in sleep mode |
Posted: Thu Mar 24, 2005 2:56 am |
|
|
Hi. The current on my benchtop power supply shows minimal difference when I removed the maxim chip and RS232 cable.
For the compiler, I am using PCWH 3.216 version. For the PIC18F452, I am using a dip package.
I have removed the ICD debugger also. The pic is sleeping, and can wake up to blink an LED every 2 to 3 sec. But I cannot go below the 1mA baseline.
My question: Is it possible to achieve uA kind of performance? I am talking about Ipd during sleep mode (regardless of osc frequency). |
|
|
Ttelmah Guest
|
|
Posted: Thu Mar 24, 2005 5:05 am |
|
|
What is B0 attached to (you are floating this). Are you sure the idle state of this is genuinely a 'high'. How are you pulling the input pins high/low?. You talk about the unused pins, and the input pins, but what are the output pins doing?. What is your supply voltage?. How is your power line driven (remember a 78L05 for example, will itself draw a significant current)?.
Best Wishes |
|
|
lguancho
Joined: 08 Sep 2003 Posts: 5
|
PIC18F452 in sleep mode |
Posted: Thu Mar 24, 2005 1:32 pm |
|
|
Hi. I also tied the B0 pin to the RX pin (C7) of RS232. C7 is high in RS232 idle state. PIC is waiting for any RX char(causing a H to L transition on RB0) to wake the PIC up. I have been able to wake up the PIC to perform some serial comm.
I have tried to isolate the 5V regulator, and power up the pic directly by a 5V from the Benchtop power supply. Yes, this reduces current consumption by 2 mA, but the pic is still drawing about 3mA during sleep.
The next thing I intend to do is to plug the pic into a Breadboard, with all the pin (except C6,C7,B0) set as output and left unconnected. OSC pins are connected to 20MHz crystal with ext caps. Is this the configuration for checking sleep mode current? |
|
|
jds-pic
Joined: 17 Sep 2003 Posts: 205
|
Re: PIC18F452 in sleep mode |
Posted: Fri Mar 25, 2005 1:36 pm |
|
|
lguancho wrote: | My question: Is it possible to achieve uA kind of performance? I am talking about Ipd during sleep mode (regardless of osc frequency). |
yes.
i have an 18F452 design well below 1mA.
one trick -- after you are done with all of the stuff that looks obvious... put your '452 to sleep, get out your 5 or 6 digit desktop DMM, and probe across every resistor in your design. yes, every one, right down to the very last pullup or pulldown. any resistor with voltage across it is costing you power. if you can't change the logic on either side of a given resistor, consider a large ohmic value.
jds-pic |
|
|
Christophe
Joined: 10 May 2005 Posts: 323 Location: Belgium
|
|
Posted: Mon Jun 27, 2005 5:39 am |
|
|
disconnect programming cable;
disable ALL interfaces:
setup_uart(FALSE); // did the trick with me
setup_spi(false);
. . .
mine is < 20uA in sleep, and I'm using exactly the same setup as you, wake up by WDT and EXT BO INT
Check every Î/O pin! |
|
|
|