Serial Port - Problem with binary frames
I'm developing a program in C that comunicates with a RS232 device. I'm using the POSIX method in order to access the ttyS0 device, as described in the Serial Programming HOW-TO.
The external device uses a binary protocol, so it's been hard to debug. The problem is the following:
My programm receives data from the RS232 device but some of the received characters are interpreted by Linux as negative hex values. For instance, I receive:
ffffffc0 (not a correct value for the received character. My programm takes this as -64 (float))
And here my questions:
1 - I don't know any good serial monitor or sniffer for Linux. What do you recommend me? Remember that I'm working with binary frames. I really need this tool.
2 - Could my problem have something to do with the termio configuration?
Here you have my settings:
newtio.c_cflag = BAUDRATE | CRTSCTS | CS8 | CLOCAL | CREAD;
newtio.c_iflag = IGNPAR | ICRNL;
newtio.c_oflag &= ~OPOST;
newtio.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
newtio.c_cc[VTIME] = 0;
newtio.c_cc[VMIN] = 1;
Thank you very much.