MoteinoMega LoRa init failed [solved]

Started by letcher, April 01, 2016, 04:01:21 PM

letcher

Just received a Moteino LoRa and a MoteinoMega LoRa and started to test them.  The Moteino was programmed with the the sketches in the Radiohead/examples/rf95 section of the library and seemed to run as expected.  However the Motenio Mega LoRa failed to start any of the examples with the serial message "init failed".  Any suggestions?

Felix

They were tested with the library linked on this page before shipping. Please use that since it has mods for MoteinoMEGA.

letcher

Cleaned up the libraries and that fixed the problem - thanks.

Felix

Could you give more detail what needed clean-up?
And which specific libraries you used?
Thanks

letcher

I had multiple copies of the the radiohead libraries, including the original one from radiohead.  After deleting all the old copies I got the demo to run (rf95_server and rf95_client).

NowI have got the moteino LoRa and moteinoMega LoRa unable to communicate. 

I'm uploading rf95_client to a MoteinoMega LoRa and rf95_server to a Moteino LoRa.  I'm wondering if they are initializing correctly.  If I don't " #define  __AVR_ATmega1284P__" on the mega I get:

mega without def:
SS pin:10
int pin:2
int number:2
init OK - 915mhzSending to rf95_server

and with the definition:

mega without def:
SS pin:10
int pin:2
int number:2
init OK - 915mhzSending to rf95_server


The Moteino tantalizes:

moteino:
SS pin:10
int pin:2
int number:0
init OK - 915mhz


letcher

The startup data returned was copied wrong although the results are the same.  Do both micros use the same SS pin?  Here is the correction:

MoteinoMEGA-LoRa, without #define  __AVR_ATmega1284P__:
SS pin:10
int pin:2
int number:2
init OK - 915mhzSending to rf95_server

MoteinoMEGA-LoRa, with  #define  __AVR_ATmega1284P__:
SS pin:10
int pin:2
int number:2
init OK - 915mhzSending to rf95_server

MoteinoLR:
SS pin:10
int pin:2
int number:0
init OK - 915mhz

letcher

Found the problem.

I had the MoteinoMega LoRa on a breadboard with a Adafruit Ultimate GPS and was supplying the GPS power from the MoteinoMega.  The 3.3v pin on the MoteinoMega was connected to the VIN pin on the GPS.  Switching to the 3.3v on the GPS instead solved the problem.

ReanimationXP

I'm having the same issue and don't currently have anything attached to the Mega.

Felix, when you say use the library linked on this page, I don't see anything linked on there - only references to HopeRF and Radiohead.  The official Radiohead library, while mentioning Moteino in documentation, doesn't seem to have any Moteino-specific pin references or notation in the actual examples.  There also seems to be no identifier that would allow the server and client to have a private 'channel' of their own.  Am I missing something?

Felix

Quote from: ReanimationXP on January 16, 2018, 10:50:40 PM
Am I missing something?
Possibly,
Have you installed the Moteino Core (details here)?
Then have you set your target to MoteinoMEGA in the Arduino IDE > Tools > Board menu?

You can always call the constructor with your own pin definitions to force it to assign a different than default pin.
For instance you can do this to force SS=4 and IRQ=2 (these are defaults):

RH_RF95(4, 2)

ReanimationXP

#9
Yes I've done both, and I've since found that rf95_reliable_datagram_client/server are the examples I'll need to relegate things to their own channels.

I added your code for printing out the SS and such back to the up to date RadioHead library and the defaults are coming out as follows:

QuoteSS pin:10
int pin:2
int number:2
Radio init failed.

This seems to be the issue, and I was unable to find the correct numbers for comparison in the documentation.

ReanimationXP

I found this bit in your version of RH_RF95.h. Adding it back in to the current library got it working.  I also changed the frequency to 915 in RH_RF95.c and a couple other things as well, but changing this definitely had an effect:

Quote#if defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)
    RH_RF95(uint8_t slaveSelectPin = 4, uint8_t interruptPin = 2, RHGenericSPI& spi = hardware_spi);
#else
    RH_RF95(uint8_t slaveSelectPin = SS, uint8_t interruptPin = 2, RHGenericSPI& spi = hardware_spi);
#endif

ReanimationXP

Can confirm both of their out of the box examples are compiling and communicating correctly with that block added.

Interestingly, despite the instantiation settings seeming to be RH_RF95 rf95(4,2), your output is reporting the following:

rf95_client:
QuoteSS pin:10
int pin:2
int number:2
Sending to rf95_server
got reply: Hello back!

rf95_server:
QuoteSS pin:10
int pin:2
int number:2
got request: Hello World!
Sent a reply

Felix


ReanimationXP

#13
Yes, I would not have gotten this far without it.

Edit:  Felix has added the needed information to the LoRa page.  See this thread for details:
https://lowpowerlab.com/forum/moteinomega/migrating-from-moteino-to-moteinomega