what affects the delay time between message caught and respond of HAL_UART_Receive/Transmit_IT ??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-09-21 08:59 PM
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?
Thanks
- Labels:
-
STM32F1 Series
-
TIM
-
UART-USART
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-09-22 05:52 AM
> 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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-09-22 05:52 AM
​Hello,
Can you specify the board that you're using?
Br,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-09-22 05:40 PM
@TZARDI​ I'm working on stm32F103CB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-09-22 09:06 PM
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
and i also set uart2 interrupt as the highest priority, but there is still no any clue on jitters