AnsweredAssumed Answered

Jump to Bootloader issues

Question asked by jayles.romain on Jun 6, 2015
Latest reply on Jun 6, 2015 by jayles.romain
Hello everyone,

I am using a stm32L151CB (PID : 0x416) and I am trying to jump to bootloader while inside a program.
Here is the function I use :

01.void (* sys_mem_boot_jump) (void);
02. 
03.void bootloader_init(u4_t boot_loader_status) {
04.  sys_mem_boot_jump = (void (*) (void)) (*(( u4_t *)SYS_MEM_ADDRESS));
05.  
06.  if (boot_loader_status == 1) {
07.    RCC_DeInit();
08.    SysTick->CTRL = 0;
09.    SysTick->LOAD = 0;
10.    SysTick->VAL = 0;
11.     
12.    __set_PRIMASK(1);
13.     
14.    __set_MSP(RAM_MEM_ADDRESS);
15.     
16.    sys_mem_boot_jump();
17.     
18.    while(1);
19.  }                               
20.}

with :

1.#define SYS_MEM_ADDRESS 0x1FF00004
2.#define RAM_MEM_ADDRESS 0x20000800


(from the Application note 2606, Table 68)

The code seems to work because when I try to send 0x7F on the serial port, the Stm32 answer ACK. But after, when I send the first byte of the command (for example 0x21 for the Go command), the device answer NACK. After this NACK, I can send the full command ( 0x21 + 0xDE) and jump to 0x08000000.

The fact that the device answer NACK on the first part of a command don't enable me to use the application Flash Loader demonstrator.

Do you have any idea why the bootloader has such a behavior with the first command?

Thanks,

Romain

Outcomes