I need to know the exact moment when the serial buffer is empty.
I'm using PySerial but flush() or out_waiting indicates that the buffer is empty too early. I toggle a digital pin when flush() and out_waiting is done and look at the signal on an oscilloscope but the bit change is too early.
Is there a way to know when the buffer is empty in a low level way?
Can you provide the code you're using so we can test it? Also provide the pictures that show the oscilloscope and the measurements using both flush() and out_waiting functions.
What image are you using, the eglibc or the uClibc image? Do you have any external circuitry connected?
I'm busy at the moment but I'm using eglibc and no external circuitry connected. I write some data to the serial port and directly toggle a pin. Later I used the flush and out_waiting functions. I was wondering if it was possible to get the number of bytes in the buffer with direct memory acces.
You can see more information on the DMA's buffer, registers etc. here http://www.intel.com/content/www/us/en/embedded/products/quark/quark-x1000-datasheet.html Intel® Quark™ SoC X1000: Datasheet .
If you can, please provide the code and the oscilloscope pictures with the results of the functions you're using.