Cannot use nrf24 on Seeed Xiao ESP32-C5
Hello everyone.
I just got a xiao mcu to use with a nrf24 as receiver. I spent the whole day trying to figure out how to set it up, to no avail.
So far, here is my code (below). I finally have SPI OK, after setting manually every pin. But I get Radio Fail and nRF FAIL as well. The wiring obviously is pristine and has been checked more times than I dare to say.
Any help or hint would be appreciated, thanks in advance !
Edit : Output is :
SPI OK
RADIO FAIL
nRF FAIL
DETAILS
SPI Speedz = 10 Mhz
STATUS = 0x00 RX_DR=0 TX_DS=0 TX_DF=0 RX_PIPE=0 TX_FULL=0
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
===
#include <SPI.h>
#include <RF24.h>
#include <nRF24L01.h>
#define CE_PIN D6
#define CSN_PIN D5
#define SCK_PIN D8
#define MISO_PIN D9
#define MOSI_PIN D10
const byte thisSlaveAddress[6] = "00001";
RF24 radio(CE_PIN, CSN_PIN);
char dataReceived[12]; // this must match dataToSend in the TX
SPIClass spi(FSPI);
//===========
void setup()
{
pinMode(CE_PIN, OUTPUT);
pinMode(CSN_PIN, OUTPUT);
pinMode(MOSI_PIN, OUTPUT);
pinMode(SCK_PIN, OUTPUT);
pinMode(MISO_PIN, INPUT);
Serial.begin(9600);
delay(3000);
bool okspi = spi.begin(SCK_PIN, MISO_PIN, MOSI_PIN, CSN_PIN);
Serial.println(okspi ? "SPI OK" : "SPI FAIL");
bool ok = radio.begin(&spi);
Serial.println(ok ? "RADIO OK" : "RADIO FAIL");
bool okchip = radio.isChipConnected();
Serial.println(okchip ? "nRF OK" : "nRF FAIL");
radio.setPALevel(RF24_PA_MIN);
radio.setDataRate( RF24_1MBPS);
radio.openReadingPipe(1, thisSlaveAddress);
radio.startListening();
Serial.println("DETAILS");
radio.printDetails();
Serial.println("===");
}
//=============
void loop()
{
if (radio.available()) {
radio.read(&dataReceived, sizeof(dataReceived));
//Serial.println(dataReceived);
delay(1000);
}
}