cancel
Showing results for 
Search instead for 
Did you mean: 

Do i really need to use HAL_Delay() after each HAL_UART_Transmit()?

AdilMC
Associate II

so i was following an online tutorial (from digikey, where they teach how to use dma) and in it the values from ADC is transmitted through DMA to a buffer of decent size (4096byte). But it seems they always use the hal delay function after using uart transmission. Is this necessary, i noticed that without the delay function my frequency goes from 1khz to 7khz and i dont see any issues with the transmission too.

i mentioned about the dma from adc in case its relevant for using the delay function in uart

2 REPLIES 2
Pavel A.
Evangelist III

No, not really. If you want pauses between sampling the ADC, provide the intervals in any way.

By the way, this forum is the perfect place to ask about internal ADCs of STM32. No digikey or any amateur website even comes close.

 

No

HAL_UART_Transmit(), blocks until completion

HAL_UART_Transmit_DMA(), returns immediately, so you're supposed to wait for the completion or error callbacks to understand when it finished. You call also only have a single operation in-flight at once, and you should pay attention to the scope/life of the buffer you're passing.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..