serial device output looks fine in gnu screen but garbled using cat

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I have a serial device (Omega RDXL4SD thermocouple reader, comms details p 22 here) connected to a USB port on my Raspberry Pi running Raspbian via an FTDI cable. It appears at /dev/ttyUSB0 and the output looks perfect if I display it by calling
pi@raspberrypi:~ $ screen /dev/ttyUSB0 9600
The output is a few numbers. Each time it spits out a line, the cursor returns to the beginning of the line and overwrites it, so that there is only ever one line of numbers on the screen at a time.
Now, I want to use cat, not screen to achieve the same effect, but when I do I get boxes with question marks in them:
pi@raspberrypi:~ $ cat /dev/ttyUSB0
4401010000
I presume this is some kind of encoding problem. Can you explain what might be different about how these characters are being interpreted in screen versus cat, or suggest other troubleshooting steps?
In case it helps:
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.9.41-v7+ #1023 SMP Tue Aug 8 16:00:15 BST 2017 armv7l
GNU/Linux
pi@raspberrypi:~ $ stty -F /dev/ttyUSB0
speed 9600 baud; line = 0;
min = 100; time = 2;
-icrnl -imaxbel
-opost -onlcr
-isig -icanon -echo
Edit: @meuh suggested adding -vet to display special characters. Now that I know about those flags, my particular problem is effectively solved! I still wouldn't mind an explanation of exactly what's going on here though.
pi@raspberrypi:~ $ cat -vet /dev/ttyUSB0
^M^B4201010000^X^X^X^X^M^B4301010000^X^X^X^X^M^B4401010000^X^X^X^X^M^B41010100000245^M^B4201010000^X^X^X^X^M^B4301010000^X^X^X^X^M^B4401010000^X^X^X^X^M^B41010100000245^M^B4201010000^X^X^X^X^M^B4301010000^X^X^X^X^M^B4401010000^X^X^X^X^M^B41010100000245^M^B4201010000
gnu-screen cat serial-port serial-console
add a comment |Â
up vote
0
down vote
favorite
I have a serial device (Omega RDXL4SD thermocouple reader, comms details p 22 here) connected to a USB port on my Raspberry Pi running Raspbian via an FTDI cable. It appears at /dev/ttyUSB0 and the output looks perfect if I display it by calling
pi@raspberrypi:~ $ screen /dev/ttyUSB0 9600
The output is a few numbers. Each time it spits out a line, the cursor returns to the beginning of the line and overwrites it, so that there is only ever one line of numbers on the screen at a time.
Now, I want to use cat, not screen to achieve the same effect, but when I do I get boxes with question marks in them:
pi@raspberrypi:~ $ cat /dev/ttyUSB0
4401010000
I presume this is some kind of encoding problem. Can you explain what might be different about how these characters are being interpreted in screen versus cat, or suggest other troubleshooting steps?
In case it helps:
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.9.41-v7+ #1023 SMP Tue Aug 8 16:00:15 BST 2017 armv7l
GNU/Linux
pi@raspberrypi:~ $ stty -F /dev/ttyUSB0
speed 9600 baud; line = 0;
min = 100; time = 2;
-icrnl -imaxbel
-opost -onlcr
-isig -icanon -echo
Edit: @meuh suggested adding -vet to display special characters. Now that I know about those flags, my particular problem is effectively solved! I still wouldn't mind an explanation of exactly what's going on here though.
pi@raspberrypi:~ $ cat -vet /dev/ttyUSB0
^M^B4201010000^X^X^X^X^M^B4301010000^X^X^X^X^M^B4401010000^X^X^X^X^M^B41010100000245^M^B4201010000^X^X^X^X^M^B4301010000^X^X^X^X^M^B4401010000^X^X^X^X^M^B41010100000245^M^B4201010000^X^X^X^X^M^B4301010000^X^X^X^X^M^B4401010000^X^X^X^X^M^B41010100000245^M^B4201010000
gnu-screen cat serial-port serial-console
1
Trycat -vet /dev/ttyUSB0to see the special characters. Add the output to your post.
â meuh
Dec 14 '17 at 20:07
Are you sure the characters aren't part of the protocol the device is using? I find it unlikely that something else is inserting them.
â Johan Myréen
Dec 15 '17 at 17:42
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a serial device (Omega RDXL4SD thermocouple reader, comms details p 22 here) connected to a USB port on my Raspberry Pi running Raspbian via an FTDI cable. It appears at /dev/ttyUSB0 and the output looks perfect if I display it by calling
pi@raspberrypi:~ $ screen /dev/ttyUSB0 9600
The output is a few numbers. Each time it spits out a line, the cursor returns to the beginning of the line and overwrites it, so that there is only ever one line of numbers on the screen at a time.
Now, I want to use cat, not screen to achieve the same effect, but when I do I get boxes with question marks in them:
pi@raspberrypi:~ $ cat /dev/ttyUSB0
4401010000
I presume this is some kind of encoding problem. Can you explain what might be different about how these characters are being interpreted in screen versus cat, or suggest other troubleshooting steps?
In case it helps:
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.9.41-v7+ #1023 SMP Tue Aug 8 16:00:15 BST 2017 armv7l
GNU/Linux
pi@raspberrypi:~ $ stty -F /dev/ttyUSB0
speed 9600 baud; line = 0;
min = 100; time = 2;
-icrnl -imaxbel
-opost -onlcr
-isig -icanon -echo
Edit: @meuh suggested adding -vet to display special characters. Now that I know about those flags, my particular problem is effectively solved! I still wouldn't mind an explanation of exactly what's going on here though.
pi@raspberrypi:~ $ cat -vet /dev/ttyUSB0
^M^B4201010000^X^X^X^X^M^B4301010000^X^X^X^X^M^B4401010000^X^X^X^X^M^B41010100000245^M^B4201010000^X^X^X^X^M^B4301010000^X^X^X^X^M^B4401010000^X^X^X^X^M^B41010100000245^M^B4201010000^X^X^X^X^M^B4301010000^X^X^X^X^M^B4401010000^X^X^X^X^M^B41010100000245^M^B4201010000
gnu-screen cat serial-port serial-console
I have a serial device (Omega RDXL4SD thermocouple reader, comms details p 22 here) connected to a USB port on my Raspberry Pi running Raspbian via an FTDI cable. It appears at /dev/ttyUSB0 and the output looks perfect if I display it by calling
pi@raspberrypi:~ $ screen /dev/ttyUSB0 9600
The output is a few numbers. Each time it spits out a line, the cursor returns to the beginning of the line and overwrites it, so that there is only ever one line of numbers on the screen at a time.
Now, I want to use cat, not screen to achieve the same effect, but when I do I get boxes with question marks in them:
pi@raspberrypi:~ $ cat /dev/ttyUSB0
4401010000
I presume this is some kind of encoding problem. Can you explain what might be different about how these characters are being interpreted in screen versus cat, or suggest other troubleshooting steps?
In case it helps:
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.9.41-v7+ #1023 SMP Tue Aug 8 16:00:15 BST 2017 armv7l
GNU/Linux
pi@raspberrypi:~ $ stty -F /dev/ttyUSB0
speed 9600 baud; line = 0;
min = 100; time = 2;
-icrnl -imaxbel
-opost -onlcr
-isig -icanon -echo
Edit: @meuh suggested adding -vet to display special characters. Now that I know about those flags, my particular problem is effectively solved! I still wouldn't mind an explanation of exactly what's going on here though.
pi@raspberrypi:~ $ cat -vet /dev/ttyUSB0
^M^B4201010000^X^X^X^X^M^B4301010000^X^X^X^X^M^B4401010000^X^X^X^X^M^B41010100000245^M^B4201010000^X^X^X^X^M^B4301010000^X^X^X^X^M^B4401010000^X^X^X^X^M^B41010100000245^M^B4201010000^X^X^X^X^M^B4301010000^X^X^X^X^M^B4401010000^X^X^X^X^M^B41010100000245^M^B4201010000
gnu-screen cat serial-port serial-console
edited Dec 14 '17 at 21:19
asked Dec 14 '17 at 19:18
foobarbecue
1416
1416
1
Trycat -vet /dev/ttyUSB0to see the special characters. Add the output to your post.
â meuh
Dec 14 '17 at 20:07
Are you sure the characters aren't part of the protocol the device is using? I find it unlikely that something else is inserting them.
â Johan Myréen
Dec 15 '17 at 17:42
add a comment |Â
1
Trycat -vet /dev/ttyUSB0to see the special characters. Add the output to your post.
â meuh
Dec 14 '17 at 20:07
Are you sure the characters aren't part of the protocol the device is using? I find it unlikely that something else is inserting them.
â Johan Myréen
Dec 15 '17 at 17:42
1
1
Try
cat -vet /dev/ttyUSB0 to see the special characters. Add the output to your post.â meuh
Dec 14 '17 at 20:07
Try
cat -vet /dev/ttyUSB0 to see the special characters. Add the output to your post.â meuh
Dec 14 '17 at 20:07
Are you sure the characters aren't part of the protocol the device is using? I find it unlikely that something else is inserting them.
â Johan Myréen
Dec 15 '17 at 17:42
Are you sure the characters aren't part of the protocol the device is using? I find it unlikely that something else is inserting them.
â Johan Myréen
Dec 15 '17 at 17:42
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
Turns out the ^X characters, which are bytes of 0x18, are a sort of undocumented NaN in this protocol. There are multiple thermocouple ports, and if you only plug in one thermocouple you get one line with a temperature value and then a bunch of lines ending with ^X.
For some reason, cat in my terminal displays these characters as boxes but screen doesn't display them at all.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Turns out the ^X characters, which are bytes of 0x18, are a sort of undocumented NaN in this protocol. There are multiple thermocouple ports, and if you only plug in one thermocouple you get one line with a temperature value and then a bunch of lines ending with ^X.
For some reason, cat in my terminal displays these characters as boxes but screen doesn't display them at all.
add a comment |Â
up vote
1
down vote
accepted
Turns out the ^X characters, which are bytes of 0x18, are a sort of undocumented NaN in this protocol. There are multiple thermocouple ports, and if you only plug in one thermocouple you get one line with a temperature value and then a bunch of lines ending with ^X.
For some reason, cat in my terminal displays these characters as boxes but screen doesn't display them at all.
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Turns out the ^X characters, which are bytes of 0x18, are a sort of undocumented NaN in this protocol. There are multiple thermocouple ports, and if you only plug in one thermocouple you get one line with a temperature value and then a bunch of lines ending with ^X.
For some reason, cat in my terminal displays these characters as boxes but screen doesn't display them at all.
Turns out the ^X characters, which are bytes of 0x18, are a sort of undocumented NaN in this protocol. There are multiple thermocouple ports, and if you only plug in one thermocouple you get one line with a temperature value and then a bunch of lines ending with ^X.
For some reason, cat in my terminal displays these characters as boxes but screen doesn't display them at all.
answered Dec 16 '17 at 21:19
foobarbecue
1416
1416
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f410932%2fserial-device-output-looks-fine-in-gnu-screen-but-garbled-using-cat%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
Try
cat -vet /dev/ttyUSB0to see the special characters. Add the output to your post.â meuh
Dec 14 '17 at 20:07
Are you sure the characters aren't part of the protocol the device is using? I find it unlikely that something else is inserting them.
â Johan Myréen
Dec 15 '17 at 17:42