Skip to main content
BGowd.3
Associate
February 15, 2019
Question

STM32l072 is not going to bootloader mode.

  • February 15, 2019
  • 4 replies
  • 1044 views
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.

This topic has been closed for replies.

4 replies

Tesla DeLorean
Guru
February 15, 2019

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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
BGowd.3
BGowd.3Author
Associate
February 15, 2019
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 ) .

Tesla DeLorean
Guru
February 15, 2019

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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
BGowd.3
BGowd.3Author
Associate
February 21, 2019

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