Serial driver and gap between each character

Discussions and support about ChibiOS/HAL, the MCU Hardware Abstraction Layer.
baoshi
Posts: 9
Joined: Wed May 15, 2013 5:49 am
Been thanked: 1 time

Serial driver and gap between each character

Postby baoshi » Mon Jun 19, 2017 2:08 am

Hi,
I'm testing Serial driver performance.
A simple program only calls
sdWrite(&SD1, buf, 64);
chThdSleepMilliseconds(500);

in the main loop.
SD1 is set to 115200 and 921600 respectively. All ChibiOS debug checks are disabled.
As can be seen from the attached screenshot.
115200.png
921600.png

For 115200 baud, there is a 4.54us gap in between two characters.
While for 921600 baud, the gap increased to 19.62us
I understand the gap may be caused by lock/unlock, signaling in the ISR, but why is so that it varies so much for different baud rate?

Thanks

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Serial driver and gap between each character

Postby Giovanni » Mon Jun 19, 2017 7:49 am

Hi,

It is caused by the IRQ service times, if you need to operate at very high speeds then try the UART driver, it uses DMA.

Giovanni

baoshi
Posts: 9
Joined: Wed May 15, 2013 5:49 am
Been thanked: 1 time

Re: Serial driver and gap between each character

Postby baoshi » Mon Jun 19, 2017 8:28 am

Giovanni wrote:Hi,

It is caused by the IRQ service times, if you need to operate at very high speeds then try the UART driver, it uses DMA.

Giovanni


Yes understand IRQ causes the delay. But why serving TXE takes longer time for higher baudrate? Should they take same time?

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Serial driver and gap between each character

Postby Giovanni » Mon Jun 19, 2017 9:38 am

Hi,

It could be because other IRQ sources, is the UART IRQ at highest priority? usually it is not and that can cause jitter.

Giovanni


Return to “ChibiOS/HAL”

Who is online

Users browsing this forum: No registered users and 7 guests