imx6ull uart3 (ttymxc2) read problem

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

imx6ull uart3 (ttymxc2) read problem

跳至解决方案
1,729 次查看
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

标签 (2)
标记 (3)
0 项奖励
回复
1 解答
1,190 次查看
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 项奖励
回复
2 回复数
1,191 次查看
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 项奖励
回复
1,190 次查看
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 项奖励
回复