cancel
Showing results for 
Search instead for 
Did you mean: 

I have written a simple application that takes characters from one UART and relays them to another. main is empty. Only two callbacks of HAL Rx and Tx are used.

MPoll.1
Associate

Why, when transmitting at 115200 baud, after transmitting the Tx stop bit, the callback occurs after 8.5us? Does HAL add more delay? When using GPIO I measure the time on the scope from stop bit to stop bit I get 100us instead of 87us. Configuration half duplex 8bit, 1 start, 1 stop bit with ISR.

2 REPLIES 2

Which STM32, what clocks?

Cube/HAL is written in a very inefficient way, in the name of flexibility.

Try switching on compiler optimizations.

JW

MPoll.1
Associate

I'm using STM32G0B1 and UART works as 1-wire , 64MHz clock. I'm rising GPIO before Tx enable and clear this GPIO in TX callback, but after the last byte was transmitted. In scope check the GPIO I get ~8.5us between stop bit transmitted and Tx callback occure.

This despite the fact that the frame is accepted by another MSU.

The problem is that another MSU sends a response after 250us. At the same time ST MCU still is in Tx callback.

Please see below :

Green channel is a signal ( Stop bit from ST MCU)

Yellow channel start of transmitting of another device

Blue End of transmitting of ST MCU from Tx callback ( HAL)0693W00000aJrPzQAK.jpg