Hallo, ich möchte beim Raspberry Pi (Modell B v2.0) die UART in einem C-Programm konfigurieren und auslesen. Ich verwende dazu die Funktionen aus termios.h. Mein Problem: Ich möchte die UART so konfigurieren, dass weder Paritätsfehler noch die BREAK-Kondition berücksichtig werden, sondern ausschließlich framing errors (fehlendes Stoppbit) mit der Sequenz '\377' '\0' signalisiert werden. Hier ein Auszug aus meiner Konfiguration:
1 | cfsetispeed(&rpiOpt, B9600); // set baud rate line in |
2 | cfsetospeed(&rpiOpt, B9600); // set baud rate line out |
3 | |
4 | rpiOpt.c_cflag &= ~PARENB; // no parity bit |
5 | rpiOpt.c_cflag &= ~CSTOPB; // 1 stop bit |
6 | rpiOpt.c_cflag &= ~CSIZE; // 8 data bits |
7 | rpiOpt.c_cflag |= CS8; |
8 | rpiOpt.c_cflag |= CLOCAL; |
9 | rpiOpt.c_cflag |= CREAD; // allow read access |
10 | |
11 | rpiOpt.c_lflag &= ~ICANON; // non-canonical mode (raw mode) |
12 | rpiOpt.c_lflag &= ~(ECHO | ECHOE); // no echo |
13 | rpiOpt.c_lflag &= ~ISIG; // no interrupts |
14 | |
15 | rpiOpt.c_iflag &= ~IGNPAR; // do not ignore input framing/parity errors |
16 | rpiOpt.c_iflag &= ~INPCK; // disable input parity checking |
17 | rpiOpt.c_iflag |= PARMRK; // mark framing/parity errors |
18 | rpiOpt.c_iflag |= IGNBRK; // ignore BREAK |
19 | |
20 | rpiOpt.c_oflag &= ~OPOST; // raw output |
21 | |
22 | rpiOpt.c_cc[VMIN] = 0; // wait for at least 0 chars |
23 | rpiOpt.c_cc[VTIME] = 10; // timeout 1 second |
24 | |
25 | tcflush(rpiFd, TCIOFLUSH); |
26 | |
27 | tcsetattr(rpiFd, TCSAFLUSH, &rpiOpt); |
Der Zeichenempfang funktioniert soweit. Doch leider werden keine framing errors markiert - obwohl definitiv vorhanden! Wie muss ich die Konfig. abhändern? Ist das gewünschte Verhalten über termios.h überhaupt möglich? Vielen Dank im Voraus! Gruß, Matthias