Skip to main content
Lucas C
Associate
July 28, 2017
Question

HAL_UART_Transmit_IT pauses during transmission

  • July 28, 2017
  • 1 reply
  • 1832 views
Posted on July 28, 2017 at 22:16

Hi everyone,

This is not a very serious issue for my application, however, I would like to understand this behavior.

In my application, when the STM receives a packet, it sends out a packet with a confirmation. The content of the packets is not important. What matters is that sometimes the transmission of the packet, in this case, 6 bytes, is paused. As you can see in the images, it transmits 5 bytes, then pauses for about 22ms and then transmits the last byte.

This shouldn't happen as I called the function HAL_UART_Transmit_IT() passing the array with the 6 bytes to be written at once. They should be all transmitted together.

Does any one know what could cause this delay?

I'm using an STM32F030R8 and, according to the header in my code, it should be HAL lib version 1.4.

0690X00000607jgQAA.png0690X00000607gYQAQ.png0690X00000607jMQAQ.png

#usart-tx-issue #uart-tx #hal_uart_transmit_it
This topic has been closed for replies.

1 reply

Tesla DeLorean
Guru
July 28, 2017
Posted on July 28, 2017 at 22:21

>>

Does any one know what could cause this delay?

Mindless spin loops? It's HAL it is jammed full of nonsense..

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Lucas C
Lucas CAuthor
Associate
July 28, 2017
Posted on July 28, 2017 at 22:29

Hahah, isn't that right?! Unfortunately, I think your answer sums it up.

Tesla DeLorean
Guru
July 28, 2017
Posted on July 28, 2017 at 23:00

One of my key problems with the design is the constant use of blocking loops, and no demarcation of which routines are interrupt safe/suitable and those which aren't. I have a HAL example here, shipped from the source, which uses a USART, a radio, and a ticker, and the interrupts on these cause such awful inter-play that there is data loss on ALL interfaces.

I see opportunity for dead-locks, and more frequently priority inversion.

Check carefully the preemption levels on interrupts in use, and where it might be in a spin loop waiting for some event to occur.

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