Author Topic: Send/Receive Example Sketches Not Working  (Read 348 times)

mah115

  • Newbie
  • *
  • Posts: 19
Send/Receive Example Sketches Not Working
« on: January 14, 2019, 05:53:04 AM »
Hi,
   I'm trying to run the Send/Receive examples from the library, but it seems to be not working properly.  I have the RFM69HCW 915MHz radio pre-installed.  Did I miss something?  Sketches are attached.

Terminal Outputs:


My Gateway settings:
Code: [Select]
//*********************************************************************************************
//************ IMPORTANT SETTINGS - YOU MUST CHANGE/CONFIGURE TO FIT YOUR HARDWARE *************
//*********************************************************************************************
#define NODEID        1    //unique for each node on same network
#define NETWORKID     100  //the same on all nodes that talk to each other
//Match frequency to the hardware version of the radio on your Moteino (uncomment one):
//#define FREQUENCY     RF69_433MHZ
//#define FREQUENCY     RF69_868MHZ
#define FREQUENCY     RF69_915MHZ
#define ENCRYPTKEY    "sampleEncryptKey" //exactly the same 16 characters/bytes on all nodes!
#define IS_RFM69HW_HCW  //uncomment only for RFM69HW/HCW! Leave out if you have RFM69W/CW!
//*********************************************************************************************

The Node settings:
Code: [Select]
//*********************************************************************************************
//************ IMPORTANT SETTINGS - YOU MUST CHANGE/CONFIGURE TO FIT YOUR HARDWARE ************
//*********************************************************************************************
#define NODEID        2    //must be unique for each node on same network (range up to 254, 255 is used for broadcast)
#define NETWORKID     100  //the same on all nodes that talk to each other (range up to 255)
#define GATEWAYID     1
//Match frequency to the hardware version of the radio on your Moteino (uncomment one):
//#define FREQUENCY   RF69_433MHZ
//#define FREQUENCY   RF69_868MHZ
#define FREQUENCY     RF69_915MHZ
#define ENCRYPTKEY    "sampleEncryptKey" //exactly the same 16 characters/bytes on all nodes!
#define IS_RFM69HW_HCW  //uncomment only for RFM69HW/HCW! Leave out if you have RFM69W/CW!
« Last Edit: January 14, 2019, 05:56:08 AM by mah115 »

handyguy

  • Newbie
  • *
  • Posts: 21
Re: Send/Receive Example Sketches Not Working
« Reply #1 on: January 14, 2019, 08:44:25 AM »
It sounds like you're having a problem similar to the one I am experiencing and described in this thread: https://lowpowerlab.com/forum/coding-questions/getting-random-results-from-sendwithretry()/msg25384/#msg25384. The sendWithRetry() call isn't returning accurate results and messages aren't making it to the gateway.

There's a high likelihood that your radio settings between the gateway and node units are mismatched (network ID, encryption key, RFM69 vs. RFM69_ATC, etc). Carefully triple-checking those settings will tell you if that's the case. It looks that way from a quick review of the code you posted, but I found (the hard way) sometimes the differences can be subtle. If they are the same, you may be in the same boat I am. I'm still researching root cause but haven't found a solution yet.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5678
  • Country: us
    • LowPowerLab
Re: Send/Receive Example Sketches Not Working
« Reply #2 on: January 14, 2019, 09:17:13 AM »
Its essential the settings are correct, to match what the hardware is. Most often overlooked aspect, folks believe they have 1 type of radio, in fact they have another. Then you must match the network ID with your gateway. And frequency of hardware radio has to match the setting in firmware.
Next is antenna missing or mismatched, or crushed/coiled monopole (less of a problem, just small range). Then I would check for cold solder joints, if radio was soldered by the user.
The radio ID guide is here:
https://lowpowerlab.com/moteino/transceivers

I can check back later after you confirm all the above is correct.

mah115

  • Newbie
  • *
  • Posts: 19
Re: Send/Receive Example Sketches Not Working
« Reply #3 on: January 14, 2019, 03:36:32 PM »
Hi Felix,
   I'm using the boards and antennas on order #12987.  The solder looks ok.  The radio module looks like the RFM69HCW with a silver dot.

Moteino M0
  - Transceiver: RFM69HCW - 868/915Mh
Helical Antenna
  - Frequency: 915 Mhz

