Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. PiGatewaySerial is stopped responding during catching new sensors

PiGatewaySerial is stopped responding during catching new sensors

Scheduled Pinned Locked Moved Troubleshooting
pigatewayserial
8 Posts 3 Posters 3.7k Views 1 Watching
  • 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.
  • A Offline
    A Offline
    Andreas Maurer
    wrote on last edited by
    #1

    Hi all,

    I try to use the PiGatewaySerial on a new raspberyy pi 2. After some modifiactions on the code concering the differnet addressing and gpio Pins it starts up and logs incoming datagrams on the console.
    That works fine until a Client was switched on and sends his capabilities.

    here ist the Output before the PiGatewaySerial stoppes responding:

    0;0;3;0;9;read: 10-10-0 s=255,c=0,t=17,pt=0,l=5:1.4.1
    0;0;3;0;9;read: 10-10-0 s=255,c=3,t=6,pt=1,l=1:0
    0;0;3;0;9;send: 0-0-10-10 s=255,c=3,t=6,pt=0,l=2,st=ok:M

    0;0;3;0;9;read: 10-10-0 s=255,c=3,t=11,pt=0,l=15:Pressure Sensor
    0;0;3;0;9;read: 10-10-0 s=255,c=3,t=12,pt=0,l=3:1.0

    The control I would like to is fhem on the same PI connecting over the pseudo Serial port.

    Any idea what happens and how to fix?

    Andreas

    1 Reply Last reply
    0
    • M Offline
      M Offline
      marceloaqno
      Code Contributor
      wrote on last edited by
      #2

      I will test in raspberry pi 1 I have here and try to figure out what's going on.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Andreas Maurer
        wrote on last edited by
        #3

        The cause for the stop is the lenght of the sketchname "Pressure Sensor". It is stored in the same memory area where the childNodeTable holds its data, So the
        "if (childNodeTable[childId] != route) {" in MySensor::addChildRoute brings up an Segmentation fault.

        For my point of view the following is wrong in MySensor,h:

        287 #ifdef DEBUG
        288 char convBuf[MAX_PAYLOAD];
        289 #endif

        it should be
        287 #ifdef DEBUG
        288 char convBuf[MAX_PAYLOAD*2+1];
        289 #endif

        because in MyGateway.h it is defined the same
        Line 58: char convBuf[MAX_PAYLOAD*2+1];

        if you look in the Arduino MySensor,.h ist is defined the same as in MyGateway,h

        That would explain the memory overrun and that it work for some people because the dont define debug!

        I have changed this lines and it became much more stable. But after only one day of testing I would not leave the Patient out off Hospital.

        Just my two cent with very limited cpp knowledge.

        Andreas

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Andreas Maurer
          wrote on last edited by
          #4

          Just on more comment on your code.

          The pseudo TTY Port you create in PiGatewaySerial with openpty creates and port with the Default rights RWX for the User and W for the tty group.
          That leaves it unusable for other users than root. Even members of the tty Group are limited to write. Very usefull for this Point of usecase :)

          I have added a "chmod(ttyname(pty_slave), S_IRWXU | S_IRWXG | S_IRWXO);"

          That gives the rest of the world "enough" rights to work with the pseudo tty port.

          So my Installation with PiGatewaySerial and fhem connected over the tty port ist running fine for the last day with the above modification.

          Andreas

          M 1 Reply Last reply
          0
          • A Andreas Maurer

            Just on more comment on your code.

            The pseudo TTY Port you create in PiGatewaySerial with openpty creates and port with the Default rights RWX for the User and W for the tty group.
            That leaves it unusable for other users than root. Even members of the tty Group are limited to write. Very usefull for this Point of usecase :)

            I have added a "chmod(ttyname(pty_slave), S_IRWXU | S_IRWXG | S_IRWXO);"

            That gives the rest of the world "enough" rights to work with the pseudo tty port.

            So my Installation with PiGatewaySerial and fhem connected over the tty port ist running fine for the last day with the above modification.

            Andreas

            M Offline
            M Offline
            marceloaqno
            Code Contributor
            wrote on last edited by
            #5

            @Andreas-Maurer It's not my code, I have a raspberry pi laying around here, so I thought giving it a try. Glad to hear that you found the solution to those problems.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              sharath krishna
              wrote on last edited by
              #6

              @Andreas-Maurer andreas could u share what akk shd be changed for the rasp pi 2 ?

              1 Reply Last reply
              0
              • A Offline
                A Offline
                Andreas Maurer
                wrote on last edited by
                #7

                Out of my mind:

                Change in bcm2835.h from

                define BCM2835_PERI_BASE               0x20000000
                

                to

                define BCM2835_PERI_BASE               0x3F000000
                

                and

                sudo make clean all install
                

                Change in PiGatewaySerial.cpp from

                gw = new MyGateway(RPI_V2_GPIO_P1_22, BCM2835_SPI_CS0, BCM2835_SPI_SPEED_8MHZ, 60);
                

                to

                gw = new MyGateway(RPI_BPLUS_GPIO_J8_15, RPI_BPLUS_GPIO_J8_24, BCM2835_SPI_SPEED_8MHZ, 60);
                

                thats depends on the GPIO Pins you use. These are from the sample.

                hope that was all. Please come back if it doesnt work.

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  Andreas Maurer
                  wrote on last edited by
                  #8

                  And dont forget to enable SPI in the PI config tool.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  15

                  Online

                  11.7k

                  Users

                  11.2k

                  Topics

                  113.1k

                  Posts


                  Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • MySensors
                  • OpenHardware.io
                  • Categories
                  • Recent
                  • Tags
                  • Popular