2021-09-23 01:08 PM
Hello,
I'm working on STM32l051K8 MCU with the custom board design. I just wanted to enter the device to the bootloader for serial flashing via USART peripheral.
Here is the simple C code to enter into the bootloader for STM32L0xx family MCU.
void JumpToBootloader(void) {
void (*SysMemBootJump)(void);
volatile uint32_t addr = 0x1FF00000;
#if defined(USE_FULL_LL_DRIVER)
LL_RCC_DeInit();
#endif /* defined(USE_LL_DRIVER) */
/**
* Step: Disable systick timer and reset it to default values
*/
SysTick->CTRL = 0;
SysTick->LOAD = 0;
SysTick->VAL = 0;
__disable_irq();
#if defined(STM32L051xx)
SYSCFG->CFGR1 = 0x01;
#endif
SysMemBootJump = (void (*)(void)) (*((uint32_t *)(addr + 4)));
__set_MSP(*(uint32_t *)addr);
SysMemBootJump();
}
and after entering into the bootloader, we can see 0x7f and 0x79 value in RDR and TDR registers of USART as shown below as per the bootloader requirement for USART.
But still on STM32Flash loader the device says it is unrecognizable as shown below.
Here is the STMflash loader settings.
Still I'm unsure why the software is not recognizing the STM32 MCU. It would be great help from your end if someone help me in fixing the issue.
Thanks!
2021-09-23 01:44 PM
>>Still I'm unsure why the software is not recognizing the STM32 MCU.
Old Software
For the L0 you likely need to be using STM32 Cube Programmer in UART mode.
2021-09-23 01:47 PM
Your code also doesn't look to map the ROM properly, and disables interrupts at the CPU level. Nothing turns that on again. UART might work, doubt USB will.
2021-09-23 02:54 PM
This is the system memory of the L0. It is 0x1FF00000. Do I need to add any extra offset for this?
2021-09-23 04:39 PM
Also I tried using STM32 Cube programmer. I'm getting this error.
2021-09-24 04:06 PM
Related, could have continued thread https://community.st.com/s/question/0D53W000016N04lSAC/stm32-cube-programmer-not-receiving-0x79-in-uart-mode