Migrating from Moteino to MoteinoMEGA

Started by MLH, January 16, 2018, 02:16:41 PM

MLH

I attempting to port functional code from a LoRa Motenio to a LoRa MEGA to gain additional hardware serial ports. The non RF related portions of the code work fine but the LoRa is not working most likely due to the SPI pins not being the same. I'm using the suggested Radiohead library, what am I missing?

Thanks,

Mike 

Felix

The SPI SS/CS pin is different on the MoteinoMEGA (digital pin 4).
Try calling the initialize with a "4".

MLH


ReanimationXP

I think there needs to be a fork (or PR) of (to) the Radiohead library surrounding Moteino and Moteino Mega support. Seems to be a lack of documentation w/r/t Moteino + LoRa unless I've missed it somehow.

Felix

Again, see this page please. I believe the details needed to get started are covered there.
The RadioHead library (as is), along with a proper install of the Moteino Core (see this page for that) will ensure that your call to rh95 constructor sets up the defaults without any other changes required.

ReanimationXP

Unfortunately no, results in a failure to init the radio.  Only the archived version you provided for older versions of Arduino worked, and the library has been updated significantly since then.

Felix

Have you installed the Moteino Core?
Have you picked MoteinoMEGA as your target Board?
This is now duplicating info but ... would be helpful to know the answer to these questions.

Felix

Follow up (cross reference this thread):

Although the pindefinition in the Moteino Core does define SS=4 for MoteinoMEGA, apparently it is not picked up in the RadioHead library.
At least for now we know how to avoid this. There are 2 possible solutions:

1) Call the constructor with argument 4 for MoteinoMEGA:

RH_RF95 rf95(4)


2) I just released a patched library that includes a fix for this, the link is on the Moteino LoRa page at the bottom.
With this patch, the default constructor will work when MoteinoMEGA or Atmega1284p is selected as target board.

ReanimationXP

Thanks for updating the documentation. Sorry for the duplicate threads.