RBA + RBA-Nano with RFM69HCW

OK, so I think I dove into these Artemis boards far too soon, and now I just need to make it work or die trying. Apparently, these boards operate extremely different from the standard Arduino boards before them, and it is causing me more headache than it probably should be. So, I can load up any Artemis/Apollo example sketch just fine and blink LED’s on any pin I want to. However, trying to make libraries and sketches from the LowPowerLab RFM69 work so far has been unsuccessful. I am not sure if it is a pin map problem somewhere in it or SPI settings/calls.

First, lets lay the ground work. Power and ground are self explanatory, so I won’t label them here.

Redboard Artemis with RFM69HCW wiring:

Screen Printed Pin ↔ Radio Pin

MISO (12) ↔ MISO

MOSI (11)<-> MOSI

SCK (13) ↔ SCK

10 (D10) ↔ NSS

2 (D2) ↔ DIO0 (Interrupt Pin)

Redboard Artemis Nano with RFM69HCW wiring:

Screen Printed Pin ↔ Radio Pin

MISO (13) ↔ MISO

MOSI (12)<-> MOSI

SCK (11) ↔ SCK

10 ↔ NSS

9 ↔ DIO0 (Interrupt Pin)

Assuming the MISO, MOSI, and SCK pins are self explanatory and wired correctly, that leaves NSS and DIO0 up in the air with both. I tried adding the following to the RFM69HCW Hook Up Guide sketch example. It is based on working with the Arduino Pro Mini, Arduino Pro, or SF Redboard within the article. My wiring followed my own Artemis boards’ screen prints.

After unsuccessful attempts of seeing any receive acknowledgements from test messages in the serial monitor (in carriage return mode), I decided to try the next thing.

Reviewing the LowPowerLab library, I decided to try adding the following to the example sketch:

*RBA

#define RF69_IRQ_PIN 2 //RFM DIO0 Pin to controller board pin

#define RF69_SPI_CS 10 //RFM NSS Pin to controller board pin

*RBA-Nano

#define RF69_IRQ_PIN 2 //RFM DIO0 Pin to controller board pin

#define RF69_SPI_CS 10 //RFM NSS Pin to controller board pin

Still no go.

It appears the SPI may work extremely different and pin mappings could be causing me problems. Than again, it could be the old RFM69 library not updated for quite some time either. Can someone help point me in the right direction? The Hookup Guides for various products sold by Sparkfun definitely needs to be updated to add an Artemis example wiring and sketch.

Hi - thanks for all your detail. I’ll see if I can help get you going in the right direction.

The Artemis in Arduino is meant to be simple - you use pinMode and digitalWrite with the silkscreen printed pin numbers. This is generally how Arduino compatible boards are meant to work and also why many libraries can support lots of boards. Have you confirmed that the library uses “pinMode” and “digitalWrite” to try to control those pins?

Do you have any way of confirming the signals on the pins / busses that you need to use? For example a logic analyzer, oscilloscope, or even (rudimentarily) a digital multimeter?

You are correct, using those SPI pins should be as simple as “SPI.begin” and “SPI.transfer” (which the library should be using somehow…) Can you confirm that the library is using the proper SPI object?

We can probably work through this together.

Regards,

Liquid

The RFM69.CPP does have some snippets of the following (not in any specific order):

 digitalWrite(_slaveSelectPin, HIGH);
  pinMode(_slaveSelectPin, OUTPUT);
  SPI.begin();
 // write to FIFO
  select();
  SPI.transfer(REG_FIFO | 0x80);
  SPI.transfer(bufferSize + 3);
  SPI.transfer((uint8_t)toAddress);
  SPI.transfer((uint8_t)_address);
  SPI.transfer(CTLbyte);

  for (uint8_t i = 0; i < bufferSize; i++)
    SPI.transfer(((uint8_t*) buffer)[i]);
  unselect();

So it appears to using the right objects. Additionally, the RFM69.H contains snippets of the following regarding pins:

// Select platform automatically, if possible
#ifndef RF69_PLATFORM
 #if (MPIDE>=150 && defined(ARDUINO))
  // Using ChipKIT Core on Arduino IDE
  #define RF69_PLATFORM RF69_PLATFORM_CHIPKIT_CORE
 #elif defined(MPIDE)
  // Uno32 under old MPIDE, which has been discontinued:
  #define RF69_PLATFORM RF69_PLATFORM_UNO32
#elif defined(NRF51)
  #define RF69_PLATFORM RF69_PLATFORM_NRF51
#elif defined(NRF52)
  #define RF69_PLATFORM RF69_PLATFORM_NRF52
 #elif defined(ESP8266)
  #define RF69_PLATFORM RF69_PLATFORM_ESP8266
 #elif defined(ESP32)
  #define RF69_PLATFORM RF69_PLATFORM_ESP32
 #elif defined(ARDUINO)
  #define RF69_PLATFORM RF69_PLATFORM_ARDUINO
 #elif defined(__MSP430G2452__) || defined(__MSP430G2553__)
  #define RF69_PLATFORM RF69_PLATFORM_MSP430
 #elif defined(MCU_STM32F103RE)
  #define RF69_PLATFORM RF69_PLATFORM_STM32
 #elif defined(STM32F2XX)
  #define RF69_PLATFORM RF69_PLATFORM_STM32F2
 #elif defined(USE_STDPERIPH_DRIVER)
  #define RF69_PLATFORM RF69_PLATFORM_STM32STD
 #elif defined(RASPBERRY_PI)
  #define RF69_PLATFORM RF69_PLATFORM_RASPI
