[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: I need to configure serial port to send 5 bit characters


The hardware does not support 5 bit characters. This means that
it is impossible for the driver to support 5 bit characters.


-----Original Message-----
From: owner-dev-etrax@xxxxxxx.com]On">mailto:owner-dev-etrax@xxxxxxx.com]On
Behalf Of Henry Minsky
Sent: Friday, October 04, 2002 3:25 AM
To: dev-etrax
Subject: I need to configure serial port to send 5 bit characters

I need to configure the serial port to send 5 bit characters. This is to 
communicate with
a teletype (yes a real mechanical teletype).

The following code works on my PC linux,

int serial_open() {
   ttyfd = open(device_name, O_RDWR | O_NONBLOCK);
   if (ttyfd < 0) {
     printf("error could not open device %s", device_name);
     return (-1);

   /* Set 5 bit char size */
   ttyset.c_cflag &= (((ttyset.c_cflag & ~CSIZE) | CS5)| CSTOPB);
   ttyset.c_cflag &= ~(PARENB | CRTSCTS);
   ttyset.c_iflag = ttyset.c_oflag = ttyset.c_lflag = (tcflag_t) 0;

   return ttyfd;

But when I run it on the etrax devboard, the character size that gets
sent seems to still be 8 bits.

Does the serial driver not support 5 bit characters (the CS5 option to 
c_cflag) ? Is there any workaround for
this so I can generate 5 bit characters from the serial port?