[En-Nut-Discussion] UsartRead and timeout

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Mon Apr 24 19:28:59 CEST 2023


Hello,

../../dev/usart.c in UsartRead reads:
    228     /*
    229      * Wait until at least one character is buffered or until a read
    230      * timeout occured.
    231      */

Is this really the intended behaviour? I would expect to read like

* Wait until the requested number of character is buffered or until a read
* timeout occured.

This would be in line with e.g.
https://learn.microsoft.com/en-us/windows-hardware/drivers/serports/setting-read-and-write-timeouts-for-a-serial-device"
"Serial.sys continues to transfer bytes until the requested number of
bytes are transferred or a time-out event occurs."

Returning after the first received byte makes it hard to wait for the
full multi-byte answer of an external device.

What is your opinion?

Thanks
-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 1623569 ------- Fax. 06151 1623305 ---------


More information about the En-Nut-Discussion mailing list