imx6ull uart3 (ttymxc2) read problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx6ull uart3 (ttymxc2) read problem

Jump to solution
1,397 Views
alampret
Contributor I

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

Labels (2)
0 Kudos
1 Solution
858 Views
diegoadrian
NXP Employee
NXP Employee

Hello Alexander,

Can you please try to use the UART of the i.MX6 without the ST34.

Try connecting the Tx of the i.MX6 with his own Rx, and see if your are getting any log data.

Best Regards,

Diego.

View solution in original post

0 Kudos
2 Replies
859 Views
diegoadrian
NXP Employee
NXP Employee

Hello Alexander,

Can you please try to use the UART of the i.MX6 without the ST34.

Try connecting the Tx of the i.MX6 with his own Rx, and see if your are getting any log data.

Best Regards,

Diego.

0 Kudos
858 Views
alampret
Contributor I

Thank you for the hint.

Loopback test worked fine. It was a flashing issue of stm32.

 

Now it works well!

 

Best regards,

Alexander

0 Kudos