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
Solved! Go to Solution.
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.
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.
Thank you for the hint.
Loopback test worked fine. It was a flashing issue of stm32.
Now it works well!
Best regards,
Alexander