#elif defined(__unix__) // Linux
  #define RF69_PLATFORM RF69_PLATFORM_UNIX
#elif defined(__APPLE__) // OSX
  #define RF69_PLATFORM RF69_PLATFORM_UNIX
 #else
  #error Platform not defined! 	
 #endif
#endif

#if defined(ESP8266) || defined(ESP32)
  #define ISR_PREFIX ICACHE_RAM_ATTR
#else
  #define ISR_PREFIX
#endif

// digitalPinToInterrupt is not available prior to Arduino 1.5.6 and 1.0.6
// See http://arduino.cc/en/Reference/attachInterrupt
#ifndef NOT_AN_INTERRUPT
 #define NOT_AN_INTERRUPT -1
#endif
#ifndef digitalPinToInterrupt
 #if (RF69_PLATFORM == RF69_PLATFORM_ARDUINO) && !defined(__arm__)
  #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
   // Arduino Mega, Mega ADK, Mega Pro
   // 2->0, 3->1, 21->2, 20->3, 19->4, 18->5
   #define digitalPinToInterrupt(p) ((p) == 2 ? 0 : ((p) == 3 ? 1 : ((p) >= 18 && (p) <= 21 ? 23 - (p) : NOT_AN_INTERRUPT)))
  #elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) 
   // Arduino 1284 and 1284P - See Maniacbug and Optiboot
   // 10->0, 11->1, 2->2
   #define digitalPinToInterrupt(p) ((p) == 10 ? 0 : ((p) == 11 ? 1 : ((p) == 2 ? 2 : NOT_AN_INTERRUPT)))
  #elif defined(__AVR_ATmega32U4__)
   // Leonardo, Yun, Micro, Pro Micro, Flora, Esplora
   // 3->0, 2->1, 0->2, 1->3, 7->4
   #define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT)))))
  #else
   // All other arduino except Due:
   // Serial Arduino, Extreme, NG, BT, Uno, Diecimila, Duemilanove, Nano, Menta, Pro, Mini 04, Fio, LilyPad, Ethernet etc
   // 2->0, 3->1
   #define digitalPinToInterrupt(p)  ((p) == 2 ? 0 : ((p) == 3 ? 1 : NOT_AN_INTERRUPT))
  #endif
 #elif (RF69_PLATFORM == RF69_PLATFORM_UNO32) || (RF69_PLATFORM == RF69_PLATFORM_CHIPKIT_CORE)
  // Hmmm, this is correct for Uno32, but what about other boards on ChipKIT Core?
  #define digitalPinToInterrupt(p) ((p) == 38 ? 0 : ((p) == 2 ? 1 : ((p) == 7 ? 2 : ((p) == 8 ? 3 : ((p) == 735 ? 4 : NOT_AN_INTERRUPT)))))
 #else
  // Everything else (including Due and Teensy) interrupt number the same as the interrupt pin number
  #define digitalPinToInterrupt(p) (p)
 #endif
#elif defined(__SAMD21__) || defined (__SAMD51__) //Arduino.h in most/all cores wrongly "#define digitalPinToInterrupt(P) (P)" after calling variant.h
  #define digitalPinToInterrupt(P)   (g_APinDescription[P].ulExtInt)
#endif

// On some platforms, attachInterrupt() takes a pin number, not an interrupt number
#if (RF69_PLATFORM == RF69_PLATFORM_ARDUINO) && defined (__arm__) && (defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_SAM_DUE))
 #define RF69_ATTACHINTERRUPT_TAKES_PIN_NUMBER
#endif
////////////////////////////////////////////////////

//#define RF69_SPI_CS             SS // SS is the SPI slave select pin, for instance D10 on ATmega328

// INT0 on AVRs should be connected to RFM69's DIO0 (ex on ATmega328 it's D2, on ATmega644/1284 it's D2)
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega88) || defined(__AVR_ATmega8__) || defined(__AVR_ATmega88__)
  #define RF69_IRQ_PIN          2
#elif defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)
  #define RF69_IRQ_PIN          2
#elif defined(__AVR_ATmega32U4__)
  #define RF69_IRQ_PIN          7
#elif defined(__STM32F1__)
  #define RF69_IRQ_PIN          PA3
#elif defined(MOTEINO_M0)
  #define RF69_IRQ_PIN          9
#elif defined(ARDUINO_SAMD_ZERO) //includes Feather SAMD
  #define RF69_IRQ_PIN          3
#elif defined(ESP8266)
  #define RF69_IRQ_PIN          4
  #define RF69_SPI_CS           15
#else
  #define RF69_IRQ_PIN          2
#endif

The pin defines appear to be all over the place depending on platform and chipset. Do I need to add something in there perhaps for the Artemis? How does one go about scanning for which platform or chipset it sees? When I check for board info in Arduino IDE, I get this message:

BN: Unknown board
VID: 1A86
PID: 7523
SN: Upload any sketch to obtain it

I am not sure if I can implement the board info provided into the library.

I do have a digital multimeter, and I will check the next time I have some time to sit down with it all next weekend.

Okay, looking forward to seeing what you find out