ESP8266 and RFM69 send issue


  • Contest Winner

    Hi, it could be a newbie question but I couldn't find something similar in the old messages here in the forum.
    I have on one side an ESP8266 + RFM69 connected according to https://www.mysensors.org/build/connect_radio, running the gateway sketch. On the other side I have a pro mini + RFM69 with the MockMySensors sketch. On the pro mini I have the following logs so it looks like the radio is working but couldn't get an answer from the gw:

    16 TSF:WUR:MS=0
    34 TSM:INIT:TSP OK
    55 TSM:INIT:STATID=254
    79 TSF:SID:OK,ID=254
    100 TSM:FPAR
    3241 TSF:MSG:SEND,254-254-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    5318 !TSM:FPAR:NO REPLY
    5343 TSM:FPAR
    8484 TSF:MSG:SEND,254-254-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    10561 !TSM:FPAR:NO REPLY
    10586 TSM:FPAR
    11732 TSF:MSG:SEND,254-254-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    13811 !TSM:FPAR:NO REPLY
    13836 TSM:FPAR
    14981 TSF:MSG:SEND,254-254-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    17059 !TSM:FPAR:FAIL
    17080 TSM:FAIL:CNT=1
    17102 TSM:FAIL:PDT
    

    On the gateway I have the following so looks like radio is working, it is able to receive the request message, but no able to send the response back:

    0;255;3;0;9;TSF:MSG:READ,254-254-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSF:MSG:BC
    0;255;3;0;9;TSF:MSG:FPAR REQ,ID=254
    0;255;3;0;9;TSF:PNG:SEND,TO=0
    0;255;3;0;9;TSF:CKU:OK
    0;255;3;0;9;TSF:MSG:GWL OK
    0;255;3;0;9;!TSF:MSG:SEND,0-0-254-254,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
    0;255;3;0;9;TSF:MSG:READ,254-254-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSF:MSG:BC
    0;255;3;0;9;TSF:MSG:FPAR REQ,ID=254
    0;255;3;0;9;TSF:CKU:OK,FCTRL
    0;255;3;0;9;TSF:MSG:GWL OK
    0;255;3;0;9;!TSF:MSG:SEND,0-0-254-254,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
    0;255;3;0;9;TSF:MSG:READ,254-254-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSF:MSG:BC
    0;255;3;0;9;TSF:MSG:FPAR REQ,ID=254
    0;255;3;0;9;TSF:CKU:OK,FCTRL
    0;255;3;0;9;TSF:MSG:GWL OK
    0;255;3;0;9;!TSF:MSG:SEND,0-0-254-254,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
    0;255;3;0;9;TSF:MSG:READ,254-254-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSF:MSG:BC
    0;255;3;0;9;TSF:MSG:FPAR REQ,ID=254
    0;255;3;0;9;TSF:CKU:OK,FCTRL
    0;255;3;0;9;TSF:MSG:GWL OK
    

    I've tried the usual things (moving the radio at a certain distance, adding capacitors, etc) as well as the excellent document at https://forum.mysensors.org/topic/666/debug-faq-and-how-ask-for-help but without much luck.

    I've also tried replacing the radio with another. Btw both of them are HW so I have the define MY_IS_RFM69HW in both my sketches.
    What am I missing?

    Thanks


  • Mod

    @user2684
    Did you try the radios with a demo sketch just to play safe? According to log the gateway log it is replying to the node but getting a NACK


  • Contest Winner

    Thanks, I'll give it a try with a simpler sketch and report back. Good point, I've always thought the NACK was coming from the local radio unable to send, not from the remote one, very good to know!


  • Mod

    NACK actually is when you send something but you don't get an ACK back from receiver (could be for many reasons: low signal, bad reception, interference, receiver dead, etc )


  • Contest Winner

    Ok the problem is definitely related to the ESP8266 gateway. I re-wired the same radio to a serial gateway and everything is working fine. Back to the ESP8266, same problem as before. On the serial I'm using:

    #define MY_RADIO_RFM69
    #define MY_RFM69_FREQUENCY RF69_868MHZ
    #define MY_IS_RFM69HW
    

    On the esp8266:

    #define MY_RADIO_RFM69
    #define MY_RFM69_FREQUENCY RF69_868MHZ
    #define MY_IS_RFM69HW
    #define MY_RF69_IRQ_NUM D1
    #define MY_RF69_SPI_CS D2 
    

    Everything wired as the instructions from https://www.mysensors.org/build/connect_radio, I've double checked a few times already.
    I have now a workaround so I should be fine but I'd be really curious to understand what was wrong in the esp8266 setup causing that issue...

    Thanks


  • Mod

    @user2684 this seems to be missing:

    #define MY_RF69_IRQ_NUM MY_RF69_IRQ_PIN
    

    I am not sure if it is needed, but it might be worth adding and see if it helps.


  • Contest Winner

    @mfalkvidd thanks for looking into it, but it should be already there, I've just consolidated the

    #define MY_RF69_IRQ_PIN D1
    #define MY_RF69_IRQ_NUM MY_RF69_IRQ_PIN
    

    into a single line:

    #define MY_RF69_IRQ_NUM D1
    

  • Contest Winner

    Quick update on this. I've also tried as the last chance to connect the radio to an external power but the result is always the same (send failure).

    Apart from that, these RFM69 are amazing (this is the first time I'm using this radio), I've tested one with the working serial gateway; first I went downstairs and it was working (where the NRF24 got lost), then I moved outside and was working, then I walked and walked probably around 70-80 meters/yards (plus a few walls), in the dark for a while and was still working (sometimes the gateway was resetting I guess because the tx power required was too high). Pretty impressive.


  • Mod

    @user2684 I don't think you can omit defining MY_RF69_IRQ_PIN


  • Contest Winner

    You are the man @mfalkvidd! I've been very superficial to face this issue for saving a single line of code 😉 I didn't notice that define is actually used in MyTransportRFM69.cpp.

    After adding it back I had to reset it a good number of times, sometimes I had a soft WTD reset just before the send, other times I had !TSF:MSG:SEND once again and then started working, looks like consistently now. I cannot explain why hasn't worked straight away after the change, it could even be some bad wiring I fixed without noticing it. Thanks for the help!


  • Hardware Contributor

    I had the same problem when I was troubleshooting RFM69 on my Wemos GW shield.

    It seems to me that

    #define MY_RF69_IRQ_NUM MY_RF69_IRQ_PIN
    

    Is supposed to be automatically set when

    #define ARDUINO_ARCH_ESP8266
    

    is defined.

    You would assume that when you define

    #define  MY_GATEWAY_ESP8266
    

    It would automatically add

    #define ARDUINO_ARCH_ESP8266
    

    For example here in MySensors.h but it is not, meaning that

    #define MY_RF69_IRQ_NUM MY_RF69_IRQ_PIN
    

    is never declared.

    So you can simply use

    #define ARDUINO_ARCH_ESP8266
    #define MY_RF69_IRQ_PIN D1
    

    or

    #define MY_RF69_IRQ_PIN D1
    #define MY_RF69_IRQ_NUM MY_RF69_IRQ_PIN
    

    in your sketch.

    I personally think it should be automatically done in MySensors.h (and would be happy to submit a ticket on github if needed) but maybe it was done on purpose.



  • How did you get it to work finally?

    I keep getting these "Soft WDT reset" crashes:

    0;255;3;0;9;MCO:BGN:INIT GW,CP=RRNGE--,VER=2.1.1
    0;255;3;0;9;TSF:LRT:OK
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSF:WUR:MS=0
    scandone
    state: 0 -> 2 (b0)
    state: 2 -> 3 (0)
    state: 3 -> 5 (10)
    add 0
    aid 3
    cnt
    0;255;3;0;9;!TSM:INIT:TSP FAIL

    connected with Airport, channel 6
    dhcp client start...
    0;255;3;0;9;TSM:FAIL:CNT=1
    0;255;3;0;9;TSM:FAIL:PDT
    ip:192.168.0.149,mask:255.255.255.0,gw:192.168.0.1
    pm open,type:2 0
    0;255;3;0;9;TSM:FAIL:RE-INIT
    0;255;3;0;9;TSM:INIT

    Soft WDT reset

    ctx: cont
    sp: 3ffef260 end: 3ffef550 offset: 01b0

    stack>>>
    3ffef410: 00000004 3ffef940 3ffef5ec 402030bd
    3ffef420: 00000027 3ffef940 3ffef5ec 40203071
    3ffef430: 3ffef604 00000001 3ffef5ec 402031b5
    3ffef440: 00000000 00000016 3ffef5ec 402033f0
    3ffef450: 0000002f 3ffef940 3ffef5ec 000000ff
    3ffef460: 00000000 00000016 3ffef5ec 402044bd
    3ffef470: 00020401 40040203 33060305 40086c07
    3ffef480: 42190009 07264025 dc291028 2d2f882e
    3ffef490: 90376330 8f3c4238 306f123d 000000ff
    3ffef4a0: 00000063 00000000 3ffefa30 40203834
    3ffef4b0: 3ffef758 00000000 00000000 0000466d
    3ffef4c0: 3ffef758 00000000 00000000 40204574
    3ffef4d0: 3ffef758 0000466d 40204290 40204599
    3ffef4e0: 00000000 00000000 00000000 40202e15
    3ffef4f0: 000007ce 00000000 00000000 40204ca9
    3ffef500: 3fffdad0 3ffef5a7 00000000 402050e7
    3ffef510: 600002ff 00020000 3ffef758 3ffee528
    3ffef520: 3fffdad0 3ffef5a7 3ffefa10 40205355
    3ffef530: feefeffe 00000000 3ffee520 402053c0
    3ffef540: feefeffe feefeffe 3ffee530 40100114
    <<<stack<<<


  • Contest Winner

    @mpp it just started working at a certain point so I assumed my issue was just due to bad wiring. But I must say I stopped testing this configuration after a few days so there could be something else that I missed


Log in to reply
 

Suggested Topics

  • 3
  • 5
  • 6
  • 8
  • 1
  • 2

18
Online

11.4k
Users

11.1k
Topics

112.7k
Posts