2021-09-24 03:42 PM
Hello,
I'm working on STM32L051 MCU. 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 here in the Cube programmer, it says it is receiving 0x86 and 0xFE respectively but not 0x79 which is sent by the MCU.
I'm unable to understand why there is a mismatch when MCU and the software when data is transmitted. I would be great if anyone helps me resolving this issue.
Thanks!
2021-09-24 04:05 PM
How and to what are you connecting the STM32 UART pins?
The MCU's CMOS levels are NOT compatible with RS232, if you are using an RS232 connection you need level converters.
2021-09-24 04:27 PM
0x86 is the inverse of 0x79. Most likely you have the levels inverted somewhere along the hardware chain.
2021-09-24 06:42 PM
I'm using USB to UART converter pin.
This cable
2021-09-24 06:44 PM
How do I resolve this issue? Unfortunately I won't be having control over UART Transmission..