cancel
Showing results for 
Search instead for 
Did you mean: 

STM32l072 is not going to bootloader mode.

BGowd.3
Associate II
void JumpToBootloader(void) {
	void (*SysMemBootJump)(void);
 
	volatile uint32_t addr = 0x1FFF0000;
 
	HAL_RCC_DeInit();
  	
        HAL_DeInit(); 
       
        SysTick->CTRL = 0;
	SysTick->LOAD = 0;
	SysTick->VAL = 0;
 
	__disable_irq();
	
	
	__HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH();	
	
	SysMemBootJump = (void (*)(void)) (*((uint32_t *)(addr + 4)));
	
	__set_MSP(*(uint32_t *)addr);
	
	SysMemBootJump();
	
}

I am using STM32l072( B-L072Z-LRWAN1 Discovery kit).Trying to jump to Bootloader using above code .I am trying to flash code using usb to ttl board to port UART2(LPUART1) with Demonstrator GUI tool. After calling above function ,Demonstrator GUI tools is not able to connect to board.

4 REPLIES 4

The interrupt being disable probably isn't helpful in this context, and the SYSCFG clock needs to be enabled for the remap to occur.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
BGowd.3
Associate II
void JumpToBootloader(void) {
	void (*SysMemBootJump)(void);
 
	volatile uint32_t addr = 0x1FFF0000;
 
	HAL_RCC_DeInit();
  	
        HAL_DeInit(); 
       
        SysTick->CTRL = 0;
	SysTick->LOAD = 0;
	SysTick->VAL = 0;
 
	//__disable_irq();
	
	HAL_RCC_SYSCFG_CLK_ENABLE();
	__HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH();	
	
	SysMemBootJump = (void (*)(void)) (*((uint32_t *)(addr + 4)));
	
	__set_MSP(*(uint32_t *)addr);
	
	SysMemBootJump();
	
}

Not working even the above changes are made (commenting disable irq line and enabling SYSCFG clock ) .

Are you sure the system loader in the L0 permits this type of operation?

Have you stepped the code into the loader and checked to see if that is behaving normally?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
BGowd.3
Associate II

Yes i have checked it .It is mentioned that direct jump to system memory is possible .