- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I development a firmware, with the Psoc 5, that it need to received data from the I2C when is in sleep. I have a problem, that casually the device resets. In the loop i execute only sleep function and i clear the Wdt. Inside of the loop i don't use the functions to receive from the i2c though the master send me the same the data through the i2c. if I unplug the cable manually, that i use for the i2c communication, the firmware does not reset. I have configured the I2C module in this mode:
Datarate:100kbps
Slave address:0x23
Implementation: fixed function
Address decode:hardware
Pins:I2C1
And this is the sleep function:
void Sleep ( void )
{
// Stop Global Interrupt
CYGlobalIntDisable ;
Enable_3_3V_Write ( OFF ) ;
PSoCBlockOFF ( ) ;
InOutOFF ( ) ;
Custom_Delay ( TIME_1_MS ) ;
// Sleep and wait for PICU interrupt
CyPmSaveClocks ( ) ;
// Mi risveglio con il timer o quando ricevo dati dall'I2C
CyPmSleep ( PM_SLEEP_TIME_NONE , PM_ALT_ACT_SRC_CTW | PM_SLEEP_SRC_I2C ) ;
CyPmRestoreClocks ( ) ;
InOutON ( ) ;
PSoCBlockON ( ) ;
update_Global_Time_from_sleep ( ) ;
Enable_3_3V_Write ( ON ) ;
// Start Global Interrupt
CYGlobalIntEnable ;
// Aggiorno il watchdog
CyWdtClear ( ) ;
}
I have urgency to resolve the problem. Can you help me ?
Solved! Go to Solution.
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
According to my understanding the reset is occurring due to Watchdog Timer (WDT).
1) In the code you have used CyGlobalIntDisable; This will disable interrupts from I2C and WDT.
2) The device is then sent to Sleep using the API: CyPmSleep ( PM_SLEEP_TIME_NONE , PM_ALT_ACT_SRC_CTW | PM_SLEEP_SRC_I2C ). However, since there is no interrupt from I2C due to interrupts being disabled the device will remain in Sleep.
3) The WDT counter increaments by one whenever a WDT interrupt occurs. Since the interrupts are disabled the WDT interrupt will not occur. But the WDT Counter will increament by one each time the central timewheel crosses the programmed tap point. When the counter reaches three, WDT asserts a hardware reset to the device.
You can try enabling the interrupts so that the device wakesup from Sleep and WDT is cleared.
I have created two test projects to test this. In both the projects I have disabled the global interrupts. In the project with sleep api the device is reset after some time (noticed by the blinking of the led) since the Cywdtclear(); is not executed as the device does not wake from Sleep. However the project in which I have not sent the device to sleep, reset does not occur as the wdt is periodically cleared by the Cywdtclear(); api.
Please let me know if this helps. In case this does not resolve you issue please attach you project so that we can recreate the issue at our side.
Best Regards
Ekta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
According to my understanding the reset is occurring due to Watchdog Timer (WDT).
1) In the code you have used CyGlobalIntDisable; This will disable interrupts from I2C and WDT.
2) The device is then sent to Sleep using the API: CyPmSleep ( PM_SLEEP_TIME_NONE , PM_ALT_ACT_SRC_CTW | PM_SLEEP_SRC_I2C ). However, since there is no interrupt from I2C due to interrupts being disabled the device will remain in Sleep.
3) The WDT counter increaments by one whenever a WDT interrupt occurs. Since the interrupts are disabled the WDT interrupt will not occur. But the WDT Counter will increament by one each time the central timewheel crosses the programmed tap point. When the counter reaches three, WDT asserts a hardware reset to the device.
You can try enabling the interrupts so that the device wakesup from Sleep and WDT is cleared.
I have created two test projects to test this. In both the projects I have disabled the global interrupts. In the project with sleep api the device is reset after some time (noticed by the blinking of the led) since the Cywdtclear(); is not executed as the device does not wake from Sleep. However the project in which I have not sent the device to sleep, reset does not occur as the wdt is periodically cleared by the Cywdtclear(); api.
Please let me know if this helps. In case this does not resolve you issue please attach you project so that we can recreate the issue at our side.
Best Regards
Ekta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Good morning, with yours advices we have resolved. Thanks.