AnsweredAssumed Answered

imx6ull uart3 (ttymxc2) read problem

Question asked by Alexander Lampret on Jun 3, 2017
Latest reply on Jun 11, 2017 by Alexander Lampret

Hello,

 

I'm facing a problem on reading on uart3 at my custom imx6ull board.

 

An stm32 is connected to uart3 (ttymxc2).

Writing and reading firmware with stm32flash -w and -r works fine. But custom program does not work.

This is the initialisation, this works fine:

fuart = open ( dev, O_RDWR | O_NOCTTY | O_NDELAY );
if ( fuart == -1 ) {
  perror ("Cannot open Uart Interface\n");
  exit ( 1 );
}
// config UART
tcgetattr   ( fuart, &ntermios );
cfmakeraw   ( &ntermios );
cfsetispeed ( &ntermios, UARTSPEED );
cfsetospeed ( &ntermios, UARTSPEED );

if ( tcsetattr ( fuart, TCSANOW, &ntermios ) < 0 ) {
  perror ( "Cannot config Uart Interface\n" );
  close ( fuart );
  exit ( 1 );
}

uartRead function:

void uartRead() {
  unsigned char    buffer [ 2 * MAXPACKETSIZE ];
  int              ret, i;
  ret = read (fuart, buffer, 2 * MAXPACKETSIZE);
  printf("Read from UART: %d, %s", ret, buffer);
  if ( ret > 0 ) {
    buffer [ ret ] = 0;
    for ( i = 0; i < ret; ++i )
      uartDecode ( buffer [ i ] );
  } else {
    printf("Error: %d,%s", errno, strerror(errno));
  }
}

uartRead always shows:

Read from UART: -1, nError: 11,Resource temporarily unavailable

uartRead is called after uartWrite and usleep(30000);

 

Exact same program works on imx6ul 14x14 evk with /dev/ttymxc1.

Device tree for uart3 on my custom board is similar to uart2 on imx6ul-14x14-evk

Have I missed anything?

 

Thx,

Alexander

Outcomes