Skip to main content
LOnGr.1
Associate III
April 11, 2023
Question

receive data uart with DMA

  • April 11, 2023
  • 5 replies
  • 2390 views

I am trying to receive data over usart using dma with LL. I'm stuck with this for one week. I need help please.

This topic has been closed for replies.

5 replies

waclawek.jan
Super User
April 11, 2023

Which STM32?

What are the symptoms? Can you receive from the same pin using polling? Are clocks of DMA, USART, GPIO enabled in RCC?

Read out and check/post content of USART, DMA and relevant GPIO registers' content.

JW

LOnGr.1
LOnGr.1Author
Associate III
April 11, 2023

Hi! Thank you for replying. I tried to send some text using the LL_USART_TransmitData8 and it works fine. Same for receiving with LL_USART_ReceiveData8.

As for the clocks, they're enabled in the clock file

Pavel A.
Super User
April 11, 2023
waclawek.jan
Super User
April 11, 2023

Which STM32?

Read out and check/post content of USART, DMA and relevant GPIO registers' content.

JW

LOnGr.1
LOnGr.1Author
Associate III
April 12, 2023

stm32 f407

I don't know if the image is clear, but all the registers are empty


_legacyfs_online_stmicro_images_0693W00000bhvkAQAQ.png

LOnGr.1
LOnGr.1Author
Associate III
April 12, 2023

I put the USART2_DMA_RX inside the while loop in the main file and now the red led (transfer complete interrupt) turns on but only when I reset or flash the microcontroller. I tried to do the same for transmission with DMA and it is working fine

waclawek.jan
Super User
April 13, 2023

If all the UART registers are zero, Tx can't work. It means, you've read out the registers content while UART and DMA were not set up yet - just after reset, perhaps? That's not useful.

Read out the registers after they've been set up, and then again after some characters have been sent to Rx; check, compare, post.

JW

LOnGr.1
LOnGr.1Author
Associate III
April 13, 2023

My bad, I did not take the screenshot at the right time. Here are the registers, TX is working, RX is empty
_legacyfs_online_stmicro_images_0693W00000bi1v4QAA.png

waclawek.jan
Super User
April 13, 2023

Okay, so if DMA1_Stream5's NDTR and both address registers (PAR and M0AR) are zero, you obviously don't write into them, do you. So how could it work?

Please try to check the registers yourself and try to figure out what's going on. You can step through the program while observing the registers. Decimal display of registers is rarely useful, too.

JW