i.MX8M mini

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

i.MX8M mini

575 Views
jander2355
Contributor I

Hello Nxp,

I am trying to use i.Mx8M Mini DDR4 evk. I have windows application over UART that I am using to talk to an App in the i.Mx8M Mini evk(readSerial) over Linux. I have code snippet of evk app below.

I am writing data from desk top app but not able to read the data in evk. I am using "/dev/ttymxc1" for UART communication

int set_interface_attribs(int fd, int speed)
{
struct termios tty;
if(tcgetattr(fd, &tty) < 0){
printf("Error from tcgetattr: %s\n",strerror(errno));
return -1;
}
cfsetospeed (&tty, speed);
cfsetispeed (&tty, speed);
tty.c_cflag &= ~PARENB;
tty.c_cflag &= ~CSTOPB;
tty.c_cflag &= ~CSIZE;
tty.c_cflag |= CS8;

tty.c_cflag &= ~CRTSCTS;
/* fetch bytes as they become available */
tty.c_cc[VMIN] = 1;
tty.c_cc[VTIME] = 5;
tty.c_cflag |= CREAD | CLOCAL;
cfmakeraw(&tty);

tcflush(fd, TCIFLUSH);
if (tcsetattr(fd, TCSANOW, &tty) != 0)
{
return -1;
}
return 0;
}


int main(int argc, char* argv[])
{
char *port1 = "/dev/ttymxc1";
int out = open("log.txt", O_RDWR | O_CREAT | O_APPEND, 0600);
signal(SIGTTOU, sig_ttou);

printf("read/write from %s\n", port1);
int fd = open(port1, O_RDWR | O_NOCTTY | O_SYNC);
if(fd < 0)
{
return -1;
}

set_interface_attribs(fd, B115200);
int rdlen;
do {
unsigned char buf[5];
rdlen = read(fd, buf, 1);
if(rdlen > 0)
{
unsigned char *p;
for(p=buf; rdlen-- > 0; p++)
{
printf("0x%x",*p);
}
}
}while(1);
}

I copy the app the rootfs

./readSerial &.

Thanks

James

Labels (1)
0 Kudos
1 Reply

512 Views
Yuri
NXP Employee
NXP Employee

jander2355@gmail.com 

Hello,

  You may try to run UART tests in /unit_tests/UART/ of the Linux demo image.

./autorun-mxc_uart.sh
./mxc_uart_stress_test.out /dev/ttymxc#
./mxc_uart_test.out /dev/ttymxc#
./mxc_uart_xmit_test.out /dev/ttymxc#

imx-test - i.MX Driver Test Application Software 

mxc_uart_test\test - imx-test - i.MX Driver Test Application Software 

Regards,

Yuri.

0 Kudos