Enthernet Code
DIIDevHeads IoT Integration Server
•Created by Sterling on 8/6/2024 in #firmware-and-baremetal
How to Receive Variable-Length Data Over RS485 Using HAL_UART_Receive_IT on STM32F4?
Hello @Sterling to handle variable-length data sequences, you can use a state machine approach within your
HAL_UART_RxCpltCallback
function. The idea is to first receive the header of the frame which includes the Start byte
, Slave Addr
, and Byte count
. Once you have the Byte count
, you can set up the UART to receive the remaining bytes, let me know if u need code examples to understand it better6 replies