2024-09-20 08:04 AM
If I call HAL_UARTEx_ReceiveToIdle_IT to receive 512 bytes, will it wait till all 512 bytes are received before calling HAL_UARTEx_RxEventCallback or could it possibly call it several times, delivering fragments of the whole packet?
I'm asking because I see it getting called with smaller Sizes... and as far as I can see on my oscilloscope, there is no glitching in the stream being sent from the other device. No gaps or dropouts. There are some long sequences of 0x00 but they all have valid start and stop bits.
If the defined behaviour is to call the callback only on IDLE or when the full specified size has been received, then I'll need to look elsewhere for the issue. I'm just trying to get some clarity on what this method could do.
Solved! Go to Solution.
2024-09-20 08:36 AM
It calls HAL_UARTEx_RxEventCallback in the following cases:
Use HAL_UARTEx_GetRxEventType to figure out which of these happened.
As stated in the source code:
* @note When HAL_UARTEx_ReceiveToIdle_IT() or HAL_UARTEx_ReceiveToIdle_DMA() API are called, progress
* of reception process is provided to application through calls of Rx Event callback (either default one
* HAL_UARTEx_RxEventCallback() or user registered one). As several types of events could occur (IDLE event,
* Half Transfer, or Transfer Complete), this function allows to retrieve the Rx Event type that has lead
* to Rx Event callback execution.
2024-09-20 08:19 AM
The timeout for IDLE detection is quite small, maybe you don't notice this on the scope. Or some glitches are mistaken for start bits. Or RX stops because of other errors (FE, PE ...). Defined behavior is call a callback because of IDLE or other "events". If no "event" occur there should not be other reasons to stop. Anyway, recommend to write your own UART code instead of wandering in that "HAL" library. It is not too hard and result will be gratifying.
2024-09-20 08:36 AM
It calls HAL_UARTEx_RxEventCallback in the following cases:
Use HAL_UARTEx_GetRxEventType to figure out which of these happened.
As stated in the source code:
* @note When HAL_UARTEx_ReceiveToIdle_IT() or HAL_UARTEx_ReceiveToIdle_DMA() API are called, progress
* of reception process is provided to application through calls of Rx Event callback (either default one
* HAL_UARTEx_RxEventCallback() or user registered one). As several types of events could occur (IDLE event,
* Half Transfer, or Transfer Complete), this function allows to retrieve the Rx Event type that has lead
* to Rx Event callback execution.
2024-09-20 09:12 AM