Question
Failed to trigger STM32L431 USART1 bootloader via SW
Hi guys,
I could set MCU into bootloader mode manually by using PH3/Boot0, but I can't get trigger bootloader via SW...
I did check previous posts, but somehow it does not help.
HW setup: I have dev board with STM32L431. It has USART1 (PA9, PA10) connected to CP2105, which connected to the linux pc.
So far I wonder about these points:
- Based on other posts, could someone confirm that system memory address on STM32L431 is 0x1FFF0000 (as in AN2606) ?
- Is __HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH() step needed on STM32L4?
- Anything else shall be changed in the code?
- Could CP2105 somehow affect the overall result?
- Any other suggestion or clues why triggering bootloader via SW does not work?
Relevant code:
void JumpToBootloader(void)
{
uint8_t i;
void (*SysMemBootJump)(void);
volatile uint32_t addr = 0x1FFF0000;
__disable_irq();
SysTick->CTRL = 0;
SysTick->LOAD = 0;
SysTick->VAL = 0;
HAL_RCC_DeInit();
for (i = 0; i < (sizeof(NVIC->ICER) / sizeof(NVIC->ICER[0])); i++) {
NVIC->ICER[i] = 0xFFFFFFFF;
NVIC->ICPR[i] = 0xFFFFFFFF;
}
__enable_irq();
__HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH();
SysMemBootJump = (void (*)(void)) (*((uint32_t *)(addr + 4)));
__set_MSP(*(uint32_t *)addr);
SysMemBootJump();
}
