Prevent timeout while exchange data between two stm32

I am trying to exchange data (str data) between two STM32 throughout Lora connectivity. Both STM32 has a lora module and the connection between them is working fine. Based on two functions:

T_eError_eErrorType eDataPlane_eReceiveData_Cmd (uint32_t in_uiTimeout, uint8_t* out_pucData, uint8_t *inout_pucLength, T_stSx1276_eRxPacketStatus* out_pstRxPacketStatus)

T_eError_eErrorType eDataPlane_eSendData_Cmd (uint8_t* in_pucData, uint8_t in_ucLength)

I am trying to send and receive messages instantly. I discovered a huge problem: for example I am trying to send a data which has a duration equal to 300ms while the timeout of receiving the data is fixed to 3000 ms. It may, in one rare case, be a loss of such a data, when the data arrives at the time of 2800 ms of the timeout of the receiver. Such a problem is similar to the exchange of data in the UART interface when using the blocking mode (HAL_UART_Receive (&huart1, UART1_rxBuffer, 12, 5000);).
My question is how to garantee receiving the data without losing any byte and by using a receiving with timeout function.
Thanks in advance.

Hey Amir,

Sounds awesome!! How good is all of that documentation?

Data integrity can be a rabbit hole to explore, as that UART function is blocking I would opt for some that uses DMA( direct memory access) so that your processor is not using clock cycles to capture the steams.

Are you running an RTOS as well? Using threads will help from the sounds of it.

Here are some awesome videos that helped get my head around these topics:

Let us know how you go!

1 Like