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

The name of the pictureThe name of the pictureThe name of the pictureClash 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






share|improve this question


















  • 1




    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














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






share|improve this question


















  • 1




    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












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






share|improve this question














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








share|improve this question













share|improve this question




share|improve this question








edited Dec 14 '17 at 21:19

























asked Dec 14 '17 at 19:18









foobarbecue

1416




1416







  • 1




    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












  • 1




    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







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










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.






share|improve this answer




















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );








     

    draft saved


    draft discarded


















    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






























    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.






    share|improve this answer
























      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.






      share|improve this answer






















        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.






        share|improve this answer












        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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 16 '17 at 21:19









        foobarbecue

        1416




        1416






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            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













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay