Gateway on Raspberry Pi not responding properly [SOLVED]


  • Mod

    My nodes are not communicating properly with my gateway and I can't figure out where the problem lies. The hardware has been added to Domoticz and Domoticz is able to read from the Gateway:

    2015-09-12 23:22:01.124 MySensors: Using serial port: /dev/ttyUSB20
    2015-09-12 23:22:01.125 MySensors: Gateway Ready...
    

    but it doesn't find any devices.
    I have used hek's sketch for clearing the eeprom to make sure the nodes don't have any old settings stored.
    I have tried with several node sketches and I get the same result for all of them.
    The gateway says this when I run PiGatewaySerial manually (normally it runs in the background through the init script but that doesn't seem to make a difference except that I can't see what i receives):

    root@raspi2:~# /usr/local/sbin/PiGatewaySerial
    Starting PiGatewaySerial...
    Protocol version - 1.4
    Created PTY '/dev/pts/1'
    Gateway tty: /dev/ttyMySensorsGateway
    ================ SPI Configuration ================
    CSN Pin          = CE0 (PI Hardware Driven)
    CE Pin           = Custom GPIO22
    Clock Speed      = 8 Mhz
    ================ NRF Configuration ================
    STATUS           = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
    RX_ADDR_P0-1     = 0xa8a8e1fcff 0xa8a8e1fc00
    RX_ADDR_P2-5     = 0xff 0xc4 0xc5 0xc6
    TX_ADDR          = 0xa8a8e1fcff
    RX_PW_P0-6       = 0x20 0x20 0x20 0x00 0x00 0x00
    EN_AA            = 0x3b
    EN_RXADDR        = 0x06
    RF_CH            = 0x4c
    RF_SETUP         = 0x23
    CONFIG           = 0x0e
    DYNPD/FEATURE    = 0x3f 0x06
    Data Rate        = 250KBPS
    Model            = nRF24L01+
    CRC Length       = 16 bits
    PA Power         = PA_LOW
    read: 255-255-255 s=255,c=3,t=7,pt=0,l=0:
    send: 194-194-255-255 s=255,c=3,t=8,pt=1,l=1,st=fail:0
    # After this, nothing is printed, regardless of how many messages the sensor sends
    

    Serial log from the sensor (Arduino Pro Mini 3.3V)

    find parent
    send: 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
    read: 194-194-255 s=255,c=3,t=8,pt=1,l=1,sg=0:0
    parent=194, d=1
    req id
    send: 255-255-194-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=fail:
    sensor started, id=255, parent=194, distance=1
    req id
    send: 255-255-194-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=fail:
    req id
    send: 255-255-194-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=fail:
    req id
    send: 255-255-194-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=fail:
    req id
    send: 255-255-194-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=fail:
    req id
    send: 255-255-194-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=fail:
    

    My setup of the Raspberry Pi 2 gateway is documented in this post I am utest the version from Apr 26 this year (commit 9f2ba0b3)

    I have tried uploading directly from the Build pages (with codebender) on Mysensors (example: pulse_power), and using Arduino IDE 1.6.5, on Windows 7.

    All radios have 4.7uF electrolytic capacitors between the Vcc and Gnd pins on the NRF24L01+ chip, with the > side connected to ground. 3.3V power to the Arduino is through a FTDI FT232RL.

    Mysensors 1.4
    Domoticz v2.3006

    I have shut down and restarted the Raspberry Pi several times.

    If I start my Raspberry Pi 1 (which has been disconnected from power during my tests with the Raspberry Pi 2 so it won't interfere), it picks right up and sees the new devices.
    Any ideas on how to troubleshoot this?
    EDIT: One of my sketches which configured to log if gw.send doesn't return true (i.e. a hardware ack was not received) complains after every gw.send. Not sure if that means


  • Hero Member

    @mfalkvidd Given the fail messages, it looks like you have data communication issues. How are you powering the sensor & radio? Have you added a capacitor between V+ and ground on the radio? Also, any reason why you have the gateway at node id 194?

    Cheers
    Al


  • Mod

    @Sparkman as Mentioned in the post:
    radios have 4.7uF electrolytic capacitors between the Vcc and Gnd pins on the NRF24L01+ chip, with the > side connected to ground. 3.3V power to the Arduino is through a FTDI FT232RL.

    I have not selected the parent id (not that I am aware of anyway)


  • Hero Member

    @mfalkvidd Sorry, missed that part. Do you have sensor acting as a repeater somewhere with that node id? It looks like (to me anyways) that both the gateway and sensor are trying to send to node 194. Do you know what that is?

    Cheers
    Al


  • Mod

    No problem 🙂
    No, I don't know what that node is. Could it be my old Raspberry Pi 1? It used a low parent id (1 I think) though, and it is powered off now. The Raspberry Pi 2 has been rebooted after the Raspberry Pi 1 was shut down, and the Arduino has had its eeprom cleared so they shouldn't be able to remember anything (I think).
    Could be a neighbor's Gateway I guess?


  • Mod

    This is the output from the sensor after clearint the eeprom when I have no Gateway running

    find parent
    send: 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
    sensor started, id=255, parent=255, distance=255
    find parent
    send: 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
    find parent
    send: 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
    find parent
    send: 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
    find parent
    send: 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
    find parent
    send: 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
    

    since there are no replies, I don't think another Gateway is interfering.


  • Mod

    Does the serial gateway store state somewhere? I have run the gateway through strace to see which files it opens and I've browsed the source code but I am not able to find any clues.
    EDIT: Is there a way to make the Gateway be more verbose? (MyConfig.h already has #define DEBUG) with no // in front


  • Mod

    This is the output from the sensor at first start after clearing the eeprom, when my old Gateway is on:

    find parent
    send: 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
    read: 0-0-255 s=255,c=3,t=8,pt=1,l=1,sg=0:0
    parent=0, d=1
    req id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=ok:
    read: 0-0-255 s=255,c=3,t=4,pt=0,l=2,sg=0:7
    
    send: 7-7-0-0 s=255,c=0,t=17,pt=0,l=3,sg=0,st=ok:1.5
    send: 7-7-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
    id=7
    send: 7-7-0-0 s=255,c=0,t=17,pt=0,l=3,sg=0,st=ok:1.5
    send: 7-7-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
    read: 0-0-7 s=255,c=3,t=6,pt=0,l=2,sg=0:M
    
    sensor started, id=7, parent=0, distance=1
    send: 7-7-0-0 s=255,c=3,t=11,pt=0,l=12,sg=0,st=ok:Energy Meter
    send: 7-7-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.0
    send: 7-7-0-0 s=0,c=0,t=17,pt=0,l=0,sg=0,st=fail:
    send: 7-7-0-0 s=1,c=0,t=23,pt=0,l=0,sg=0,st=fail:
    send: 7-7-0-0 s=2,c=0,t=14,pt=0,l=0,sg=0,st=fail:
    send: 7-7-0-0 s=0,c=2,t=24,pt=0,l=0,sg=0,st=fail:
    

  • Hero Member

    @mfalkvidd Looks like it was working much better with the old gateway as it found the parent and a node ID got assigned. There are still some communication issues though will all of the fails at the end. If the sensor is sending a bunch of info right after each other, it may be cause by power brownouts. Try putting a small delay between each send to see if that improves it. On your Rpi2, there must be some type of communication issue between the hardware and Domoticz. I believe the gateway is completely stateless. There may not be an easy way to make the gateway more verbose. You could add some println statements in the code manually.

    Cheers
    Al


  • Mod

    I took a step back and installed Domoticz from their Raspberry Pi image (the same version I used in my rpi1, v2.2563). Installed the Gateway the same way as before. Same problem, the Gatway forwards all traffic to node 192!
    I then re-compiled the Gateway with librf24-bcm instead of tmrh20. Voilà, it works!

    I have no idea why tmrh20 tricks the Gateway into forwarding everything for node 192, but I'm happy now that the communication works again.


  • Hero Member

    @mfalkvidd Glad you got it resolved!

    Cheers
    Al


  • Mod

    Me too 😄 Thanks @Sparkman for helping out!


Log in to reply
 

Suggested Topics

18
Online

11.2k
Users

11.1k
Topics

112.5k
Posts