AnsweredAssumed Answered

UART receive in twrk65f180m missing bytes?

Question asked by Vivek Srinivasan on May 6, 2015
Latest reply on May 18, 2015 by Vivek Srinivasan
Branched to a new discussion

Hi everyone,

 

I'm using the following board and OS,

 

                              Board : twrk65f180m

                              OS     :  MQX

 

I'm trying to communicate with the Bluetooth chip. I don't know how many bytes I will be receiving. For example this is my Tx and Rx bytes.

 

                                   Tx          -      0x01 0x03 0x0c 0x00

                                   Rx          -      0x04 0x0E 0x04 0x01 0x03 0x0c 0x00

 

The receive bytes will come together and there are no delays in between them. When I try to read them one by one like below

 

                              *lengthRead = _io_read((MQX_FILE_PTR)handle, (void*)buf, (_mqx_int) 1);

 

It just reads the first byte and then the next time it goes and waits for the next byte. Wheras there should be remaining 6 bytes that it should read. It seems like it has no buffer.

 

But when I try to read them all at once like below.

 

                              *lengthRead = _io_read((MQX_FILE_PTR)handle, (void*)buf, (_mqx_int) 7);

 

It returns all the 7 bytes without any issue.

 

I'm using ittyd to communicate with the bluetooth chip. I've even set the buffer size to a maximum of 256 bytes.

 

#define BSPCFG_SCI3_QUEUE_SIZE             256

 

 

Can anyone tell me why can't I read those bytes one by one? If there is a buffer all those bytes should be stored and I can retrieve those bytes the next time right?

 

Also, I'm using two UART's for my application ittyc (default) and ittyd.

 

Your help is much appreciated. Thank you.

 

Regards,

Vivek

Outcomes