about uart driver & timeout_cb callback

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: utzig, lbednarz, tfAteba, barthess, RoccoMarco

sntnjrg
Posts: 38
Joined: Mon Jul 22, 2019 2:19 pm
Has thanked: 11 times

Re: about uart driver & timeout_cb callback

Postby sntnjrg » Thu Oct 31, 2019 4:32 pm

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.

User avatar
Giovanni
Site Admin
Posts: 12254
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 585 times
Been thanked: 500 times
Contact:

Re: about uart driver & timeout_cb callback

Postby Giovanni » Thu Oct 31, 2019 6:20 pm

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


Return to “General Support”

Who is online

Users browsing this forum: No registered users and 4 guests