Serial (UART) on 410c board

I am loading the Linaro image onto 410c board.

Application is using the <termios.h> POSIX Terminal Control Definitions method to open the Serial Port for read/write access
#define UART_0 “/dev/tty96B0” // User UART

The application is running through Shell prompt. However, it will only work with following sequence :

  1. Open Terminal
  2. Run Application (Serial communication will fail)
  3. Use Ctrl-z to exit the Application without closing Serial Port and the Terminal
  4. Run Application again, then Serial communication works OK

Anyone may have ideas ?

What’s failing exactly? port opening? write/read? How did you configure the tty flags?

It failed during read/write. Below is setup routine for baudrate=B115200

int SerialPortSetup(int port, int baudRate)
tcgetattr(SerialUart_FD[port], &SerialPortSettings); // Get the current attributes of the Serial port

/* Setting the Baud rate */
cfsetispeed(&SerialPortSettings,baudRate); 	// Set Read  Speed
cfsetospeed(&SerialPortSettings,baudRate); 	// Set Write Speed

/* 8N1 Mode */
SerialPortSettings.c_cflag &= ~PARENB;   	/* Disables the Parity Enable bit(PARENB),So No Parity   */
SerialPortSettings.c_cflag &= ~CSTOPB;   	/* CSTOPB = 2 Stop bits,here it is cleared so 1 Stop bit */
SerialPortSettings.c_cflag &= ~CSIZE;	 	/* Clears the mask for setting the data size             */
SerialPortSettings.c_cflag |=  CS8;      	/* Set the data bits = 8                                 */

SerialPortSettings.c_cflag &= ~CRTSCTS;       /* No Hardware flow Control                         */
SerialPortSettings.c_cflag |= CREAD | CLOCAL; /* Enable receiver,Ignore Modem Control lines       */

SerialPortSettings.c_iflag &= ~(IXON | IXOFF | IXANY);          /* Disable XON/XOFF flow control both i/p and o/p */
SerialPortSettings.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);  /* Non Cannonical mode                            */

/* put terminal in raw mode - see termio(7I) for modes */

/* input modes - clear indicated ones giving: no break, no CR to NL,
   no parity check, no strip char, no start/stop output (sic) control */
SerialPortSettings.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON);

/* local modes - clear giving: echoing off, canonical off (no erase with
   backspace, ^U,...),  no extended functions, no signal chars (^Z,^C) */
SerialPortSettings.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG);

SerialPortSettings.c_oflag &= ~OPOST;		/*No Output Processing*/

/* Setting Time outs */
SerialPortSettings.c_cc[VMIN]  = 0;			/* Read at least num of characters */
SerialPortSettings.c_cc[VTIME] = 1; 		/* Wait 100ms   */

/* Set the attributes to the termios structure*/
if(tcsetattr(SerialUart_FD[port], TCSANOW, &SerialPortSettings))
	return ERROR;
	return OK;


I suggest to first trying with a known working utility like picocom/mircrocom to check if problem comes from your software or is a plaform ‘bug’.

Thanks for advice. For now, I resolve the problem by opening the Serial Port, 2nd time.
Then it works but no idea why 1st time would not able to send/receive data.