cancel
Showing results for 
Search instead for 
Did you mean: 

USART1 RX_DMA issue in FreeRTOS U5A5ZJQ

Metyus
Associate II

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

 

1 REPLY 1
Sarra.S
ST Employee

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

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.