cancel
Showing results for 
Search instead for 
Did you mean: 

Bootloader and application issue with SWT component

AVM
Associate III

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

21 REPLIES 21
ODOUV.1
ST Employee

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

AVM
Associate III

I am refreshing the watchdog by calling swt_lld_keep_alive() in SWT callback function.

ODOUV.1
ST Employee

Do you see this exact line in your function swt_lld_keep_alive() ?

  /* get old key */

  old_serv_key = swtd->swtp->SK.B.SK;

AVM
Associate III

yes..it is there!

ODOUV.1
ST Employee

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

AVM
Associate III

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

AVM
Associate III

Hi Olivier,

I had used same configuration as in the image you shared except SWT0 with timeout period is 5000.

Thanks!

ODOUV.1
ST Employee

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:0693W00000JMf7rQAD.pngIn SWT settings in outline menu, you selected SWT2;0693W00000JMf8uQAD.pngyou configured SWT2 like this:0693W00000JMfAMQA1.png 

Each time you modify demo configuration, you need to clean :

0693W00000JMfHSQA1.pngand regenerate the sources:

0693W00000JMfHhQAL.pngbefore to rebuild:

0693W00000JMfIGQA1.png 

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

ODOUV.1
ST Employee

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