3

I'm working on a project where i have a Raspberry pi Pico connected to a NRF24l01+ to send some data.

However i'm not recieving any data on the reciever and i think that its because the SPI bus is not getting initialised propperly.

I have tested this code to try and troubleshoot the error

/*
  If your serial output has these values same then Your nrf24l01 module is in working condition :
  
  EN_AA          = 0x3f
  EN_RXADDR      = 0x02
  RF_CH          = 0x4c
  RF_SETUP       = 0x03
  CONFIG         = 0x0f
  
  This code is under public domain
  
  Last updated on 21/08/28 
  https://dhirajkushwaha.com/elekkrypt
 */

#include <SPI.h>
#include <RF24.h>
#include <printf.h>

RF24 radio(12, 5);

byte addresses[][6] = {"1Node", "2Node"};


void setup() {
  Serial.begin(9600);
  delay(5000);
  SPI.begin();
  Serial.println("start");
  radio.begin();
  radio.setPALevel(RF24_PA_LOW);
  
  radio.openWritingPipe(addresses[0]);
  radio.openReadingPipe(1, addresses[1]); 
  radio.startListening();
  printf_begin();

  radio.printDetails();
  
}

void loop() {
//  empty

}

And i'm recieving this as output

start
SPI Speedz  = 10 Mhz
STATUS      = 0x00 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=0 TX_FULL=0
RX_ADDR_P0-1    = 0x0000000000 0x0000000000
RX_ADDR_P2-5    = 0x00 0x00 0x00 0x00
TX_ADDR     = 0x0000000000
RX_PW_P0-6  = 0x00 0x00 0x00 0x00 0x00 0x00
EN_AA       = 0x00
EN_RXADDR   = 0x00
RF_CH       = 0x00
RF_SETUP    = 0x00
CONFIG      = 0x00
DYNPD/FEATURE   = 0x00 0x00
Data Rate   = 1 MBPS
Model       = nRF24L01+
CRC Length  = Disabled
PA Power    = PA_MIN
ARC     = 0

which doesnt look good...

I have checked the pins with my oscilloscope and appart from some activity on the CSN line i'm not seeing any data over the other pins at all. This is leading me to believe that the pico is not initialising the SPI bus in the correct way.

These are my connections:

VCC (nRF24L01) => 3.3V output (Raspberry Pi Pico).
GND (nRF24L01) => GND (Raspberry Pi Pico).
SCK (nRF24L01) => GP6 (Raspberry Pi Pico).
MOSI (nRF24L01) => GP7 (Raspberry Pi Pico).
MISO (nRF24L01) => GP4 (Raspberry Pi Pico).
IRQ (nRF24L01) => not connected
CE (nRF24L01) => GP12 (Raspberry Pi Pico).
CSN (nRF24L01) => GP5 (Raspberry Pi Pico

If anyone could help me out with this that would be greatly appreciated i need this thing to work really badly.

5
  • always format printout messages as code
    – jsotola
    Apr 15 at 16:51
  • If you are using the Arduino-Pico framework, the default SPI0 is not at the pins that you were expecting at, see the SPI0 pin assignments settings for the framework for generic Pico board, which is consists to the pin diagram of default SPI0.
    – hcheung
    Apr 18 at 2:14
  • @hcheung Hi, I am currently running into the same problem. I am using a diffrent core (platform io), but couldn't find any pins definition when exploring the files. Do you know if this also happens with other libraries ? Thanks
    – BruceWawe
    Jul 27 at 20:23
  • @BruceWawe, there are basically two popular Arduino Cores, ArduinoCore-mbed from Arduino C.C. and Arduino Pico core from Earle Philhower. Unfortunately PlatformIO only supports ArduinoCore-mbed. ArduinoCore-mbed pin definitions and supported boards can be find here.
    – hcheung
    Jul 28 at 0:31
  • @hcheung Many thanks ! I couldn't find the right GitHub !
    – BruceWawe
    Jul 28 at 9:12

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.