Community Forum
    • Blog
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    reading garbage from serial port PiTInfo

    Scheduled Pinned Locked Moved PiTInfo
    10 Posts 2 Posters 7.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J Offline
      JohnDoe
      last edited by

      I'm trying to get a PiTInfo v1.0 to work on a freshly installed Jessie on my Raspberry PI, but for reasons that escape me, I can only read garbage.

      As far as I can tell, the console on serial port is disabled:

      cat /boot/cmdline.txt 
      dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
      

      I've got a link to ttyS0

      sudo ln -s /dev/ttyAMA0 /dev/ttyS0
      

      I've set the serial port:

      stty 1200 cs7 evenp cstopb -igncr -inlcr -brkint -icrnl -opost -isig -icanon -iexten -F /dev/ttyAMA0
      

      and yet what I read is not what I'm expecting:

      cat /dev/ttyAMA0
      BPT@3L623@1|
      G]JF8Ic 
      @*.5 |
      8j@6M&S
      8
      0LS c
      .@*|
      @rjE@1Va
      @` @c
      @0Ka
      ^C
      

      Any pointers or help would be greatly appreciated.

      1 Reply Last reply Reply Quote
      • CharlesC Offline
        Charles
        last edited by Charles

        @JohnDoe
        Thing to check in order are :

        • cable wiring and lenght
        • remove any other devices already connected on téléinfo terminal block of ErdF counter
        • did you solder the GPIO connector on the PITinfo board ?

        then if it still doesn't work

        • Change the 3.3K R1 resistor by a 1.2K
          0_1448036267638_upload-55dfef86-3945-426f-b552-fd206a31ce7a

        then if it still doesn't work

        • remove the 1.2K and do a shunt.

        Let me know these results, the last one should always works 😉

        1 Reply Last reply Reply Quote
        • J Offline
          JohnDoe
          last edited by

          Wonderful. I really am impressed with how much effort you help people trying to follow your foot steps.

          Some answers:

          • I'll check the cable length; I don't like the cable I'm using now or how much slack there is; but I didn't think this might be an issue;
          • there are no other devices - the PiTInfo connected is the only thing on the GPIO, and is directly connected to the EDF meter. There is nothing else;
          • I bought the PiTInfo fully assembled;

          Note that to check I just ordered a fully assembled PiTInfo v1.2 via Tindie from you - so we will see if this is a cable issue, a PiTInfo/hardware issue, or something else.

          Updates to follow.

          1 Reply Last reply Reply Quote
          • CharlesC Offline
            Charles
            last edited by Charles

            @JohnDoe
            Excellent, we'll know if the changes made on 1.2 version solve your problem if it's coming from the output of your device (it should),

            Just let us know, because I don't have a such device, everything always worked first time on my both counters here.

            J 1 Reply Last reply Reply Quote
            • J Offline
              JohnDoe @Charles
              last edited by

              @Charles New PiTInfo arrived, thanks! Installed and still the same thing happening. I also changed the cable from the PiTInfo to the meter. Output is still:

              pi@raspberry ~ $ cat /dev/ttyAMA0 
              
              GT` @ cPT@3Yn623@1|
              gP0FP8Ic 
              @*.5 L |
              $8j@6N
              $8
              0H[	
                      1F
              `08
              er 
              `rjE@1PVa
              @` ec
              D0Ba
              $@ 
              

              Next things to try: a different Raspberry, perhaps an A or B+ (I've been using a Raspberry Pi 1 Model A+) then also revert back to Wheezy OS.

              1 Reply Last reply Reply Quote
              • CharlesC Offline
                Charles
                last edited by

                @JohnDoe
                I don't rely too much on cat command
                would you mind try a picocom -b 1200 -d 7 -p e -f n /dev/ttyAMA0 instead ?

                J 2 Replies Last reply Reply Quote
                • J Offline
                  JohnDoe @Charles
                  last edited by

                  @Charles Sorry for the delay. I had a faulty SD card and couldn't figure out why making my bootable Wheezy SD card kept failing. Booted to Wheezy, adjusted the /boot/cmdline.txt file, /etc/inittab, and rebooted, but the cat command still yields the same results.

                  Here's the output of picocom:

                  picocom -b 1200 -d 7 -p e -f n /dev/ttyAMA0
                  
                   $8
                   c 0[
                   `08
                      er 
                         `rjE@8@a
                                 @S@ @c
                  "       @0|          P*
                             $Rj
                                ,
                                 &GT u @ cPT@3L623@1|
                                                     gP0FPP8Ic 
                                                               d*.5 H |
                  j                                                    $8j@6n$
                    8
                  1F 0[
                    (p08
                        er 
                           drjE@8@a
                                   @S@ @c
                  "       @0jq           P*
                  
                   c!
                     &GT q @ cPT@3L623@1|
                                         G]JF8Ic!
                                                 d*.5 H |
                  j                                      $8j@6L$'
                   $8
                     0[   @ c
                             (t08
                                 er 
                                    @rjE@8P@a
                                             @` ec
                  "       @0ja                     P*
                  

                  Now I'm testing if it's a locale/codepage issue. What local are you using in your configurations?

                  J 1 Reply Last reply Reply Quote
                  • J Offline
                    JohnDoe @JohnDoe
                    last edited by

                    playing with code pages yields nothing - still only garbage - don't know where to look anymore

                    1 Reply Last reply Reply Quote
                    • J Offline
                      JohnDoe @Charles
                      last edited by

                      @Charles It works! Why, I don't know. stty wants odd parity, picocom no parity. This is beyond me for now.

                      pi@raspberrypi ~ $ stty --file /dev/ttyAMA0 1200 cs7 ixon -parenb
                      pi@raspberrypi ~ $ cat /dev/ttyAMA0 
                      5
                      ADCO 012345678901 L
                      OPTARIF HC.. <
                      ISOUSC 30 9
                      HCHC 002698197 0
                      HCHP 010687090 2
                      PTEC HP..  
                      IINST 003 Z
                      IMAX 038 J
                      PAPP 00680 /
                      HHPHC A ,
                      MOTDETAT 000000 B
                      

                      or with picocom:

                      pi@raspberrypi ~ $ picocom --baud 1200 --flow x --parity n --databits 7 /dev/ttyAMA0
                      picocom v1.7
                      
                      port is        : /dev/ttyAMA0
                      flowcontrol    : xon/xoff
                      baudrate is    : 1200
                      parity is      : none
                      databits are   : 7
                      escape is      : C-a
                      local echo is  : no
                      noinit is      : no
                      noreset is     : no
                      nolock is      : no
                      send_cmd is    : sz -vv
                      receive_cmd is : rz -vv
                      imap is        : 
                      omap is        : 
                      emap is        : crcrlf,delbs,
                      
                      Terminal ready
                      &4Nc
                          HCHC 002698197 0
                      HCHP 010687195 8
                      PTEC HP..  
                      IINST 012 Z
                      IMAX 038 J
                      PAPP 02840 /
                      HHPHC A ,
                      MOTDETAT 000000 
                      Thanks for using picocom
                      
                      1 Reply Last reply Reply Quote
                      • CharlesC Offline
                        Charles
                        last edited by

                        Good it works, but the 1st time I see two linux programs that need different config to work on the same serial port !!!
                        would be interesting to know what node red want 😉

                        1 Reply Last reply Reply Quote
                        • First post
                          Last post

                        3

                        Online

                        5.7k

                        Users

                        534

                        Topics

                        5.0k

                        Posts

                        Top Topics

                        • Bonjour Nicolas
                          Nicolas BernaertsN
                          Nicolas Bernaerts
                          0
                          19
                          312

                        • Denky 4 - Domoticz - Triphasé -
                          Nicolas BernaertsN
                          Nicolas Bernaerts
                          0
                          7
                          65

                        • Denky D4 et Linky Standard TInfo Rx Non Configuré
                          CharlesC
                          Charles
                          0
                          5
                          136

                        • CC1101 mini shield pour raspberry
                          CharlesC
                          Charles
                          0
                          5
                          151

                        • CC1101
                          CharlesC
                          Charles
                          0
                          2
                          66

                        Popular Tags

                        teleinfo
                        24 topics
                        arduino
                        19 topics
                        remora
                        16 topics
                        esp8266
                        10 topics
                        arduipi
                        10 topics
                        wifinfo
                        7 topics
                        raspberry
                        7 topics
                        broadcast
                        7 topics
                        Copyright © 2022 Charles-Henri Hallard | Return to blog page | Powered by NodeBB