nrf24l01 sets pins high on start

Hi There,

I have been playing around with some the nrf24l01+ modules. I am using tmr20 library.

Has anyone come across this?

When the radio is started with radio.begin() it sets the output on pin 10 to high. This happens with radio installed or with radio disconnected.

I can write pin 10 low again immediately after radio.begin() but it still flashes for a sec.
I wrote a simple sketch to test this. Even if you don’t have a nrf24l01 to test you can run this sketch pin goes HIGH at radio.begin.

Also with no radio installed radio.available() returns TRUE or 1.

Anyone know whats going on?

#include <nRF24L01.h>
#include <RF24.h>

#define CE_PIN   7
#define CSN_PIN 8



const uint64_t pipe = 0xE8E8F0F0E1LL; // Define the transmit pipe
RF24 radio(CE_PIN, CSN_PIN); // Create the Radio

int joystick[2];  // 2 element array for Joystick

void setup()   
{

  
  Serial.begin(9600);
  delay(1000);
  Serial.println("Nrf24L01 Receiver Starting");
  radio.begin();
  radio.setPALevel(RF24_PA_MAX);                        // Max transmit level
  radio.setDataRate(RF24_250KBPS);                      // Lower data rate for range
  radio.openReadingPipe(1, pipe);
  radio.startListening();
  //  digitalWrite(10,LOW);  set to low but still flashes high when radio turning on.
}



void loop()   
{

  Serial.println(radio.available()); //returns true when no radio installed Why?
  
  while (radio.available()) {

           
    radio.read(joystick, sizeof(joystick));
    Serial.println(joystick[1]);
    delay(15);

  }

  Serial.println("No radio available");
  delay(15);
}

I think it is caused by the SPI hardware driver which uses pin 10 for an initial master-slave communication setup.

Pin 10 of the Arduino is the SS line - so does this mean you have to use it for the peripheral SS line? Or should it be kept high? The answer (from the Atmega documentation) is that the SS line (pin 10) must be configured as an output (regardless of what value is on it). If configured as an output the Arduino ignores the value on that line, and thus the SPI hardware will not be put into slave mode.

from Gammon Forum : Electronics : Microprocessors : SPI - Serial Peripheral Interface - for Arduino

Whandall.. Your are right.. many thanks! I was looking in the wrong place.

I just added

pinMode(10, OUTPUT);

All is well, Pin 10 stays low now.