Forum Discussion
Altera_Forum
Honored Contributor
14 years agoHow to read RS232 ?
Hello all, I have problem with UART, when i want to read serial data (hex byte message - something like bytes: 02,05,01,02,05 after this 10ms space and 03,05,xx,yy,zz etc.). I have deve...
Altera_Forum
Honored Contributor
14 years agoThank you.
I finally solved it with my collegue which advice me to add command stty -F /dev/ttyS3 sane -echo -icanon to rc file. This command stop the echo of input characters. And after open command in program i use: void init_rs232(void) { struct termios options; fd = open(S0_232, O_RDWR | O_NOCTTY | O_NDELAY ); if (fd > 0) { fcntl(fd, F_SETFL, O_NONBLOCK); tcgetattr(fd, &options); options.c_cflag |= (CLOCAL | CREAD | CS8 ); options.c_cc[VMIN] = 1; options.c_cc[VTIME] = 0; options.c_lflag = FLUSHO; tcsetattr(fd, TCSANOW, &options); printf("Init RS232 OK.\n"); } } and now it works well. Jan Naceradsky