Loading...
 
Skip to main content

System Workbench for STM32


UART circular buffer

By the way, I figured out tonight that what I wrote was actually bad advice. When I did it with my code, it resulted in hard fault errors. After a little more web research I found what is probably a better way to deal with variable-length UART input: Use the idle line detection interrupt. When the transmission you are receiving string is done, the ISR will activate and then you can deal with the complete transmission and start a new DMA reception. I haven't implemented it yet, but I wanted to get this out there before someone else tries to use a really long receive length. Seems like a continuous reception into a circular buffer would be an obvious use-case for UART DMA, so I find the HAL disappointing in this area.