2022-08-23 10:36 AM
Hi!
I have an INS that sends the following frames:
I am implementing receive with Normal DMA, 115200 baudrate and IDLE detection, but I have the following problems:
1) The frames I do want are smaller than 100 bytes, but if I declare the receive buffer that size, the reception stops.
2) For that reason I have declared the buffer with a size of 500.
3) As the buffer length is 500, when the callback (TC, I ignore HT) is executed, I observe the content and there are mixed frames. I would expect that whenever IDLE is detected it will hit the callback and write to buffer position 0, but I don't know what's going on.
4) I lose frame 3, which is the smallest and least frequent.
Any suggestion?
Thanks a lot!
2022-08-23 01:26 PM
Are you providing a HAR_UARTEx_RxEventCallback() function? That function is what gets called when an IDLE event is detected. If you instead only look for the DMA HT and TC callbacks, that ignores idle breaks.
2022-08-23 01:30 PM
Yes, that is my callback function. And inside it I make a copy of the buffer because the reception happens very fast.
2022-08-23 02:04 PM
Generally the point of have the HT interrupt is to allow for you to empty the inactive half of a ping-pong buffer.
I'm not sure 115200 would overwhelming for a interrupt based solution, but one could certainly construct a circular DMA buffer, and attend to it periodical. Not sure I'd be using the HAL for any of that, as it has trouble keeping out of it's own way.
2022-08-23 02:10 PM
I am precisely using HAL :(
Okay, I'll try with circular buffer for DMA. Thanks