mah115

  • Newbie
  • *
  • Posts: 19
Re: Send/Receive Example Sketches Not Working
« Reply #4 on: January 15, 2019, 02:18:15 AM »
A few observations:
1. If I turn the gateway on first, then I get an "ok" on the node on its first packet.

2. However, if I turn the node on first, the gateway still receives the packet, but the node does not receive an ACK

3. If I leave the node running and reset the gateway, it can read one packet before hanging

4. The 'r' radio.readAllRegs() command will cause both gateway and node to hang.
5. Switching the node/gateway Motes gives the same result, so it doesn't seem to be a hardware issue with one of them.
6. The struct_send/struct_receive sketches have a similar behavior.

7. If I set the frequency to 433 on purpose, I still get the first "ok".  So maybe that "ok" isn't real?
« Last Edit: January 15, 2019, 04:13:15 AM by mah115 »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5678
  • Country: us
    • LowPowerLab
Re: Send/Receive Example Sketches Not Working
« Reply #5 on: January 15, 2019, 09:11:57 AM »
I need to check this, bear with me please.

mah115

  • Newbie
  • *
  • Posts: 19
Re: Send/Receive Example Sketches Not Working
« Reply #6 on: January 15, 2019, 01:12:39 PM »
Thanks for looking into it.  I also tried previous versions of the library, there is similar behavior, although some will not give me the first “ok”.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5678
  • Country: us
    • LowPowerLab
Re: Send/Receive Example Sketches Not Working
« Reply #7 on: January 15, 2019, 02:15:25 PM »
I just tried latest library release (v1.2).
I tried the Gateway with Node then RandomNumbers examples, everything works perfectly, no ACKs lost or anything.
I then tried the Struct_receive with Struct_send, same results, perfect everything.
This is with a Moteino and MoteinoUSB.
« Last Edit: January 15, 2019, 02:50:53 PM by Felix »

mah115

  • Newbie
  • *
  • Posts: 19
Re: Send/Receive Example Sketches Not Working
« Reply #8 on: January 15, 2019, 02:24:07 PM »
I attached the source code I used in the first post, can you take a look?  Or, can you post the sketch you used to test?

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5678
  • Country: us
    • LowPowerLab
Re: Send/Receive Example Sketches Not Working
« Reply #9 on: January 15, 2019, 02:49:58 PM »
Ok I spoke too soon, there is a problem with the SPI SS definitions for some of the examples, I see now that they fail with the MoteinoM0.
Sorry about that.

I updated the Gateway+Node and Struct examples, please try again with the latest version of these.

handyguy

  • Newbie
  • *
  • Posts: 21
Re: Send/Receive Example Sketches Not Working
« Reply #10 on: January 15, 2019, 02:52:54 PM »
Felix,

I'm using the standard R6, not the M0. Might the changes you made affect the issues I am seeing as well?

mah115

  • Newbie
  • *
  • Posts: 19
Re: Send/Receive Example Sketches Not Working
« Reply #11 on: January 16, 2019, 01:00:46 AM »
Just tested it out on the M0, works!  Thanks for jumping on this issue Felix, I appreciate the fast bug fix.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5678
  • Country: us
    • LowPowerLab
Re: Send/Receive Example Sketches Not Working
« Reply #12 on: January 16, 2019, 07:19:29 AM »
Glad to have helped, I need to update the other examples as well. Also this change triggered travis-CI build fails, which means I have to find a way to update the travis-ci Moteino board definitions to allow MoteinoM0 builds with the proper defined (they don't know what SS_FLASHMEM is for instance).

@handyguy:
Would like you to have try latest and manage to get the Moteino R6 working, which it should have been working even before these latest changes.

handyguy

  • Newbie
  • *
  • Posts: 21
Re: Send/Receive Example Sketches Not Working
« Reply #13 on: January 16, 2019, 10:16:39 AM »
Felix, I did a quick test last night and got the same results (i.e., not working). However, to be fair I ran through it pretty quickly. Let me take some more time tonight and I'll let you know what I find.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5678
  • Country: us
    • LowPowerLab
Re: Send/Receive Example Sketches Not Working
« Reply #14 on: January 16, 2019, 10:25:16 AM »
Thank you, let me know what you find.
Sorry for all the back and forth but it looks like everything should be working.