I have a new Raspberry Pi 3 B+ model. I also bought a few nrf24l01+ modules.
I hooked up one of the nrf24l01+ modules to my RPi with these connections:
RPi | nrf24l01+
-------|----------
3.3 | VCC
GND | GND
GPIO8 | CSN
GPIO17 | CE
GPIO10 | MOSI
GPIO09 | MISO
GPIO11 | SCK
I downloaded the BLavery library for RPi from here: https://github.com/BLavery/lib_nrf24 . I then moved the file lib_nrf24.py
to my working directory at ~/projects/helloworld/lib_nrf24.py
.
I then created a file called ~/projects/helloworld/receiver.py
and placed the following code:
import RPi.GPIO as GPIO
from lib_nrf24 import NRF24
import time
import spidev
GPIO.setmode(GPIO.BCM)
pipes = [[0xE8, 0xE8, 0xF0, 0xF0, 0xE1],[0xF0, 0xF0, 0xF0, 0xF0, 0xE1]]
radio = NRF24(GPIO, spidev.SpiDev())
radio.begin(0,17)
radio.setPayloadSize(32)
radio.setChannel(0x76)
radio.setDataRate(NRF24.BR_1MBPS)
radio.setPALevel(NRF24.PA_MIN)
radio.setAutoAck(True)
radio.enableDynamicPayloads()
radio.enableAckPayload()
radio.openReadingPipe(1,pipes[1])
radio.printDetails()
radio.startListening()
When I run the command python3 ~/projects/helloworld/receiver.py
, I get this output:
STATUS = 0x03 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=1 TX_FULL=1
RX_ADDR_P0-1 =
0xfdfdfdfdfd 0xfefefefefc
RX_ADDR_P2-5 =
0xf8
0xf9
0xf9
0xf9
TX_ADDR =
0xfdfdfdfdfd
RX_PW_P0-6 =
0x00
0x0c
0x00
0x00
0x00
0x00
EN_AA =
0x0f
EN_RXADDR =
0x00
RF_CH =
0x1f
RF_SETUP =
0x00
CONFIG =
0x03
DYNPD/FEATURE =
0x03
0x01
Data Rate = 1MBPS
Model = nRF24L01
CRC Length = Disabled
PA Power = PA_MIN
My question is why does the output show RX_ADDR_P0-1 = 0xfdfdfdfdfd 0xfefefefefc
when I wrote [0xF0, 0xF0, 0xF0, 0xF0, 0xE1]
, and why does the output show RF_CH = 0x1f
when I wrote radio.setChannel(0x76)
?
I noticed that BLavery stopped supporting the lib_nrf24 library a few months before my RPi 3 B+ was released. Would this have anything to do with my problem? Is there another practical way to use the nrf24l01 module with my RPi 3 B+?
Note: this is part of my investigation into why the RPi 3 B + is not receiving any payload from my arduinos that are transmitting with an nrf24l01 module. I got two arduinos to talk to each other with nrf24l01. So my next step is to get arduino to RPi working.
Raspberry/librf24-bcm/
. I don't see that directory in the tmrh20 library or theRaspberry-master
that I downloaded in Step 3. – John Feb 18 '19 at 14:14https://github.com/mysensors/Raspberry/archive/master.zip
and don't see anylibrf24-bcm
– John Feb 18 '19 at 14:21