Fix for Raspberry Pi Gateway with Adafruit RFM69HCW



  • Since it took me some time to find a solution to the problem that my Raspberry Pi Gateway couldn't connect to the Adafruit RFM69HCW module, I wanted to share my solution here with everyone to save others the loss of time.

    I followed exactly the instructions in this tutorial:
    https://www.mysensors.org/build/raspberry
    I used MySensors version 2.3.0.

    During my attempts to narrow down the error, I was able following these instructions: http://www.kittley.com/2018/04/05/blog-rfm69-pi/ to confirm that my hardware is working.

    The main difference between the two tutorials concerns the RESET pin of the Adafruit RFM69HCW module.

    The MySensor manual does not use the RESET pin. Without really understanding what I am doing, I modified the configure file via pattern recognition and created the possibility to pass the RESET pin to the program.

    For this I had to add two lines to the configure file:

    --my-rfm69-rst-pin=<PIN> Pin number to use for RFM69 Chip-Select.

    --my-rfm69-rst-pin=*)
    CPPFLAGS="-DMY_RFM69_RST_PIN=${optarg} $CPPFLAGS"

    Simply search for my-rfm69-cs-pin and add the respective line afterwards.

    --my-rfm69-cs-pin=<PIN> Pin number to use for RFM69 Chip-Select.
    --my-rfm69-rst-pin=<PIN> Pin number to use for RFM69 Chip Select.
    
    --my-rfm69-cs-pin=*)
        CPPFLAGS="-DMY_RFM69_CS_PIN=${optarg} $CPPFLAGS""
        ;;
    --my-rfm69-rst-pin=*)
        CPPFLAGS="-DMY_RFM69_RST_PIN=${optarg} $CPPFLAGS"
        ;;
    

    I have made my pin assignment according to the instructions of Jacob Kittley (http://www.kittley.com/2018/04/05/blog-rfm69-pi/ )

    The call for configure is for an MQTT gateway:

    ./configure --my-transport=rfm69 --my-rfm69-frequency=915 --my-is-rfm69hw --my-gateway=mqtt --my-controller-ip-address=127.0.0.1 --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-mqtt-client-id=mygateway1 --my-rfm69-irq-pin=18 --my-rfm69-cs-pin=24 --my-rfm69-rst-pin=29

    It would be good to include these hints in the MySensors tutorial. But I don't know how to do that.

    Many greetings

    Karl-Heinz

    Translated with www.DeepL.com/Translator


  • Mod

    Nice work @karl-heinz-k, thanks for sharing.

    The RST pin is generally not needed. That's why it isn't included in the wiring instructions.

    Could it be that the Adafruit RFM69HCW requires RST for some reason?

    (Sidenote: It is possible to set any custom define using the instructions provided at https://www.mysensors.org/build/raspberry#advanced without having to modify the configure script)


  • Mod

    Found https://forum.mysensors.org/topic/6816/solved-yet-another-rfm69hcw-w5100-ethernet-gateway-thread/17 which says

    Explicitly resetting the radio seems to have done the trick and may be required for the Adafruit RFM69HCW breakout

    I'm not sure where to add this note to the documentation. I could add it here but that might not be the most logical place where people having the Adafruit module would look. @Karl-Heinz-K where would be a good place in your opinion?

    Other references:
    https://forum.mysensors.org/topic/5954/rfm69-not-initialising-required-reset-could-be-the-cause/5
    https://forum.mysensors.org/topic/5806/solved-adafruit-rfm69hcw-breakout-doesnt-respond/20



  • Dear Mikael,

    you are so quick. Impressive!

    When I read the tutorial I did not understand the meaning and the potential of the "Advanced" section. Now it is much clearer for me.

    I did some research myself but did not find a definite answer neither from Adafruit (documentation and forum) nor in the Hopfer datasheet of the RFM69HCW. However, I found the same hints in the forum as you did.

    This statement from Tekka "Leaving RST floating could cause a problem." makes me think that is would be a good idea to include the two lines which I suggested to the configure file in the github repository for the next release.

    In addition, at least two tutorial pages on the MySensors website should be modified:

    https://www.mysensors.org/build/raspberry
    https://www.mysensors.org/build/orange

    In the section https://www.mysensors.org/build/raspberry#wiring I would just add a line with a pin assignment for RST to this table:

    RFM69 Radio

    Raspberry RFM69 Color
    GND GND Black
    3.3V VCC Red
    24 NSS Yellow
    23 SCK Green
    19 MOSI Blue
    21 MISO Violet
    22 DI00 Gray
    29 RST
    (*) ANA Antenna

    For example "29 RST"... 29 or it could be also any other pin.

    In addition I would add just another example line for the RFM69 configuration command where the pins are explicitely assigned to this section of the tutorials:

    https://www.mysensors.org/build/raspberry#configure

    RFM69
    --my-transport=rfm69 --my-rfm69-frequency=868 --my-is-rfm69hw

    --my-transport=rfm69 --my-rfm69-frequency=868 --my-is-rfm69hw --my-rfm69-irq-pin=22 --my-rfm69-cs-pin=24 --my-rfm69-rst-pin=29

    Maybe you could add a short sentence like "It is recommended to explicitly assign the pins if you have problems communicating with the radio module".

    I think this should do it for all those who follow the tutorials.

    Sincerely

    Karl-Heinz


  • Mod

    Thanks @karl-heinz-k

    I'm a bit hesitant to add the RST pin to the "default" instructions, since the RST pin is generally not needed. We try to keep things as simple as possible and don't want to unnecessarily instruct users to add additional wires and configuration options.

    Handling "special cases" like the Adafruit module is tricky. If we add all spacial cases to the default instructions, they will become unreadable. It is already very hard to read everything (as you noticed with the "Advanced" section - the documentation can easily become overwhelming). On the other hand, we don't want people to spend lots of time troubleshooting known problems (as you had to do).

    I'll ponder this for a while. Ideas from the community on what to do is very welcome.


  • Mod

    @karl-heinz-k I discussed this with @Yveaux who suggested that the problem might be that the Adafruit module is in perpetual reset unless the Adafruit RST pin is tied to ground.

    Could you try connecting the Adafruit RST pin to GND instead of connecting it to the raspberry pi pin 29? If Yveaux's analysis is correct, that will be sufficient to make the module work.



  • Dear Mikael,
    I did not recompile the program.
    I moved the RSTpin from pin 29 to GND (pin 30) and mysgw works as you expected!
    It seems to be an alternative for Adafruit RFM69 breakout board users to recommend to tie the RST pin to ground!
    Thanks a lot for this analysis.
    Sincerely
    Karl-Heinz


  • Mod

    @karl-heinz-k thanks for confirming.
    I have updated the following pages with a small note for Adafruit modules
    https://www.mysensors.org/build/connect_radio#rfm6995-&-arduino
    https://www.mysensors.org/build/raspberry#wiring
    https://www.mysensors.org/build/orange#wiring

    Feedback is welcome.



  • Dear Mikael,
    excellent solution! Nothing to add! Perfect to the point!
    Thank you very much for your great support!
    Sincerely
    Karl-Heinz


  • Mod

    For future reference (in case someone else stumbles on this thread): It seems Adafruit made a design mistake by always pulling reset high. Also, their datasheet states

    RST - this is the Reset pin for the radio. It's pulled high by default. Pull down to ground to put it into reset

    which is clearly wrong - pulling RST to low takes the radio out of reset mode.

    Another note: The SX1231 datasheet says

    Pin 6 (Reset) should be left floating during the POR sequence.

    POR is the automatic reset that SX1231 does when powering on (Power On Reset). The level shifter on the Adafruit board will always output high or low, so with the Adafruit board it is impossible to leave RST floating. This does not seem to cause any real problems though.


Log in to reply
 

Suggested Topics

14
Online

11.4k
Users

11.1k
Topics

112.7k
Posts