2020-04-23 8:05 AM
Hi,
My setup:
I'm started from example "SPC570Sxx_RLA Bootloader Application for Discovery".
I modified the example in order to have the possibility to update the firmware using both CAN and SERIAL.
If the first packet is a CAN packet, firmware update procedure starts using CAN .
Instead, If the first packet is a SERIAL packet, firmware update procedure starts using SERIAL.
Everything works as expected.
After that, I added the SWT (Software Watchdog Timer).
Below, "init" function and "feed" function.
#define WDT_SR_WSC_UNLOCK_SEQ1 0xC520
#define WDT_SR_WSC_UNLOCK_SEQ2 0xD928
#define WDT_SR_FIXED_SERVICE_SEQ1 0xA602
#define WDT_SR_FIXED_SERVICE_SEQ2 0xB480
void wdt_init(void){
SWT_0.SR.R = WDT_SR_WSC_UNLOCK_SEQ1;
SWT_0.SR.R = WDT_SR_WSC_UNLOCK_SEQ2;
/* Check soft lock bit */
while (SWT_0.CR.B.SLK == 0x1);
/* Configure timeout register (TO) */
SWT_0.TO.R = WDT_TO_1_SEC;
/* Configure control register (CR) */
SWT_0.CR.R = 0xFF000008; /* MAPn = Default value */
SWT_0.CR.B.WEN = 0x01; /* 1 SWT is enabled */
SWT_0.CR.B.FRZ = 0x01; /* 1 SWT counter is stopped in debug mode */
SWT_0.CR.B.STP = 0x01; /* 1 SWT counter is stopped in stop mode */
SWT_0.CR.B.ITR = 0x00; /* 0 Generate a reset on a time-out */
SWT_0.CR.B.WND = 0x00; /* 0 Regular mode, service sequence can be done at any time */
SWT_0.CR.B.RIA = 0x01; /* 1 Invalid access to the SWT causes a system reset if WEN=1 */
SWT_0.CR.B.SMD = 0x00; /* 00 Fixed Service Sequence, the watchdog is serviced by writing the fixed sequence 0xA602, 0xB480 to the SWT_SR */
}
void wdt_feed(void){
SWT_0.SR.R = WDT_SR_FIXED_SERVICE_SEQ1;
SWT_0.SR.R = WDT_SR_FIXED_SERVICE_SEQ2;
}But, watchdog doesn't work.
I tested these functions (wdt_init and wdt_feed) in an another application and everything works.
But inside bootloader, it doesn't work!
Please, could you help me?
Thanks
Leo
2020-04-28 5:52 AM
Hi Leo,
please, could you clarify me the following points?
MC_RGM.FES.R = 0xFFFFU;
MC_RGM.DES.R = 0xFFFFU;
at the start of wdt_init function and check if the issue is solved?
Regards,
Luigi
2024-02-28 6:59 AM
Hi,
sorry to post again in this old one but I'm intereste dabout the tool you use for download the new firmware via can bus
thanks
Fabio
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.