AnsweredAssumed Answered

RS485 frame reception through DMA and UART

Question asked by Gates on Apr 17, 2018
Latest reply on May 9, 2018 by AvaTar

Hello

I am starting a new project in which I have to use a RS4785 communication and this time,  I'd like to do it well.

The problem is the following:

If I want to receive a frame with UART using DMA, I need to call HAL_UART_Receive_DMA function. This function needs to have the "size" parameter to know the amount of data to be received. Unfortunately, the size of data being received is unknown.

The protocol I am using is MODBUS and it assumes that an end of frame can be detected is there is a silence time (three times the delay of 1 byte) detected.

My question is the following: how can I automatically stop the reception process when this silence time is detected so that my HAL_UART_RxCpltCallback callback can be called? Is there any flow control function I can use with UART to control the DMA?

Outcomes