Serial1 interface Arduino Yun -- Issue with CR and NL characters

Hi,

I am trying to send some raw data over Serial1 interface to the linono side from arduino. I found strange issue where if my single byte raw data value is 0xd, linono side receives as a 0xa. I have configured linono side serial port in a RAW mode so it should not replace and interpret on that value 0xd. So I am doubting that arduino side is doing something on that before sending it over. Can anyone please help?

Best Regards,
DP

pateldipen1984:
Hi,

I am trying to send some raw data over Serial1 interface to the linono side from arduino. I found strange issue where if my single byte raw data value is 0xd, linono side receives as a 0xa. I have configured linono side serial port in a RAW mode so it should not replace and interpret on that value 0xd. So I am doubting that arduino side is doing something on that before sending it over. Can anyone please help?

Best Regards,
DP

@pateldipen1984,
yes, if your intent is to send raw data through the serial port, then you want to set port to RAW. The port was configured as a Console port, NOT a data port. So the translation of 0xd to 0xa is normal.

Famously, for over 20 years we had this fight.

Unix/Linux uses 0x0a (linefeed)
Apple uses 0x0d (carriage return)
Microsoft uses both

Google: cr vs lf vs crlf

The Carriage Return and Line Feed Characters

Why is the line terminator CR+LF?

Jesse

Thanks for the reply Jesse. Can you please point me to a place where I can find a way to configure SERIAL1 port as a RAW mode? Thanks again!

Best Regards,
DP

Got it, linono side serial port should be configured with ICRNL flag.

pateldipen1984:
Thanks for the reply Jesse. Can you please point me to a place where I can find a way to configure SERIAL1 port as a RAW mode? Thanks again!

Best Regards,
DP

@pateldipen1984,

I thought you had set it to RAW mode?!? Okay, I see someone posted a suggestion. You might wan to try that.

Otherwise, you want to Google: openwrt serial port configure

YunOS is based on OpenWrt.

You can also check the webconsole to see if there is way in there. And you can add additional software, as OpenWrt suggests here.

You may need this also. Google: man page stty.

Jesse