- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is first attempt at using Sleep command on 5LP. I am starting with the code below. Just before the unit goes to sleep the current drawn is 18mA. During sleep it only drops to 15mA.
Do I have the correct settings for low power mode? (The sleep timer is set for 4096).
CY_ISR(WakeupIsr){
SleepTimer_1_GetStatus();
}
void TestSleep(void){
GSM_RST_Write(1);
GSM_SLEEP_Write(1);
isr_1_StartEx(WakeupIsr);
SleepTimer_1_Start();
CyPmSaveClocks();
CyPmSleep(PM_SLEEP_TIME_NONE, PM_SLEEP_SRC_CTW);
CyPmRestoreClocks();
}
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Debugging sucks some mA. Did you disable that?
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Also: how did you measure the current consumption? Are you sure you measure the PSoC only?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Which board do you have ? If the CY8CKIT-050 there are instructions
to measure in 77900, page 16 -
http://www.cypress.com/?rID=64554 AN77900 - PSoC® 3 and PSoC 5LP Low-power Modes and Power Reduction Techniques
http://www.cypress.com/?rID=43337 AN61290 - PSoC® 3 and PSoC 5LP Hardware Design Considerations
http://www.cypress.com/?rID=78797 AN86233 - PSoC® 4 Low-Power Modes and Power Reduction Techniques
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The current does seem to drop when in low power mode now. I have several mA being used by the power supply and some pull-up resistors.
However, The program seems to now be halting after wake from sleep (when Sleep Timer trips). I have tried turning off the sleep Timer when done and also clearing the watchdog time in the main loop but cannot figure out what is causing the program to stop (it is acting like an invisible brakpoint). Here is my current code. The Sleep timer is set to max period around 4 seconds. The project has selectable mains/battery operation. If battery then it simply switches to low power mode and wakes up every 4 seconds to check inputs then back to sleep (at least this is what is SHOULD be doing).
CY_ISR(WakeupIsr){
SleepTimer_1_GetStatus();
}
void LowPower(void){
GSM_RST_Write(1);
GSM_SLEEP_Write(1);
isr_1_StartEx(WakeupIsr);
SleepTimer_1_Start();
CyPmSaveClocks();
CyPmSleep(PM_SLEEP_TIME_NONE, PM_SLEEP_SRC_CTW);
CyPmRestoreClocks();
SleepTimer_1_Stop();
}
int main(){
uint8 swmode;
MainsTripped = false;
swmode = MODE_Read();
MainsPowered = swmode& 0x01;
MainsDetect = swmode & 0x02;
MainsLongDelay = swmode & 0x04;
if(MainsLongDelay) MainsDelay = FIVEMINUTE; else MainsDelay = TENSECONDS;
MainsTripCount = MainsDelay;
TestSMS = swmode & 0x08;
CyGlobalIntEnable;
SETTINGS_Init();
COM_Init();
Modem_Ready = SMS_Init();
if(Modem_Ready){
Send_Alarm(msgPOWERUP,0);
}
StartMainsTimer();
for(;;){
CyWdtClear();
if(MainsPowered){
Check_COM_Packet();
Check_SMS_Receive();
Check_Input_State();
if((MainsTimeout)&&(MainsDetect)){
CheckMains();
StartMainsTimer();
}
}
else{
LowPower();
Check_Static_Input_State();
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does the sleep mode interact with watchdog timer? I have cleared the wdt in main loop but not sure if needed. If wdt must be explicitly started then I should not need to reset it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Might help if you post archive of project -
“File” Creator
“Create Workspace Bundle”
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found the issue. It is somehow related to Timer_1_Stop().
When I removed this line, the project ran ok.