Skip to main content
jlecl.1
Associate III
May 30, 2023
Solved

Data transmit by UARD (DMA) with junk character

  • May 30, 2023
  • 2 replies
  • 1263 views

Dear eveyone,

I' little confuse..

I'm trying to send dat over uart from a nucleo board (F103 + FDTI). If a use "normal"method, it's work great.

I mean, i receive "1234567890" WITH a new line.

uint8_t start [20]= "1234567890 \n\r";
HAL_UART_Transmit(&huart1, start, sizeof(start),10);

But when i use DMA

uint8_t start [20]= "1234567890 \n\r";
HAL_UART_Transmit_DMA(&huart1, start, sizeof(start));

I get a lot of<NULL> character before data...

Maybe a need to reinit the buffer DMA ?

if you have an idea...

This topic has been closed for replies.
Best answer by Tesla DeLorean

Use strlen() not sizeof() for strings.

HAL DMA functions return IMMEDIATELY, make sure that the variable remains in SCOPE for the entirety of the transfer, and make sure not to start new transfers until the prior one has completed.

2 replies

jlecl.1
jlecl.1Author
Associate III
May 30, 2023

error : the junk charater appears after the \n\r...

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
May 30, 2023

Use strlen() not sizeof() for strings.

HAL DMA functions return IMMEDIATELY, make sure that the variable remains in SCOPE for the entirety of the transfer, and make sure not to start new transfers until the prior one has completed.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
jlecl.1
jlecl.1Author
Associate III
May 30, 2023

recess... thanks a lot !