所以我在血脑屏障上启用了UART-1。我尝试通过termios & stty设置它来使用标记/空间奇偶。根据文档,它支持这一点。
termios设置:
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;标准输出:
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测试:
echo -e "\x30\x31\x30" > /dev/ttyO1预期结果:
000110000 000110001 000110000实际结果:
000110000 100110001 000110000我似乎不知道我哪里出了问题。就像我说的,文档似乎说它应该能工作,而且我知道如果我进入内核并攻击omap-序列,我可以让它使用标记/空间奇偶校验。不过,我不想为如此琐碎的事情维护被黑客攻击的内核。
任何指点都将不胜感激!
发布于 2017-03-08 16:31:12
根本不知道为什么棍子奇偶不能从用户空间中运行,所以,我没有胡乱使用termios黑客来支持9位UART,我只是跳到PRU上,一切都很顺利。使用无问题的棍子奇偶。
https://stackoverflow.com/questions/42513037
复制相似问题