Difficulty in connecting Nrf24L01+ to Boron via SPI

I am unable to get a Boron to connect to a NRF24L01+ via SPI. After reading the Boron documentation and Community articles and examples regarding SPI and the Boron I have not been able to identify the issue.

Using an adapter to ease connections between the Boron and the NRF24L01+. I tried multiple new Boron BRN404X, various NRF24L01+ board and the adapters.

Various combinations of the adapters and NRRF24L01+. which are all able to communicate when connected an Arduino (Lolin D1 Mini Pro). But, always hang at the radio.begin() with any Boron.

What am I missing? Any suggestions? Thanks!

  1. Boron BRN404X w/OS 6.1.1
  2. Connected as described in the code and shown in the photos (SPI0)
  3. Using particle-rf24 (0.0.2) library
  4. Connected the NRF24L01+ to Boron via using an adapter board
  5. Debug attempts: Added delay(100) with and without Serial.print statements within the while radio.begin() loop to be sure I knew where it hung.
  6. Tried both with and without a battery attached
  7. Tried tweaking the Spark_GettingStartedRF24.cpp with both the SparkCore-RF24 (it does not wait for radio.begin()) and particle-rf24 libraries.

Simple SPI/radio connection test code

// Include Particle Device OS APIs
#include "Particle.h"
#include <particle-rf24.h>

SYSTEM_MODE(AUTOMATIC);

SerialLogHandler logHandler(LOG_LEVEL_INFO);

/*   
    Boron 404X 
      Signals              |   Pin   | Wire Color |    Adapter Pin |  NRF24L01+
 --------------------------------------------------------------------------------------------
  GND                         GND     Black             GND            1 GND
  3V3 (3.3V)                 3.3v     Red               Vcc            2 VCC
  
  A4/D15                     15       Grey              CE              3 CE
  A5/D14  (SPI_SS)           14       White             CSN            4 CSN
  SCK/D13 (SPI_SCK)          13       Dk Blue           SCK            5 SCK
  MO/D12  (SPI_MOSI)         12       Red               MO             6 MO
  MI/D11  (SPI_MISO)         11       Yellow/Blue       MI             7 MI
*/  

#include <SPI.h>
#include <nRF24L01.h>

RF24 radio(A4, A5); // CE, CSN

const byte address[6] = "00001";

void setup() {
  
  Serial.begin(115200);
  while (!Serial) { }
  Serial.println("Version 0.01d");

  while (!radio.begin()){}
   
  Serial.println("Connected SPI");
  radio.openWritingPipe(address);
  radio.setPALevel(RF24_PA_MIN);
  radio.stopListening();
}

void loop() {
  const char text[] = "Hello World";
  radio.write(&text, sizeof(text));
  Serial.println("Sent");
  delay(1000);
}

@HiTechie, I believe the problem is in radio.begin() which is supposed to return a non-zero value if all goes well. However, the code in the begin() function has a section commented out and the variable which is supposed to be set to indicate the nrf24 was detected is NOT! So the function will always return zero and while(radio.begin()){} will loop forever. Try simply calling radio.begin(); instead and see how far you get.

2 Likes

It works. Everything is now communicating with NRF24L01+. Appreciate the fast response. A bit nervous that it may continue even if the radio is not ready. But, if that happens I can try to modify the library.

2 Likes