Bug with MPC55XX eSCI serial port byte size and parity?

Peter Dufault dufault at hda.com
Sat Aug 23 13:19:59 UTC 2014


I think the behavior of the esci.c serial port driver in libcpu/powerpc/mpc55xx/esci/esci.c is incorrect.  I'm basing this partly on this page:

https://www.cmrr.umn.edu/~strupp/serial.html

The eSCI itself supports 8 and 9 bits of data with and without parity.

I think TERMIOS CS7 and CS8 selects the number of data bits, and when parity is enabled you get an additional parity bit.  So CS7 with parity sends 8 bits, and CS8 with parity sends 9 bits.

The existing driver rejects all character sizes except CS8 and allows enabling parity, but when you enable parity it sends 7 data bits and 1 parity bit, which I think is incorrect behavior.

The following settings can be supported using the 8 bit data setting on the eSCI (leaving the "M" bit in the device control register clear), essentially what the driver is doing now except it is always forcing you to specify "CS8":

8 bits, no parity, 1 stop bit (8N1):
options.c_cflag &= ~(PARENB|CSTOPB|CSIZE);
options.c_cflag |= CS8;

7 bits, even parity, 1 stop bit (7E1):
options.c_cflag &= ~(PARODD|CSTOPB|CSIZE);
options.c_cflag |= CS7|PARENB;

7 bits, odd parity, 1 stop bit (7O1):
options.c_cflag &= ~(CSTOPB|CSIZE);
options.c_cflag |= CS7|PARENB|PARODD;

The following settings can't currently be set, but can be supported by using the 9 bit data setting on the eSCI (setting the "M" bit in the control register):

8 bits, even parity, 1 stop bit (8E1):
options.c_cflag &= ~(PARODD|CSTOPB|CSIZE);
options.c_cflag |= CS8|PARENB;

8 bits, odd parity, 1 stop bit (8O1):
options.c_cflag &= ~(CSTOPB|CSIZE);
options.c_cflag |= CS8|PARENB|PARODD;

All other settings would be illegal, since the eSCI supports no other sizes and only supports a single stop bit.

Does this sound correct?  I'll prepare a patch.

I verified that by setting the M bit you get 8 data bits plus 1 parity bit.  A client of mine bumped into this problem trying to send data to a device that required 8 data bits plus parity, and it couldn't be done with the existing interface.

Peter
-----------------
Peter Dufault
HD Associates, Inc.      Software and System Engineering



More information about the users mailing list