https://www.adafruit.com/product/3333
https://www.adafruit.com/product/3073
The problem I'm having is that the LoRa module requires six connections besides power and ground: SCLK, MISO, MOSI, INT, RST, and CS, and I'm not sure how to hook them all up. Three of them appear to be at my discretion; the RadioHead constructor takes as parameters the pins for CS and INT, and it's up to me to handle RST, so I used A4, A5, and A6 for these, as seen below:
Code: Select all
#define RFM95_INT_PIN A4
#define RFM95_RST_PIN A5
#define RFM95_CS_PIN A6
RH_RF95 rf95(RFM95_CS_PIN, RFM95_INT_PIN);
void setup() {
CircuitPlayground.begin(255);
pinMode(RFM95_RST_PIN, OUTPUT);
digitalWrite(RFM95_RST_PIN, LOW);
delay(10);
digitalWrite(RFM95_RST_PIN, HIGH);
delay(10);
if (!rf95.init()) panic();
}
The problem is, SCLK, MISO, and MOSI don't appear to be up to me. By adding some debugging, it appears that code outside my control sets SCLK=13, MISO=30, and MOSI=32, and these values don't seem to correspond to any of the available pads. (A1=15, A2=16, and A3=17). I've seen other CPX+SPI advice in this forums suggesting using A1 for SCLK, A2 for MISO, and A3 for MOSI, but when I try that, the call to rf95.init() fails, and appears to write "FF" to the serial port.
What's the right way to make these two devices work together? Should I be wiring them up differently, or making changes to the code so that it'll use A1-A3 for SPI?