2021-06-17 10:37 AM
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.
2021-06-17 10:53 AM
Don't use the blocking HAL_UART functions, use interrupts to manage input/output buffers
With the LoRa stack you could presumably push the timeout longer when you get preamble/header data.
Can you implement the timeout using a different mechanism, ie always waiting for reception, but abort that if you actually have data to send.