2024-01-23 11:42 PM - edited 2024-01-23 11:45 PM
I am using the NUCLEO-G071RB, STM32CubeIDE (v1.14.0), and the HAL library STM32Cube_FW_G0_V1.6.2 for prototyping firmware that should communicate with an external device using UART single-wire, half-duplex communication.
The expected startup response from the device is 0x73xxxxxx, which works after a full power-cycle (power off/on). However, after a software reset using the HAL function NVIC_SystemReset(), the startup response has a leading zero byte: 0x0073xxxx, which invalidates the packet and causes communication to fail.
Question:
How to prevent the leading zero byte? Does a software reset require an additional command to flush the UART RX buffer?
Thank you!
2024-01-24 05:51 AM - edited 2024-01-24 05:51 AM
A software reset also completely resets the UART peripheral. It doesn't keep stored information or previously received bytes. There is likely some other explanation as to what's happening here. Use a logic analyzer and show the UART lines along with NRST to see what's happening on the line.