alejoseb / Modbus-STM32-HAL-FreeRTOS

Modbus TCP and RTU, Master and Slave for STM32 using Cube HAL and FreeRTOS
GNU Lesser General Public License v2.1
580 stars 192 forks source link

Correct order of RingAdd() and HAL_UART_Receive_IT() in HAL_UART_RxCpltCallback()? #15

Closed schweigstill closed 3 years ago

schweigstill commented 3 years ago

In HAL_UART_RxCpltCallback() there is the following code:

RingAdd(&mHandlers[i]->xBufferRX, mHandlers[i]->dataRX); HAL_UART_Receive_IT(mHandlers[i]->port, &mHandlers[i]->dataRX, 1);

Is this really the correct order? Shouldn't the dataRX buffer be filled by HAL_UART_Receive_IT() before it gets send to the ringbuffer?

schweigstill commented 3 years ago

My mistake: the call of 'HAL_UART_Receive_IT()' starts reception of the next character. So this issue can be removed.