我有一个应用程序使用 eUSCI_A0、其工作原理是115200 BD、8个数据位、1个停止位和奇校验。 某些字符在任何一个方向上都不能通过、这似乎是由于内置 USB 串行转换器对奇偶校验位的错误处理造成的。 使用另一个 USB 串行转换器(基于 CP2102)时、一切都能按预期工作。
程序会在启动时发送字符串"Initialization Done"。 在我的 Linux PC 上使用 picocom、我收到的此值为"itilitiooe"。 进一步调查我发现字符串"0123456789abcdefghijklmkopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"被接收为"03569cefijloqrtwxABDGHKMNPSUVYZ"。 巧合的是、在奇偶校验位为'0'的情况下、所有字符都缺失、我认为这是一个无效的停止位。 picocom 输出和示波器跟踪(在板上标记为"TXD>>"的跳线处)如下:
picocom v3.1 port is : /dev/ttyACM1 flowcontrol : none baudrate is : 115200 parity is : odd databits are : 8 stopbits are : 1 escape is : C-a local echo is : no noinit is : no noreset is : no hangup is : no nolock is : no send_cmd is : sz -vv receive_cmd is : rz -vv -E imap is : omap is : crlf, emap is : crcrlf,delbs, logfile is : none initstring : none exit_after is : not set exit is : no Type [C-a] [C-h] to see available commands Terminal ready itilitiooe 03569cefijloqrtwxABDGHKMNPSUVYZ
将示波器的串行解码器设置为奇偶校验=none 后、您可以看到未接收到的字符"i"和"n"在结尾有一个错误标记。
电路板也不会在 RX 方向生成奇偶校验位:发送"i"和 picocom (奇偶校验位设置为"奇数")会产生以下范围跟踪(这次板上的"RXD<";串行解码器设置为奇偶校验=奇偶校验!):
如您所见、没有生成奇偶校验位。 MSP430程序不接收字符(它应该在奇偶校验位错误时接收)。
当我不启用 MSP430侧的奇偶校验位(不会设置/清除 UCA0CTLW0的 UCPEN)时、微控制器和 picocom 之间的通信正常工作。
这看起来像是 eZ-FET 固件的错误。 picocom 将引导驱动程序启用奇偶校验位、这可以通过以下事实来证明:它适用于基于 CP2102的板以及'TTY -F /dev/ttyACM1 -A'的输出(请注意"aroke parodd"):
speed 115200 baud; rows 0; columns 0; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0; 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 -flusho -extproc
是否有新的固件版本? 如果有的话、我该如何闪烁它?