I'm hoping someone can point me in the right direction. I'm trying to get LoRa working with a Teensy 3.6 in the hope that I can use it to replace a Feather M0 in a current project. When I try to init the radio I get the message "LoRa radio init failed" from the program. Obviously, I can't get far with this if I can't even init the radio. This works fine with the Feather M0 so it's very probably something I've set up incorrectly.
The code is very simple stuff so far...
Any help would be greatly appreciated
The code is very simple stuff so far...
Any help would be greatly appreciated
Code:
#include <SPI.h>
#include <RH_RF95.h>
#define DEBUG true
#define RFM95_CS 10 // Chip Select
#define RFM95_RST 9 // Reset
#define RFM95_INT 3 // Interupt
// radio xmit power level (20 = MAX)
#define RFM95_POWER 13
// Change to 434.0 or other frequency, must match TX's freq!
#define RF95_FREQ 915.0
// create a singleton instance of the radio driver
RH_RF95 rf95(RFM95_CS, RFM95_INT);
void setup()
{
pinMode(RFM95_RST, OUTPUT); // Enable Reset control
digitalWrite(RFM95_RST, HIGH); // Clear reset (active low)
if (DEBUG)
{
Serial.begin(115200); // Set the serial port baud rate for diagnostic messages
while (!Serial) delay(1);
}
delay(100);
if(DEBUG) Serial.println("Starting Teensy LoRa Test\n");
pinMode(RFM95_CS, OUTPUT); // Chip Select is an output
// manually reset the radio by toggling the RFM95_RST line
digitalWrite(RFM95_RST, LOW); // Force reset low (active low)
delay(10); // Hold low for 10mS
digitalWrite(RFM95_RST, HIGH); // Release the reset signal
delay(10); // pause 10mS before continuing
while (!rf95.init()) {
// if not init the fail
if (DEBUG) Serial.println("LoRa radio init failed");
while (1);
}
// LoRa initialized
if (DEBUG) Serial.println("LoRa radio init OK!");
// Defaults after reset are 434.0MHz, modulation GFSK_Rb250Fd250, +13dbM
// change the frequency to 915 mHz
if (!rf95.setFrequency(RF95_FREQ)) {
if (DEBUG) Serial.println("setFrequency failed");
while (1);
}
// Output frequency diagnostic message
if (DEBUG) Serial.print("Set Freq to: ");
if (DEBUG) Serial.println(RF95_FREQ);
// set transmitter powers from 5 to 23 dBm:
rf95.setTxPower(RFM95_POWER, false);
// Output power diagnostic message
if (DEBUG) Serial.print("Set Power to: ");
if (DEBUG) Serial.println(23);
}
void loop() {
// put your main code here, to run repeatedly:
}