AnsweredAssumed Answered

UART blocking transmition/reception and HAL driver: would need some clarification :)

Question asked by Yves Bernard on Dec 5, 2017
Latest reply on Dec 6, 2017 by AvaTar

Hi guys,

I'm fairly new to the world of STM32 and embedded C, and i've been playing with a STM32F401 recently. 


I'm using the HAL UART driver to set a serial communication with my computer through the port COM3, and I have a few questions :


1. It took me a good while before transmitting data correctly. I believe my configuration was good but for some reason, the terminal was displaying only the fist character from my chain. I managed to sort it out by inserting a 1ms delay in the HAL_UART_Transmit driver,each time we have receive one byte. I assume it's not necessary since it wasn't in the original driver but would anyone have an idea of what is hapenning, and what i misunderstand ?


2. When trying to receive data using HAL_UART_Receive, I manage to reveive data byte by byte, but if I entry more than one character (so a chain), the function return only the first character and then go to timeout. I have a feeling there is some timing issue there but I'd like to understand what I am doing wrong and what I misunderstand.


I can add code if you think there is value, but I'd say it's more a theoretical issue.


Also, i'm now gonna look at implementing this with interupt since I beleive it will be more adequate.


Thanks a lot,