简体   繁体   中英

BBB Mark/Space parity

So I've enable UART-1 on the BBB. I've tried setting it up to use mark/space parity via termios & stty. According to the doc it supports this.

termios setup:

options.c_cflag &= ~CSTOPB;      
options.c_cflag &= ~CSIZE;         
options.c_cflag &= ~CRTSCTS;        

options.c_cflag |= CS8;
options.c_cflag &= ~PARODD;
options.c_cflag |= PARENB;
options.c_cflag |= CMSPAR;

options.c_oflag = 0;
options.c_lflag = 0;
options.c_iflag &= ~(IXON | IXOFF | IXANY | IGNBRK);
options.c_iflag |= INPCK | PARMRK;

stty output:

speed 9600 baud; rows 0; columns 0; line = 48;
intr = }; quit = ^A; erase = <undef>; kill = ^P; eof = M-4; eol = M-`; eol2 = <undef>; swtch = M-^X;
start = E; stop = M-p; susp = M-6; rprnt = $; werase = M-6; lnext = 8; flush = M-^Y;
min = 182; time = 174;
parenb -parodd cmspar cs8 -hupcl -cstopb -cread clocal -crtscts
-ignbrk -brkint -ignpar parmrk inpck -istrip -inlcr -igncr icrnl -ixon -ixoff iuclc -ixany -imaxbel
-iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke

test:

echo -e "\x30\x31\x30" > /dev/ttyO1

expected results:

000110000 000110001 000110000

actual results:

000110000 100110001 000110000

I can't seem to figure out where I'm going wrong. Like I said, the docs seem to say that it should work, and I know if I go into the kernel and hack omap-serial I can make it use mark/space parity. I don't want to maintain a hacked kernel for something so trivial though.

Any pointers would be greatly appreciated!

Never found out why the STICK parity wasn't working from userspace, so instead of mucking about with the termios hacks to try to support a 9bit UART, I simply jumped over to the PRU and everything's running smooth. Using STICK parity without issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM