first RFM node & Gateway !TSM:FPAR:FAIL (solved)



  • Hi all,

    as the fake NRFs are kind of annoing with ther varying ranges i decied to give the RFMs a try.
    Therefore i gut a sensberger gateway with following sketch:

    /**
     * The MySensors Arduino library handles the wireless radio link and protocol
     * between your home built sensors/actuators and HA controller of choice.
     * The sensors forms a self healing radio network with optional repeaters. Each
     * repeater and gateway builds a routing tables in EEPROM which keeps track of the
     * network topology allowing messages to be routed to nodes.
     *
     * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
     * Copyright (C) 2013-2015 Sensnology AB
     * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
     *
     * Documentation: http://www.mysensors.org
     * Support Forum: http://forum.mysensors.org
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * version 2 as published by the Free Software Foundation.
     *
     *******************************
     *
     * REVISION HISTORY
     * Version 1.0 - Henrik EKblad
     * Contribution by a-lurker and Anticimex,
     * Contribution by Norbert Truchsess <norbert.truchsess@t-online.de>
     * Contribution by Tomas Hozza <thozza@gmail.com>
     *
     *
     * DESCRIPTION
     * The EthernetGateway sends data received from sensors to the ethernet link.
     * The gateway also accepts input on ethernet interface, which is then sent out to the radio network.
     *
     * The GW code is designed for Arduino 328p / 16MHz.  ATmega168 does not have enough memory to run this program.
     *
     * LED purposes:
     * - To use the feature, uncomment MY_DEFAULT_xxx_LED_PIN in the sketch below
     * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
     * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
     * - ERR (red) - fast blink on error during transmission error or recieve crc error
     *
     * See http://www.mysensors.org/build/ethernet_gateway for wiring instructions.
     *
     */
    
    // Enable debug prints to serial monitor
    #define MY_DEBUG
    
    // Enable and select radio type attached
    //#define MY_RADIO_NRF24
    #define MY_RADIO_RFM69
    
    // Enable gateway ethernet module type
    #define MY_GATEWAY_W5100
    
    // W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal)
    //#define MY_W5100_SPI_EN 4
    
    // Enable Soft SPI for NRF radio (note different radio wiring is required)
    // The W5100 ethernet module seems to have a hard time co-operate with
    // radio on the same spi bus.
    #if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD)
    #define MY_SOFTSPI
    #define MY_SOFT_SPI_SCK_PIN 14
    #define MY_SOFT_SPI_MISO_PIN 16
    #define MY_SOFT_SPI_MOSI_PIN 15
    #endif
    
    // When W5100 is connected we have to move CE/CSN pins for NRF radio
    #ifndef MY_RF24_CE_PIN
    #define MY_RF24_CE_PIN 5
    #endif
    #ifndef MY_RF24_CS_PIN
    #define MY_RF24_CS_PIN 6
    #endif
    
    // Enable to UDP
    //#define MY_USE_UDP
    
    #define MY_IP_ADDRESS 192,168,1,82   // If this is disabled, DHCP is used to retrieve address
    // Renewal period if using DHCP
    //#define MY_IP_RENEWAL_INTERVAL 60000
    // The port to keep open on node server mode / or port to contact in client mode
    #define MY_PORT 5003
    
    // Controller ip address. Enables client mode (default is "server" mode).
    // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
    //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254
    
    // The MAC address can be anything you want but should be unique on your network.
    // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
    // Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
    #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
    
    // Enable inclusion mode
    #define MY_INCLUSION_MODE_FEATURE
    // Enable Inclusion mode button on gateway
    //#define MY_INCLUSION_BUTTON_FEATURE
    // Set inclusion mode duration (in seconds)
    #define MY_INCLUSION_MODE_DURATION 60
    // Digital pin used for inclusion mode button
    //#define MY_INCLUSION_MODE_BUTTON_PIN  3
    
    // Set blinking period
    #define MY_DEFAULT_LED_BLINK_PERIOD 300
    
    // Flash leds on rx/tx/err
    // Uncomment to override default HW configurations
    //#define MY_DEFAULT_ERR_LED_PIN 7  // Error led pin
    //#define MY_DEFAULT_RX_LED_PIN  8  // Receive led pin
    //#define MY_DEFAULT_TX_LED_PIN  9  // Transmit led pin
    
    
    #if defined(MY_USE_UDP)
    #include <EthernetUdp.h>
    #endif
    #include <Ethernet.h>
    #include <MySensors.h>
    
    
    void setup()
    {
    }
    
    void loop()
    {
    }
    

    which seems to work nicely:

    thats the only debug i get:
    "0;255;3;0;9;MCO:BGN:STP
    0;255;3;0;9;MCO:BGN:INIT OK,TSP=1"

    for the only node i use this sketch (which worked fine with a nrf), this is a Arduino Nano with some I-button readers:

    // Enable debug prints to serial monitor
    #define MY_DEBUG 
    
    // Enable and select radio type attached
    //#define MY_RADIO_NRF24
    #define MY_RADIO_RFM69
    
    #define MY_NODE_ID 102 
    
    #include <SPI.h>
    #include <MySensors.h>  
    #include <OneWire.h>
    
    // This is the pin with the 1-Wire bus on it
    OneWire ds_1(3);
    OneWire ds_2(4);
    OneWire ds_3(5);
    OneWire ds_4(6);
    
    
    
    
    // unique serial number read from the key
    byte addr_0[8];
    byte addr_1[8];
    int addr_1_last;
    byte addr_2[8];
    int addr_2_last;
    byte addr_3[8];
    
    // poll delay (I think 750ms is a magic number for iButton)
    int del = 750;
    
    #define CHILD_ID_1 1
    #define CHILD_ID_2 2
    #define CHILD_ID_3 3
    
    MyMessage ReadMsg_1(CHILD_ID_1, V_VAR1);
    MyMessage ReadMsg_2(CHILD_ID_2, V_VAR2);
    MyMessage ReadMsg_3(CHILD_ID_3, V_VAR3);
    
    void setup() {
      Serial.begin(115200);
    }
    
    void presentation()  {
      sendSketchInfo("iButton Reader", "1.0");
      present(CHILD_ID_1, S_CUSTOM);
      present(CHILD_ID_2, S_CUSTOM);
      present(CHILD_ID_3, S_CUSTOM);
    }
    
    void loop() {
    byte result;
    
      // search looks through all devices on the bus
       ds_1.reset_search();
         for( int i = 0; i < 8;  ++i )
      addr_1[i] = (char)0;
       ds_1.search(addr_1);
    //   Serial.println(ds_1.crc8(addr_1,7));
      if(ds_1.crc8(addr_1,7) == 0 && addr_1_last == 0) {
    /*    Serial.print("Reader 1a: ");
        for(byte i=0; i<8; i++) {  
          Serial.print(addr_1[i], HEX);
          Serial.print(" "); }
          Serial.print("\n"); */
      send(ReadMsg_1.set(0)); 
    addr_1_last = 1;
       /*   Serial.print("addr_1_last: ");
          Serial.print(addr_1_last);
          Serial.print("\n"); */
      for( int i = 0; i < 8;  ++i )
      addr_1[i] = (char)0;
      }  
      else if (ds_1.crc8(addr_1,7) >> 0  && addr_1_last == 1){
        
       /*   Serial.print("Reader 1b: ");
         for(byte i=0; i<8; i++) {
          Serial.print(addr_1[i], HEX);
          Serial.print(" ");}
          Serial.print("\n"); */
        send(ReadMsg_1.set(addr_1,HEX)); 
         addr_1_last = 0;
       /*  Serial.print("addr_1_last: ");
     //   for(byte i=0; i<8; i++) {  
          Serial.print(addr_1_last);
      //    Serial.print(" "); }
      Serial.print("\n"); */
      }
       ds_2.reset_search();
         for( int i = 0; i < 8;  ++i )
      addr_2[i] = (char)0;
       ds_2.search(addr_2);
     //  Serial.println(ds_2.crc8(addr_2,7));
      if(ds_2.crc8(addr_2,7) == 0 && addr_2_last == 0) {
     /*   Serial.print("Reader 2a: ");
        for(byte i=0; i<8; i++) {  
          Serial.print(addr_2[i], HEX);
          Serial.print(" "); }
          Serial.print("\n"); */
      send(ReadMsg_2.set(0)); 
    addr_2_last = 1;
      /*    Serial.print("addr_2_last: ");
          Serial.print(addr_2_last);
          Serial.print("\n"); */
      for( int i = 0; i < 8;  ++i )
      addr_2[i] = (char)0;
      }  
      else if (ds_2.crc8(addr_2,7) >> 0  && addr_2_last == 1){
        
       /*   Serial.print("Reader 2b: ");
         for(byte i=0; i<8; i++) {
          Serial.print(addr_2[i], HEX);
          Serial.print(" ");}
          Serial.print("\n"); */
        send(ReadMsg_2.set(addr_2,HEX)); 
         addr_2_last = 0;
       /*  Serial.print("addr_2_last: ");
     //   for(byte i=0; i<8; i++) {  
          Serial.print(addr_2_last);
      //    Serial.print(" "); }
      Serial.print("\n");    */
      }
    
      delay(del);
      return;
      }
    

    where i get this debug:
    "0 MCO:BGN:INIT NODE,CP=RRNNA--,VER=2.1.1
    3 TSM:INIT
    4 TSF:WUR:MS=0
    6 TSM:INIT:TSP OK
    8 TSM:INIT:STATID=102
    10 TSF:SID:OK,ID=102
    11 TSM:FPAR
    3133 TSF:MSG:SEND,102-102-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    5140 !TSM:FPAR:NO REPLY
    5142 TSM:FPAR
    8264 TSF:MSG:SEND,102-102-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    10271 !TSM:FPAR:NO REPLY
    10273 TSM:FPAR
    13395 TSF:MSG:SEND,102-102-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    15403 !TSM:FPAR:NO REPLY
    15405 TSM:FPAR
    18527 TSF:MSG:SEND,102-102-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    20534 !TSM:FPAR:FAIL
    20535 TSM:FAIL:CNT=1
    20537 TSM:FAIL:PDT"

    a capacitor is already in place on the node.
    Am i looking into a Gateway or node issue here? any suggestions?

    thanks in advance


  • Mod

    Could be a wiring issue on the rfm module, Capacitor not close enough to radio, try changing between power levels, how far apart are radio modules? Try setting radio channel to 1 or 250 in order to move away from other possible interference.



  • @jeti Hello jeti,
    I have also the same problem.
    However, if you have NRF24 modules, it is better to use the NRF24, first.
    Therefore, you will get the good experiences in using mysensors library.

    It seem that the default radio module for mysensors is NRF24.
    Today, someone suggested me to use older version of the mysensors library.
    But, I still busy for other job, not yet tried it.

    Regards,


  • Mod

    Yes, also try downgrading library to 2.1 or 2.0



  • @gohan said in first RFM node & Gateway !TSM:FPAR:FAIL:

    Could be a wiring issue on the rfm module, Capacitor not close enough to radio, try changing between power levels, how far apart are radio modules? Try setting radio channel to 1 or 250 in order to move away from other possible interference.

    Hello Gohan,
    In the previous experiments, I have put a big capacitor in the power source. The distance between node (ATMEGA328) and gateway (ESP8266 MQTT gateway) is less than 2 meter.

    How to set the radio channel in RFM69 ?
    Also how to set the power levels ?

    Can you share the #define script of your working code, to see the pins configuration, channels or PA level ?

    Regards,
    Maman


  • Mod

    Sorry I misread your post, I thought you were using the nrf24. Ignore my previous post.



  • @gohan:

    • recheked wiring checked, it is ok (now... DI00 was missing), still the same troubles

    • thea are roughly 40cm apart (Desk)

    • i am using the nrf2rfm69 adapter board, so capacitor is really close

    • downgrading to 2.0 gets this result:
      "Starting sensor (RRNNA-, 2.0.0)
      TSM:INIT
      TSM:RADIO:OK
      TSP:ASSIGNID:OK (ID=102)
      TSM:FPAR
      TSP:MSG:SEND 102-102-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
      TSM:FPAR
      TSP:MSG:SEND 102-102-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
      TSM:FPAR
      TSP:MSG:SEND 102-102-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
      TSM:FPAR
      TSP:MSG:SEND 102-102-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
      !TSM:FPAR:FAIL
      !TSM:FAILURE
      TSM:PDT"

    • changing channels and wpoerlevel works in MySensors.h? As I am just starting with the RFM i did not come across that yet. I also stumbled over the "Connecting the Radio" howto, where is mentioned that some lines need to be added to MySensors.h. Is this needed? if yes where to add them?

    @maman I know that the NRF is the easier one, and I do have several nodes using it. The range issue of the fake modules is bugging me. therefore is would like to give the RFM a go 😀

    thanks for your support !


  • Mod

    I'd put them more than 40cm apart, at least 2 meters, sometimes putting sender and receiver too close causes issues.


  • Admin

    Which model of the RFM69 do you use? H-model?


  • Hardware Contributor

    Maybe in some case sender and receiver too close can generate issues, but i never got this trouble with rfm69, perhaps i'm lucky.. but always better to try in case 😉

    I'm assuming you have capa for both radio, 10uf is ok.

    Because these logs can show :

    • power issues (often NACK for this)
    • DIO0 not well set on the right pin, and rfm69 is interrupt dependant. So if it doesn't get an irq fired, then no receive msg processed, so no reply seen for the ACK = No parent discovery (FPAR)
    • High power settings not set if using RFM69 high power version

    Note: you're not setting the frequency of your radio module, so default Mysensors settings is 868Mhz. If you need a different frequency regarding where you live, then add and change this define MY_RFM69_FREQUENCY.

    We don't know which RFM69 you're using here.
    If for GW, you're using RFM69H serie.. H means high power. and if this is the case, you may have a missing define in your gateway sketch and it can't work. This define MY_IS_RFM69HW

    Finally, i've not checked this, but maybe the irq settings for your DIO0 of your GW RFM69, could be not good..
    You can try this in case:
    #define MY_RF69_IRQ_PIN 32
    #define MY_RF69_IRQ_NUM 32

    (32) is the arduino corresponding pin for PA13 on atsam mcu. which should be your RFM69 DIO0

    All these defines, of course, need to be added at the top of your sketch, before the mysensors includes.

    Finally, if you want to know more about the RFM69 defines and default settngs, you can take a look to the docs here : https://www.mysensors.org/download/sensor_api_20



  • Hi Guys,

    thanks for pointing me in the right direction!
    I was missing some defines:

    #define MY_IS_RFM69HW
    #define MY_RFM69_FREQUENCY RF69_433MHZ
    

    now everything looks fine. The node is already discovered in FHEM and working!

    thanks again!



  • I had exact same issue and fixed with same solution.

    Should the example sketches have these lines added to them (commented out by default)?


  • Hardware Contributor

    @Wes
    it depends.. if all optional defines would be included in sketches, that may become messy, less readable.
    by default rfm69 driver is configured for 868mhz and non HW.
    if you want to see all available defines, you can take a look at myconfig.h .
    I don't advice to change myconfig.h, instead pick the defines you need and add them to your sketch.
    There is also the doc: https://www.mysensors.org/download/sensor_api_20#configuration


  • Mod

    @scalz personally I like to change the myconfig.h because this was I'm sure all my nodes have the same configuration. Of course if I use a HW radio I add the define in sketch and I also keep a copy of the file when I update the library


  • Hardware Contributor

    @gohan
    I should have said "wouldn't advice" instead of "don't" ! 😁
    well, I don't need to save a file. make some sense for me, as it is located in lib folder.
    I don't put my defines in the main .ino. To keep things local, and less lines of code, I usually create (or copy/paste) an additional file for each project, "MyDeviceDefines.h".

    but if it fits well for you, that's great, different strategy, agreed 😉


  • Mod

    It is just easier to find the necessary defines 🙂


Log in to reply
 

Suggested Topics

  • 3
  • 15
  • 4
  • 2
  • 10
  • 24

24
Online

11.2k
Users

11.1k
Topics

112.5k
Posts