cancel
Showing results for 
Search instead for 
Did you mean: 

L073 strange behaviour after 2nd bootloader jump to app

LCE
Principal II

Heyho,

playing with the L073, partitioned the flash for bootloader "BL" (bank 1) and application (bank 2).

No writing of app yet, just testing jumping back and forth.

I just added a no-init variable for communication between BL and app, mainly to tell the BL to not jump back to app if the app requested so.

  • at power up / reset, the uninitialized variable "u32AppRqstBootloader" is 0, so the BL jumps to the app, and just for checking: before the jump the BL sets u32AppRqstBootloader = 0xB0072ABB
  • in the app u32AppRqstBootloader is printed via UART, and it shows the expected 0xB0072ABB, the printf is done immediately and takes ~ 2 ticks (1 tick = 1 ms)
  • now I let the app jump to BL, before the jump the app sets u32AppRqstBootloader = 0xABB1B007 so the BL does not jump

So far so good...

But when the BL now jumps back to the app, all of a sudden in the app there's a ~ 1 second delay before u32AppRqstBootloader is printed - everything else is working fine - or so I think... (the next printf requested via UART user interface of that variable is quick again).

If it jumps more often back and forth, it behaves the same: BL prints quickly, the app has the 1 s delay.

I don't find that the application is doing anything differently than after the 1st jump.

I cannot debug this via ST-Link / SWD, it seems the debugger has problems with the jumping between the projects.

Any ideas?

 

PS: here's a copy of the terminal

// 1st start:

**************
* BOOTLOADER *
...

Tick 37
u32AppRqstBootloader 00000000
Tick 39

jump to APP...

џ

// jump okay, now we're in...
 
***************
* APPLICATION *
...

Tick 37
u32AppRqstBootloader B0072ABB
Tick 40        // <<< quick printf after 1st start / jump

// user input via terminal:
> cw Sboot

jump to BL...

џ

// we're back in...
**************
* BOOTLOADER *
...

Tick 37
u32AppRqstBootloader ABB1B007
Tick 39

// user input to jump back to app
> cw Sjapp

jump to APP...

// and we're back in app:
***************
* APPLICATION *
...

Tick 37

// ###### and HERE is the delay, see tick below #######

u32AppRqstBootloader B0072ABB
Tick 1040

 

1 ACCEPTED SOLUTION

Accepted Solutions
LCE
Principal II

"Again what learned" as they say in Germany...

I just took the big hammer and disabled the ADC by setting CR = 0 and disabling the peripheral clock.

Now I found out there's this ADDIS bit to be set and wait for ADEN = 0.

And lo and behold, no more delay!

View solution in original post

3 REPLIES 3
LCE
Principal II

It seems I make the mistake far before the printf... checking stuff between the tick outputs...

Still strange that this only happens after 1st start.

LCE
Principal II

Almost got it:

the app's ADC's internal calibration times out.

But why? Let's find out...

The bootloader does not use the ADC, so it has something to do with the ADC de-init when leaving the app.

LCE
Principal II

"Again what learned" as they say in Germany...

I just took the big hammer and disabled the ADC by setting CR = 0 and disabling the peripheral clock.

Now I found out there's this ADDIS bit to be set and wait for ADEN = 0.

And lo and behold, no more delay!