Hi Giovanni,
In the test, I expect to receive data packets of 74 bytes that are sent every 6 seconds. In the first reading, I receive the data correctly. Before invoking the uartStartReceiveI() or uartStartReceive() function, the buffer is filled with the value to 0.
With respect to the second one, I interpret that when the callback associated with the timeout was invoked, only 5 bytes were read but I don't understand why the data is put at the end of the buffer.
However, at this moment I'm using the uartStopReceiveI() function to determine how much data has been received when the callback associated with the timeout is invoked and I have not replicated the same situation again. It is likely that it had a buffer overflow. I will review the code.
On the second question, to know how many data I have read when the callback associated to the timeout is invoked, I have observed that if it does not read anything, the driver remains in the UART_RX_ACTIVE state. Then, using the uartStopReceiveI() function I can know the data I have read. Is this so? Is there another way to determine how much data I have read?
Thank you.
about uart driver & timeout_cb callback
Moderators: RoccoMarco, lbednarz, tfAteba
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: about uart driver & timeout_cb callback
Yes, you are supposed to stop it and know the actual received data.
Make sure to enable assertions and state checker in chconf.h.
Giovanni
Make sure to enable assertions and state checker in chconf.h.
Giovanni