Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. Can't get past first base (Arduino Serial Gateway)

Can't get past first base (Arduino Serial Gateway)

Scheduled Pinned Locked Moved Troubleshooting
10 Posts 4 Posters 1.7k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mljbr4
    wrote on last edited by
    #1

    Hello. I cannot get even the simplest MySensors example working. I am sure I must be missing something simple but I have run out of ideas.

    THIS WORKS:
    I have two Arduino Uno, each with an NRF24L01 connected, and each Arduino is connected to (and powered by) a laptop computer via USB and running Arduino 1.8.6 software so I can use the Serial Monitor.

    Via the Sketch>>Include Library>>Manage Libraries I have added RF24 by TMRh20 version 1.3.0, and I have added MySensors by The MySensors Team version 2.1.1.

    If I use the RF24 Example Sketch “pingpair_ack” the only change I have to make is to add “#define MY_BAUD_RATE 9600”. Apart from that I can upload the sketch to each Arduino and monitor them via Serial Monitor and they work perfectly.

    I can even swap the two Arduino’s between the two laptops and they still both work.

    So I have proven that fundamentally I have two working RF / Arduino devices powered via laptop USB connections.

    THIS DOES NOT WORK:
    Same setup as above, but using MySensors Examples does not work. For example Sketch “GatewaySerial” gives me the following:

    0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.1.1
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSF:WUR:MS=0
    0;255;3;0;9;!TSM:INIT:TSP FAIL
    0;255;3;0;9;TSM:FAIL:CNT=1
    0;255;3;0;9;TSM:FAIL:PDT
    0;255;3;0;9;TSM:FAIL:RE-INIT
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;!TSM:INIT:TSP FAIL
    0;255;3;0;9;TSM:FAIL:CNT=2```
    1 Reply Last reply
    0
    • dbemowskD Offline
      dbemowskD Offline
      dbemowsk
      wrote on last edited by
      #2

      What controller are you connecting your gateway to?

      Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
      Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

      M 1 Reply Last reply
      0
      • dbemowskD dbemowsk

        What controller are you connecting your gateway to?

        M Offline
        M Offline
        mljbr4
        wrote on last edited by
        #3

        @dbemowsk No controller - I was using a RPi and MQTT but because I could not get that to work I have stripped everything back to the simplest solution I could think of. So now I just have two Arduinos, one running the Arduino Serial Gateway. I assume it just writes to the Serial port which I can monitor via the Serial Monitor?

        mfalkviddM 1 Reply Last reply
        0
        • ThetaDevT Offline
          ThetaDevT Offline
          ThetaDev
          wrote on last edited by
          #4

          I have had the same problem when first trying out MySensors.

          The MySensors gateway doesnt work without a controller. Just download MyController for testing purposes (it is small and can run on your pc) and connect the serial gateway to it.

          If you have proved everything working, you can switch to a Raspi or other controller device with a more powerful software to run 24/7

          1 Reply Last reply
          0
          • M mljbr4

            @dbemowsk No controller - I was using a RPi and MQTT but because I could not get that to work I have stripped everything back to the simplest solution I could think of. So now I just have two Arduinos, one running the Arduino Serial Gateway. I assume it just writes to the Serial port which I can monitor via the Serial Monitor?

            mfalkviddM Offline
            mfalkviddM Offline
            mfalkvidd
            Mod
            wrote on last edited by mfalkvidd
            #5

            @mljbr4 welcome to the MySensors community!

            Just to check, you are using the wiring described at https://www.mysensors.org/build/connect_radio and you have connected a capacitor close to the nrf24?

            I am not familiar with the raw tmrh20 library, but it seems it defaults to different pins for CE and CSN (compared to MySensors default).

            M 1 Reply Last reply
            0
            • mfalkviddM mfalkvidd

              @mljbr4 welcome to the MySensors community!

              Just to check, you are using the wiring described at https://www.mysensors.org/build/connect_radio and you have connected a capacitor close to the nrf24?

              I am not familiar with the raw tmrh20 library, but it seems it defaults to different pins for CE and CSN (compared to MySensors default).

              M Offline
              M Offline
              mljbr4
              wrote on last edited by
              #6

              @mfalkvidd said in Can't get past first base (Arduino Serial Gateway):

              https://www.mysensors.org/build/connect_radio

              It's a miracle. Works perfectly now! I knew it had to be something obvious but I had tried so many things I lost track. Turns out it was a simple CE / CSN Pin issue. You are right, the NRF24 library defaults to Pins 7 and 8, but MySensors defaults to 9 and 10. Thanks for your help. Hopefully now I can march on with my real solution which is a RaspberryPi Gateway and MQTT running on one RPi, and OpenHAB running on another.

              mfalkviddM 1 Reply Last reply
              1
              • M mljbr4

                @mfalkvidd said in Can't get past first base (Arduino Serial Gateway):

                https://www.mysensors.org/build/connect_radio

                It's a miracle. Works perfectly now! I knew it had to be something obvious but I had tried so many things I lost track. Turns out it was a simple CE / CSN Pin issue. You are right, the NRF24 library defaults to Pins 7 and 8, but MySensors defaults to 9 and 10. Thanks for your help. Hopefully now I can march on with my real solution which is a RaspberryPi Gateway and MQTT running on one RPi, and OpenHAB running on another.

                mfalkviddM Offline
                mfalkviddM Offline
                mfalkvidd
                Mod
                wrote on last edited by mfalkvidd
                #7

                @mljbr4 great! Thanks for reporting back.

                About the rpi gateway, there have been several reports of problems lately. We haven't found the root cause, but the development version seems to work better than the 2.1.1 release.

                M 1 Reply Last reply
                0
                • mfalkviddM mfalkvidd

                  @mljbr4 great! Thanks for reporting back.

                  About the rpi gateway, there have been several reports of problems lately. We haven't found the root cause, but the development version seems to work better than the 2.1.1 release.

                  M Offline
                  M Offline
                  mljbr4
                  wrote on last edited by
                  #8

                  @mfalkvidd Unfortunately I can't get a clean compile of the development branch at the moment. I did the following:

                  rm -R ~/MySensors
                  git clone https://github.com/mysensors/MySensors.git --branch development
                  cd MySensors
                  ./configure --my-transport=nrf24 --my-rf24-ce-pin=22 --my-rf24-cs-pin=24 --my-gateway=mqtt --my-controller-ip-address=127.0.0.1 --my-mqtt-publish-topic-prefix=home-network --my-mqtt-subscribe-topic-prefix=home-network-in --my-mqtt-client-id=home-network --my-rf24-channel=76 --DMY_RF24_DATARATE=RF24_250KBPS --my-debug=enable
                  make
                  

                  and I got the following result:

                  gcc -MT build/drivers/BCM/bcm2835.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_GATEWAY_MQTT_CLIENT -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RF24_CHANNEL=76 -DMY_MQTT_CLIENT_ID=\"home-network\" -DMY_MQTT_SUBSCRIBE_TOPIC_PREFIX=\"home-network-in\" -DMY_MQTT_PUBLISH_TOPIC_PREFIX=\"home-network\" -DMY_CONTROLLER_IP_ADDRESS=127,0,0,1 -DMY_RF24_CS_PIN=24 -DMY_RF24_CE_PIN=22  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/BCM/bcm2835.c -o build/drivers/BCM/bcm2835.o
                  drivers/BCM/bcm2835.c: In function ‘bcm2835_delayMicroseconds’:
                  drivers/BCM/bcm2835.c:441:40: error: expected ‘)’ before ‘PRIu64’
                     printf("bcm2835_delayMicroseconds %" PRIu64 "\n", micros);
                                                          ^
                  drivers/BCM/bcm2835.c:441:40: warning: spurious trailing ‘%’ in format [-Wformat=]
                  Makefile:102: recipe for target 'build/drivers/BCM/bcm2835.o' failed
                  make: *** [build/drivers/BCM/bcm2835.o] Error 1
                  

                  I might try fixing the code myself and see what happens but I'd be interested to know if this is a common problem.

                  M 1 Reply Last reply
                  0
                  • M mljbr4

                    @mfalkvidd Unfortunately I can't get a clean compile of the development branch at the moment. I did the following:

                    rm -R ~/MySensors
                    git clone https://github.com/mysensors/MySensors.git --branch development
                    cd MySensors
                    ./configure --my-transport=nrf24 --my-rf24-ce-pin=22 --my-rf24-cs-pin=24 --my-gateway=mqtt --my-controller-ip-address=127.0.0.1 --my-mqtt-publish-topic-prefix=home-network --my-mqtt-subscribe-topic-prefix=home-network-in --my-mqtt-client-id=home-network --my-rf24-channel=76 --DMY_RF24_DATARATE=RF24_250KBPS --my-debug=enable
                    make
                    

                    and I got the following result:

                    gcc -MT build/drivers/BCM/bcm2835.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_GATEWAY_MQTT_CLIENT -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RF24_CHANNEL=76 -DMY_MQTT_CLIENT_ID=\"home-network\" -DMY_MQTT_SUBSCRIBE_TOPIC_PREFIX=\"home-network-in\" -DMY_MQTT_PUBLISH_TOPIC_PREFIX=\"home-network\" -DMY_CONTROLLER_IP_ADDRESS=127,0,0,1 -DMY_RF24_CS_PIN=24 -DMY_RF24_CE_PIN=22  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/BCM/bcm2835.c -o build/drivers/BCM/bcm2835.o
                    drivers/BCM/bcm2835.c: In function ‘bcm2835_delayMicroseconds’:
                    drivers/BCM/bcm2835.c:441:40: error: expected ‘)’ before ‘PRIu64’
                       printf("bcm2835_delayMicroseconds %" PRIu64 "\n", micros);
                                                            ^
                    drivers/BCM/bcm2835.c:441:40: warning: spurious trailing ‘%’ in format [-Wformat=]
                    Makefile:102: recipe for target 'build/drivers/BCM/bcm2835.o' failed
                    make: *** [build/drivers/BCM/bcm2835.o] Error 1
                    

                    I might try fixing the code myself and see what happens but I'd be interested to know if this is a common problem.

                    M Offline
                    M Offline
                    mljbr4
                    wrote on last edited by
                    #9

                    @mljbr4 well I don't know if this is the right solution or not but to solve the PRIu64 issue I added the following lines to the top of drivers/BCM/bcm2835.c and I managed to get a clean compile and now mysgw on my RaspberrryPi is working:

                    #define __STDC_FORMAT_MACROS
                    #include <inttypes.h>
                    
                    mfalkviddM 1 Reply Last reply
                    0
                    • M mljbr4

                      @mljbr4 well I don't know if this is the right solution or not but to solve the PRIu64 issue I added the following lines to the top of drivers/BCM/bcm2835.c and I managed to get a clean compile and now mysgw on my RaspberrryPi is working:

                      #define __STDC_FORMAT_MACROS
                      #include <inttypes.h>
                      
                      mfalkviddM Offline
                      mfalkviddM Offline
                      mfalkvidd
                      Mod
                      wrote on last edited by
                      #10

                      @mljbr4 thanks for the feedback.
                      Reference to github issue: https://github.com/mysensors/MySensors/issues/980

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      31

                      Online

                      11.7k

                      Users

                      11.2k

                      Topics

                      113.1k

                      Posts


                      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • MySensors
                      • OpenHardware.io
                      • Categories
                      • Recent
                      • Tags
                      • Popular