1

I can use the nrf24l01 wireless module just fine with a Raspberry Pi Pico, but when I try to compile the same code on the Raspberry Pi Pico W, it fails to recognize the device. I am using this library, and I get this error:

Traceback (most recent call last):
File "<stdin>", line 31, in <module>
File "nrf24l01.py", line 78, in __init__
OSError: nRF24L01+ Hardware not responding

The boards are supposed to have the same footprint, so what is the difference here? How can I use these modules with the Pico W?

2 Answers 2

1

How I got passed that error, is by defining the pins myself. Something like this:

spi_sck=machine.Pin(6) #or whichever pin you're using for sck
spi_mosi=machine.Pin(7) #or whichever pin you're using for mosi
spi_miso=machine.Pin(4) #or whichever pin you're using for miso
machine.SPI(0,baudrate=4000000,sck=spi_sck, mosi=spi_mosi, miso=spi_miso)

If you do that though, you'll need to change these lines:

csn = Pin(cfg["csn"], mode=Pin.OUT, value=1)
ce = Pin(cfg["ce"], mode=Pin.OUT, value=0)
spi = cfg["spi"]
nrf = NRF24L01(spi, csn, ce, payload_size=8)

to something like this:

csn = Pin(14, mode=Pin.OUT, value=1) #or whichever pin you're using for csn
ce = Pin(17, mode=Pin.OUT, value=0) #or whichever pin you're using for ce
nrf = NRF24L01(SPI(0), csn, ce, payload_size=8)
2
  • Have you got the nrf24l01 working successfully on Pico?
    – Marin
    Feb 2, 2023 at 5:03
  • I didn't try it on a Pico, only a Pico W. I'm not sure if the transmitter is working and the receiver isn't, or if nothing is. That post was only saying how I got passed the error, because I had the same problem. But mine still isn't working.
    – user151834
    Feb 2, 2023 at 15:41
0

I fixed it by getting a new nrf24l01 module from SparkFun. Don't use the cheap ones off amazon.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.