2025-08-11 2:34 AM - edited 2025-08-11 3:37 AM
Hi,
I have an issue with the UASRT communication being abnormal.
First case:
Second case:
I tried to De-Init and Re-Init the UART2, which I expect to reset all the UART2 register values before I send the UART packet.
According to my test case, could I say that the UART error code 0x4 is due to System Bootload Mode?
How could I fix the issue?
Please let me know if more information is required.
2025-08-11 3:27 AM
Hello @TesterSAM
Please describe your issue with more details. What is the issue exactly?
2025-08-11 3:35 AM
I did not expect to get any error code in the UART register when I tried to send the UART Packet to the ST MCU via UART2 after exiting System Bootload Mode (using UART2 to exit the System Bootload mode and access the main application).
Although the second packet contains no error, I would like to know the root cause that led to the UART error code:0x4
In the ST MCU application, I expected to send a UART packet to execute the ST MCU function.
If the first packet is always ignored due to a Frame Error, the other MCU timing that sends the UART packet would be influenced.
2025-08-11 4:57 AM
Hi @TesterSAM
2 things tou could check/try:
1) If the Frame Error bit is set in the ISR of the UART instance you are using after your Init, you could try to clear it by calling
__HAL_UART_CLEAR_FLAG(huart2, UART_CLEAR_FEF);
before your reception on embedded side
2) you mention you perform a DeInit/Init procedure of UART before starting the reception. It is expected that the HAL_UART_DeInit() call, executes the HAL_UART_MspDeInit() function.
Please check that you have those 2 macros executed in HAL_UART_MspDeInit() for UART2 case.
__HAL_RCC_USART2_FORCE_RESET();
__HAL_RCC_USART2_RELEASE_RESET();
This should reset the flag in ISR.
Regards
2025-08-11 5:46 AM
Look at the signal on the line with a logic analyzer to figure out what's going on. Is TX pulled up with a pullup resistor? FE indicates the line is not stable, probably dipping when the pins get (re)initialized.