Linux USB Serial sending 0x0D receiving 0x0A issue

Am using a FTDI serial to USB converter , today i encountered with a strange issue.When am sending an hexadecimal  0xD it is received as 0xA.

I tried to debug the code but was in vain,finaly i got a solution from stackoverflow the same issue was reported for a java program.

Typing these commands solved the issue

"stty -F /dev/ttyUSB0 -onclr"
"stty -F /dev/ttyUSB0 -icrnl"

icrnl – translate carriage return to newline

If you have a c program to open /dev/ttyUSB0 then add the below iflag

tty.c_iflag &= ~(INLCR | ICRNL);

Happy Hacking 🙂