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.
code