Hello,
I'm attempting to combine an Adafruit RFM69HCW radio with an Adafruit nRF8001 Bluetooth LE on a Teensy 3.5. The radio is using the first SPI bus (e.g. MOSI0) and the Bluetooth board is using the second SPI bus (e.g. MOSI1). The radio functions fine by itself. The Bluetooth board functions fine with a Teensy 3.2 by itself (using its only SPI bus). I'm unable to get the Bluetooth board working on the Teensy 3.5 and I suspect I'm doing something wrong with the buses. Can someone tell me what I may be doing wrong? Am I being too simplistic in thinking that I can simply define SPI and SPI1 parameters to use both buses?
Thanks!
I'm attempting to combine an Adafruit RFM69HCW radio with an Adafruit nRF8001 Bluetooth LE on a Teensy 3.5. The radio is using the first SPI bus (e.g. MOSI0) and the Bluetooth board is using the second SPI bus (e.g. MOSI1). The radio functions fine by itself. The Bluetooth board functions fine with a Teensy 3.2 by itself (using its only SPI bus). I'm unable to get the Bluetooth board working on the Teensy 3.5 and I suspect I'm doing something wrong with the buses. Can someone tell me what I may be doing wrong? Am I being too simplistic in thinking that I can simply define SPI and SPI1 parameters to use both buses?
Thanks!
Code:
#include <RFM69.h> //get it here: https://www.github.com/lowpowerlab/rfm69
#include <RFM69_ATC.h>//get it here: https://www.github.com/lowpowerlab/rfm69
#include <SPI.h> //comes with Arduino IDE (www.arduino.cc)
.
.
.
//*********************************************************************************************
// for Adafruit RFM69HCW connected to Teensy 3.5 through the first default (0) SPI bus
// The Low Power Labs RFM69.h library does not support multiple buses!
#define RFM69_CS 10
#define LED 13
#define RFM69_RST 33
#define RFM69_IRQ 34
#define RFM69_IRQN 34 // Interrupt number is same as pin number on Teensy
#define RFM69_SCK 14
#define RFM69_MOSI 11
#define RFM69_MISO 12
RFM69 radio = RFM69(RFM69_CS, RFM69_IRQ, IS_RFM69HW, RFM69_IRQN);
//*********************************************************************************************
// for Adafruit nRF8001 Bluetooth Low Energy Breakout connected to Teensy 3.5
#include "Adafruit_BLE_UART.h"
#define BLE_CS 31
#define BLE_RDY 30 // This should be an interrupt pin
#define BLE_RST 29
#define BLE_SCK 32
#define BLE_MOSI 21
#define BLE_MISO 5
Adafruit_BLE_UART BTLEserial = Adafruit_BLE_UART(BLE_CS, BLE_RDY, BLE_RST);
//*********************************************************************************************
#define SERIAL_BAUD 9600
.
.
.
void setup() {
Serial.begin(SERIAL_BAUD);
while(!Serial); //Teensy 3.2 sketch has this delay. Don't want it for this node, but debugging now.
//delay(10); // commented out while debugging with above line.
// ==================== setup Adafruit RFM69HCW
SPI.setSCK(RFM69_SCK);
SPI.setMOSI(RFM69_MOSI);
SPI.setMISO(RFM69_MISO);
SPI.setCS(RFM69_CS);
SPI.begin();
// Hard reset the RFM module
pinMode(RFM69_RST, OUTPUT);
digitalWrite(RFM69_RST, HIGH);
delay(100);
digitalWrite(RFM69_RST, LOW);
delay(100);
radio.initialize(FREQUENCY,NODEID,NETWORKID);
#ifdef IS_RFM69HW
radio.setHighPower(); //only for RFM69HW!
#endif
// ==================== end of Adafruit RFM69HCW setup
// ==================== setup Adafruit nRF8001 Bluetooth LE
SPI1.setSCK(BLE_SCK);
SPI1.setMOSI(BLE_MOSI);
SPI1.setMISO(BLE_MISO);
SPI1.setCS(BLE_CS);
SPI1.begin();
Serial.println(F("Adafruit Bluefruit Low Energy nRF8001 Print echo demo"));
BTLEserial.setDeviceName("Teensy"); /* 7 characters max! */
BTLEserial.begin();
// ==================== end of Adafruit nRF8001 Bluetooth setup
}
// Bluetooth LE line, constantly checks for new events on the nRF8001
aci_evt_opcode_t laststatus = ACI_EVT_DISCONNECTED;
void loop() {
.
.
.