ESP8266 and RFM69 send issue



  • 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



  • 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 )



  • 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.



  • @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
    


  • 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



  • 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.


Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.