Forum Discussion
Altera_Forum
Honored Contributor
20 years agoI haven't found a way to detect if there is a byte in the receive buffer of the UART with high-level HAL functions (like read(), getc()...) only. This was the reason why we created our own low-level driver for the UART which has a different read() function which returns immediately even if there was no data received. If this is the case, our function simply returns a value which indicates that 0 bytes are received and the calling code can continue.
Unfortunately I cannot give you the code of our driver because there is some other functionality in this driver which is very application-specific.