RFM95 + Sensebender Gateway



  • Hello!

    I just got the Sensebender gateway and tried plugging in a SX1278 equipped LoRa module using the 2x4 input "reserved" for a nrf24 module. The pinout is the same for the two modules but I suspect that the mysensors HAL is looking at other pins when using RFM95.

    So my question is.. Is anybody here up and running with Sensebender Gateway + SX1278 module connected to the 2x4 pin connection?



  • Well... At last I got some time to dig in to the problem and it turns out it was a quick 10-minute fix. The fix is quick and dirty and if someone have an idea of how to make it prettier that would be nice.

    Anyways.. I really like the RA-01 and RA-02 from AI-thinker and I have been using them for many types of projects so when I saw that the pinout was the same on my module and the nrf24 I was quite happy. Upon plugging the module in and activating MY_DEBUG_VERBOSE_RFM95 option it prints the following:

    RFM95:INIT:PIN,CS=24,IQP=32,IQN=32,RST=43
    !RFM95:INIT:SANCHK FAIL
    

    Checking the documentation I see that the rfm24 uses different pins on the SAMD compared to the rfm69hw.

    I then went in to the variant.h file of the Sensebender and from row 245 and on the definitions needs to be altered.
    #define MY_RFM95_SPI_CS (29ul) // Changed from 30
    #define MY_RFM95_IRQ_PIN (31ul) // Changed from 32
    #define MY_RFM95_IRQ_NUM (31ul) // Changed from 32

    Upon compiling and uploading i get:

    RFM95:INIT:PIN,CS=24,IQP=32,IQN=32,RST=43
    !RFM95:INIT:SANCHK FAIL
    

    So i notice the CS-pin is 24 even though i defined MY_RFM95_SPI_CS as 29.
    Searching the variant.h file for 24u I find change the following on row 156:
    #define PIN_SPI_SS (29u) // Changed from 24

    Upon compiling and uploading I see:

    0;255;3;0;9;3932 RFM95:INIT
    0;255;3;0;9;3937 RFM95:INIT:PIN,CS=29,IQP=31,IQN=31,RST=43
    0;255;3;0;9;3947 RFM95:PTX:LEVEL=13
    0;255;3;0;9;3948 TSM:INIT:TSP OK
    0;255;3;0;9;3948 TSM:INIT:GW MODE
    0;255;3;0;9;3948 TSM:READY:ID=0,PAR=0,DIS=0
    0;255;3;0;9;3948 MCO:REG:NOT NEEDED
    0;255;3;0;14;Gateway startup complete.
    0;255;0;0;18;2.3.2
    0;255;3;0;9;3949 MCO:BGN:STP
    0;255;3;0;9;3949 MCO:BGN:INIT OK,TSP=1
    0;255;3;0;9;3949 TSM:READY:NWD REQ
    0;255;3;0;9;3949 RFM95:SWR:SEND,TO=255,SEQ=0,RETRY=0
    0;255;3;0;9;4010 ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=NACK:
    0;255;3;0;9;21316 RFM95:SAC:SEND ACK,TO=3,SEQ=1636,RSSI=-60,SNR=10
    0;255;3;0;9;22566 TSF:MSG:READ,3-3-0,s=2,c=1,t=17,pt=5,l=4,sg=0:351
    

    The messages are coming in!

    I tried doing the defines in my sketch but the PIN_SPI_SS is overwritten.

    IMG_20200526_204210.jpg

    So for anyone wanting to use the RA-01 or RA-02 (SX1278) instead of the nRF24, go ahead!
    I am not really sure I understand why the HAL is using the "PIN_SPI_SS" instead of the "MY_RFM95_SPI_CS"
    Isn't CE,SS,CS all different names for the same thing?


  • Mod

    @niclas could you see if defining MY_RFM95_CS_PIN works? That’s the one to define according to the documentation I found.



  • @mfalkvidd
    Yes that did it!

    Using the following defines:
    #define MY_RFM95_CS_PIN (29u)
    #define MY_RFM95_IRQ_PIN (31u)
    #define MY_RFM95_IRQ_NUM (31u)

    I have now restored my variant.h file and all is well.

    Also tried to find information about how the RFM95 and SX127x relates to each other. Seems like they share the exact same registers but one is semtech and one the hoperf? Did Hoperf make it the same on purpose or do they license the modem from semtech?


  • Mod

    Nice work @niclas

    Good question about the differences. https://lowpowerlab.com/forum/rf-range-antennas-rfm69-library/rfm69-hoperf-are-they-semtech-clones-or-not/ has some interesting information.


Log in to reply
 

Suggested Topics

  • 87
  • 5
  • 2
  • 1
  • 6
  • 8

47
Online

11.4k
Users

11.1k
Topics

112.7k
Posts