Forum Discussion
Jayeshkumar
New Contributor
4 years agoUART Serial port blocking mode fgetc function not able to fetch required data bytes
Hi,
We have written c code where we are opening the uart serial port in blocking mode and we are using fgetc function to read the data. we are using for loop and if we keep the for loop for 800000 ...
ShengN_altera
Super Contributor
4 years agoHi,
I can't find any related past similar issue on blocking mode serial port uart.
May be you can try adding delay to the for loop if don't want to increase baud rate or iterations.
9600 baud rate means 960 bytes per second so meaning one byte takes about 1ms.
It takes about 2 iterations per byte so meaning one iteration runs at 0.5ms.
Therefore probably can add a 0.5ms delay to for loop. delay(0.5); / usleep(500);
Check this link there are some similarities.
Or may be can access the uart core directly via status register or control register for flag check this manual (Page 146).
Best Regards,
Sheng
p/s: If any answer from community or Intel support are helpful, please feel free to mark as solution and give Kudos.