Missing serial data

I have a strange problem with the serial communication. In the application that I’m developing came the need to exchange binary data in the range 0x00 - 0x1f using the serial port. I noticed that if I have the characters 0x11 or 0x13 in the stream of data sent to the ConnectMe device, the number of characters reported as received is incorrect. As an example, if I send 0x00, 0x01, 0x03, 0x04, 0x05…0x11, for a total of 18 chars, the tcgetbuffers function reports as received only the characters with the index a multiple of 4 (0x00, 0x04, 0x08, 0x0C). The same weird result happens when I have 0x13 as ingredient. Furthermore, if I keep on sending these two “special” characters, they will not be detected by the function tcgetbuffers( ). ONLY THESE TWO CHARACTERS CREATE WRONG RESULTS, other combinations of bytes would report correct results.

I suspect that you have not specifically masked out XON and XOFF of the termios.c_iflag.

The termios serial driver, by default, enables software flow control. Whether this is the right thing to do, could be debated.

It would generally be a “best practice” to mask out (clear) all bits, of all flags, and set only those in which you require.

Regards,
Cameron

Thanks for the tip. Once I cleared those iflag bits my application works properly.