daaarwiin
daaarwiin

Reputation: 147

Why is UART w/DMA only receiving last byte of sended data?

This is a screenshot of debug session This is the UARTEx_RxEventCallback() function which should continue to receive bytes. Here you can see in Hercules screen, I sent 123456789 but it only receives the last byte. Why is it happening. My DMA settings are set Normal (not Circular), Periph to Memory, Byte. NVIC interrupt checkbox is enabled. Everything is set as it should be.

Task Init for DMA UART This is the my main task.

Upvotes: 1

Views: 1657

Answers (2)

Tunç Gürsoy
Tunç Gürsoy

Reputation: 11

Your DMA is not working because of the initialization order, you have to initialize DMA before the UART/USART, like this:

/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DMA_Init();
MX_USART3_UART_Init();

Upvotes: 1

Maria
Maria

Reputation: 11

Looks like you don't increment memory address, so data always copied to the first element of the array. hdma_usart3_rx.Init.MemInc should be DMA_MINC_ENABLE

Upvotes: 0

Related Questions