Hi,
we are working on serial port of am3359(/dev/ttyS4) with custom board.
Linux kernel version is 4.14.67-gd315a9bb00.
we are trying UART loopback between sitara processor(AM3359) and FPGA (Artix-7xc78200tfbg484-2).
we are sending below bytes:
byte[0] = 0x0d;
byte[1] = 0xd0;
byte[2] = 0xdd;
byte[3] = 0x5d;
byte[4] = 0xd5;
byte[5] = 0xfd;
byte[6] = 0xdf;
byte[7] = 0xed;
byte[8] = 0xde;
byte[9] = 0xed;
received bytes are
byte[0] = 0xa;
byte[1] = 0xd0;
byte[2] = 0xdd;
byte[3] = 0x5d;
byte[4] = 0xd5;
byte[5] = 0xfd;
byte[6] = 0xdf;
byte[7] = 0xed;
byte[8] = 0xde;
byte[9] = 0xed;
here, we are receiving all the bytes properly except 0x0d which is received as 0x0a;
We tried sending single byte, even then we received 0x0d as 0x0a.
Please let us know what is going wrong.
below is the UART configuration, send and receive portuion of the code
Configuaration:
cfsetspeed(&tty_0_4Mbps,baudRate);
tty_0_4Mbps.c_cflag &= ~PARENB;
tty_0_4Mbps.c_cflag &= ~CSTOPB;
tty_0_4Mbps.c_cflag &= ~CSIZE;
tty_0_4Mbps.c_cflag |= CS8;
tty_0_4Mbps.c_cflag &= ~CRTSCTS;
tty_0_4Mbps.c_cflag |= CREAD|CLOCAL;
tty_0_4Mbps.c_iflag &= ~(IXON | IXOFF | IXANY); //
tty_0_4Mbps.c_lflag = 0;
tty_0_4Mbps.c_oflag= ~ ; //
//forever wait, vmin > Vtime. any timeout : set vmin=0, Vtime is the value of timeout in deciseconds
tty_0_4Mbps.c_cc[VMIN] =0;
tty_0_4Mbps.c_cc[VTIME]=0.2; //deciseconds timeout from start of read call
tcflush(serial_port_0_4Mbps,TCIOFLUSH);
if(tcsetattr(serial_port_0_4Mbps,TCSANOW,&tty_0_4Mbps)!=0)
{
printf("Error (UART 0.4) %i from tcsetattr: %s\n",errno,strerror(errno));
return -1;
}
send call:
sendBytes=write(serial_port_0_4Mbps,&sendBuf[i],sizeof(*sendBuf));
if(sendBytes < 0)
{
printf("Error in sending data\n");
return -1;
}
Receive call:
int recvBytes= read(serial_port_0_4Mbps,readBuf,noOfBytes);
if(recvBytes<0)
{
printf("UART recv (115200): Error in receiving data\n");
return -1;
}