1

I have code involving the use of an Adafruit Ultimate GPS Breakout v3 and an Adafruit RFM95W LoRa Radio that will compile with an Uno Rev3 but not with a Nano Every. The code I'm using comes almost directly from the examples provided by Arduino. I tried just the GPS code using the GPS_SoftwareSerial_Parsing test from Arduino and that worked, but I when I try using the Feather9x_TX code from Arduino it does not and I am not sure why. I am new to using Arduinos and have little experience with coding. I have attempted to search my error messages but have not been able to really find any answers so any help would be useful.

Here's the code

#include <SPI.h>
#include <RH_RF95.h>

#define RFM95_CS 9 #define RFM95_RST 8 #define RFM95_INT 2

// Change to 434.0 or other frequency, must match RX's freq! #define RF95_FREQ 915.0

// Singleton instance of the radio driver RH_RF95 rf95(RFM95_CS, RFM95_INT);

void setup() { pinMode(RFM95_RST, OUTPUT); digitalWrite(RFM95_RST, HIGH);

Serial.begin(115200); while (!Serial) { delay(1); }

delay(100);

Serial.println("Feather LoRa TX Test!");

// manual reset digitalWrite(RFM95_RST, LOW); delay(10); digitalWrite(RFM95_RST, HIGH); delay(10);

while (!rf95.init()) { Serial.println("LoRa radio init failed"); Serial.println("Uncomment '#define SERIAL_DEBUG' in RH_RF95.cpp for detailed debug info"); while (1); } Serial.println("LoRa radio init OK!");

// Defaults after init are 434.0MHz, modulation GFSK_Rb250Fd250, +13dbM if (!rf95.setFrequency(RF95_FREQ)) { Serial.println("setFrequency failed"); while (1); } Serial.print("Set Freq to: "); Serial.println(RF95_FREQ);

// Defaults after init are 434.0MHz, 13dBm, Bw = 125 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC on

// The default transmitter power is 13dBm, using PA_BOOST. // If you are using RFM95/96/97/98 modules which uses the PA_BOOST transmitter pin, then // you can set transmitter powers from 5 to 23 dBm: rf95.setTxPower(23, false); }

int16_t packetnum = 0; // packet counter, we increment per xmission

void loop() { delay(1000); // Wait 1 second between transmits, could also 'sleep' here! Serial.println("Transmitting..."); // Send a message to rf95_server

char radiopacket[20] = "Hello World # "; itoa(packetnum++, radiopacket+13, 10); Serial.print("Sending "); Serial.println(radiopacket); radiopacket[19] = 0;

Serial.println("Sending..."); delay(10); rf95.send((uint8_t *)radiopacket, 20);

Serial.println("Waiting for packet to complete..."); delay(10); rf95.waitPacketSent(); // Now wait for a reply uint8_t buf[RH_RF95_MAX_MESSAGE_LEN]; uint8_t len = sizeof(buf);

Serial.println("Waiting for reply..."); if (rf95.waitAvailableTimeout(1000)) { // Should be a reply message for us now
if (rf95.recv(buf, &len)) { Serial.print("Got reply: "); Serial.println((char*)buf); Serial.print("RSSI: "); Serial.println(rf95.lastRssi(), DEC);
} else { Serial.println("Receive failed"); } } else { Serial.println("No reply, is there a listener around?"); }

}

And here are the errors

Arduino: 1.8.19 (Windows 10), Board: "Arduino Nano Every, None (ATMEGA4809)"

C:\Users\jfeze\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp: In member function 'virtual void RHHardwareSPI::attachInterrupt()': C:\Users\jfeze\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp:49:25: error: 'virtual void SPIClassMegaAVR::attachInterrupt()' is private within this context

 SPI.attachInterrupt();
                     ^

In file included from C:\Users\jfeze\Documents\Arduino\libraries\RadioHead/RadioHead.h:731:0, from C:\Users\jfeze\Documents\Arduino\libraries\RadioHead/RHGenericSPI.h:10, from C:\Users\jfeze\Documents\Arduino\libraries\RadioHead/RHHardwareSPI.h:10, from C:\Users\jfeze\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp:7:

C:\Users\jfeze\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\libraries\SPI\src/SPI.h:186:15: note: declared private here

inline void attachInterrupt() { SPI0.INTCTRL |= (SPI_IE_bm); } ^~~~~~~~~~~~~~~

C:\Users\jfeze\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp: In member function 'virtual void RHHardwareSPI::detachInterrupt()': C:\Users\jfeze\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp:56:25: error: 'virtual void SPIClassMegaAVR::detachInterrupt()' is private within this context

 SPI.detachInterrupt();
                     ^

In file included from C:\Users\jfeze\Documents\Arduino\libraries\RadioHead/RadioHead.h:731:0, from C:\Users\jfeze\Documents\Arduino\libraries\RadioHead/RHGenericSPI.h:10, from C:\Users\jfeze\Documents\Arduino\libraries\RadioHead/RHHardwareSPI.h:10, from C:\Users\jfeze\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp:7:

C:\Users\jfeze\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\libraries\SPI\src/SPI.h:187:15: note: declared private here

inline void detachInterrupt() { SPI0.INTCTRL &= ~(SPI_IE_bm); } ^~~~~~~~~~~~~~~

Multiple libraries were found for "RH_RF95.h" Used: C:\Users\jfeze\Documents\Arduino\libraries\RadioHead Not used: C:\Users\jfeze\Documents\Arduino\libraries\RadioHead-master exit status 1

Error compiling for board Arduino Nano Every.

jsotola
  • 1,554
  • 2
  • 12
  • 20
Jackson
  • 11
  • 1

0 Answers0