Skip to main content
Explorer
August 22, 2024
Question

USART1 RX_DMA issue in FreeRTOS U5A5ZJQ

  • August 22, 2024
  • 1 reply
  • 566 views

Hello,

I have tried to set up USART1 Receive in DMA mode and with FreeRTOS. 

RX is GPDMA channel 0, Circular mode, Destination increment address on, burst size 16 bytes, priority Medium. Source increment off, burst 1 byte.

USART1 : 115200 baudrate, 8 bits, no parity, stop 1 bit, Async.

Timebase: TIM1.

The receive was working as intended, before I implemented FreeRTOS, I cannot track exact sequence, but now input (3-4+ characters) will trigger both TC and HT at the same time, with number of times called proportional to bytes received 40 bytes ~ 10 callbacks. Buffer is 16 bytes, so no callbacks should have been activated and it is not working way it should.

Next only the LAST four bytes will be actually written to the FIRST buffer cells, so input of "flag5341" will write 3,4,1,\r into the [0]-[3] buffer.

This looks like some fundamental issue, and I am not sure where it exactly breaks it. 

How can I make it work?

Thank you

 

    This topic has been closed for replies.

    1 reply

    ST Employee
    August 28, 2024

    Hello @Metyus 

    >>only the LAST four bytes will be actually written to the FIRST buffer cells

    Ensure the buffer size is correctly set and that the DMA is writing to the correct memory locations