Bootloader and application issue with SWT component
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-01-18 10:58 PM
Hi,
I am working on SPC58NG84E7 bootloader.
Everything works fine - I have BL code(at 0xFC0000) which jumps to the APP location 0xFD0000 after waiting for 10sec after startup and executes the code there. Both codes are without SWT.
Issue - But when I added SWT component to BL, on powerOn BL is not running. swt_lld_stop() is called before jump.
If I start the BL through UDE debugger application it executes BL, jumps to APP, executes APP code, but then reset from APP and entering into BL is not working.
This issue remains in APP with SWT and without SWT both.
What could be the issue here?
Regards,
AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-01-19 1:39 AM
Hello,
SWT is a watchdog. It prevent your application to be locked for too much time by resetting the HW.
If you activate SWT, you must regularly feed it as explained in the reference manual to avoid a reset.
Both your BL and APP software must take care of SWT if enabled.
Best Regards,
-Olivier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-01-19 2:49 AM
I am refreshing the watchdog by calling swt_lld_keep_alive() in SWT callback function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-01-19 3:06 AM
Do you see this exact line in your function swt_lld_keep_alive() ?
/* get old key */
old_serv_key = swtd->swtp->SK.B.SK;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-01-19 3:33 AM
yes..it is there!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-01-19 4:43 AM
This line is wrong and could cause a RESET when you call the function
Please replace it by this one and test your program again:
/* get old key */
old_serv_key = swtd->swtp->SK.R; /* 32 bit access to the register */
Regards,
-Olivier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-01-19 9:23 PM
Hi Olivier,
I replaced mentioned line in function swt_lld_keep_alive() . But could not see any difference in the execution.
The issue mentioned above still persist.
Thanks!
Regards,
AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-01-20 2:03 AM
Hi Olivier,
I had used same configuration as in the image you shared except SWT0 with timeout period is 5000.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-01-20 2:17 AM
Hello,
then it means you do not use the SWT in pseudo random mode I was suspecting.
When you say you activate the SWT in you BL code ONLY, I suppose you took example on "SPC58xGxx_RLA SWT Test Application for Discovery" :
You selected SWT in Low Level Driver component:In SWT settings in outline menu, you selected SWT2;
you configured SWT2 like this:
Each time you modify demo configuration, you need to clean :
and regenerate the sources:
before to rebuild:
In your main function, after componentsInit and irqIsrEnable, you started SWT2:
swt_lld_start(&SWTD3, &swt2_config);
Did you added this callback in your main.c:
void swt2_callback(SWTDriver *swtp) {
swt_lld_keep_alive(swtp);
}
And finally, did you stop SWT2 in the timeout callback just before to jump ?
void stm_timeout_callback(void) {
...
swt_lld_stop(&SWTD3);
updater_jump();
...
}
Regards,
-Olivier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-01-20 2:21 AM
Also when you say:
"on powerOn BL is not running"
What does it mean ? MCU is resetting before to jump to APP ?
What is the BL behavior when you debug, when SWT is activated on BL only ?
Regards,
-Olivier
