cancel
Showing results for 
Search instead for 
Did you mean: 

what affects the delay time between message caught and respond of HAL_UART_Receive/Transmit_IT ??

Olly Kao
Associate III

I'm writing a throw-catch case of 2 chips, the Host throws an message onto UART1 bus, then the Slave catches and shows message on UART2 for debugging, there are a delay between catch and throw, but the delay time is not always the same, in my opinion the delay time should all be the same or has just a small difference such as 5 micro seconds, however the delay time may be from 210us to 320us, the difference is 110 micro seconds, how can i reduce this differ?0693W000004GekWQAS.jpg

0693W000004GekbQAC.jpg

0693W000004GekvQAC.jpg

0693W000004GekRQAS.jpg

Thanks

4 REPLIES 4
TDK
Guru

> how can i reduce this differ?

Disable other interrupts (e.g. SysTick).

Enable code optimization.

Write your own handlers instead of using HAL. The CPU needs to wade through a bunch of stuff before it gets to HAL_UART_RxCpltCallback.

I would use a GPIO line and toggle it at certain points in the code to figure out what is causing the jitter in response.

If you feel a post has answered your question, please click "Accept as Solution".
TZARDI
Associate III

​Hello,

Can you specify the board that you're using?

Br,

@TZARDI​  I'm working on stm32F103CB

The process of HAL uart is HAL_UART_Transmit_IT -> USART2_IRQHandler -> HAL_UART_IRQHandler -> UART_Transmit_IT

I toggled an IO pin inside the UART_Transmit_IT after the DR is writen, it shows that the time jitters is not caused by the process of HAL

0693W000004Gn7xQAC.jpg

0693W000004Gn7dQAC.jpg

0693W000004Gn7iQAC.jpg

and i also set uart2 interrupt as the highest priority, but there is still no any clue on jitters