I'd like to have my Raspberry Pi sending to an Arduino. The Pi will be retrieving and distilling some stats and the Arduino will be, basically, using Servos to turn big dials on a display board we will be building.
I have had no problem getting another Arduino to talk to the Arduino that will eventually be my controller. I get 100% reliable transmissions (especially after putting a cap across Vcc-GND on the receiver) this way. However .. the Pi's transmissions are never received.
I took a register dump of the successful Arduino sender and compared with a register dump on Pi after config setup. I did a little bit of tweaking to get them identical but no joy. Now, as I can read and write the registers fine I know that SPI is working. I wired up an LED across CE and I can see this going high during transmission, so I know that's good. On the receiver Arduino I have it turn on an LED when the carrier bit is high, and I can see that come on while the RPi is transmitting.
So, everything says it ought to be working, but it's not.
Here is a register dump on the receiver:
Radio open!
Max message length:
28
0: C
1: 3F
2: 3
3: 3
4: 3
5: 64
6: F
7: E
8: 0
9: 0
A: E7 E7 E7 E7 E7
B: C2 C2 C2 C2 C2
C3
C4
E: C5
F: C6
10: E7 E7 E7 E7 E7
11: 0
12: 0
13: 0
14: 0
15: 0
16: 0
17: 11
1C: 3F
1D: 5
Here is a register dump from an Arduino acting as transmitter (sorry, image), that was received perfectly by the receiver above:
And here is the register dump off the Pi after I configure it:
STATUS (07) = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 (0A, 0B) = 0xe7e7e7e7e7 0xc2c2c2c2c2
RX_ADDR_P2-5 (0C-0F) = 0xc3 0xc4 0xc5 0xc6
TX_ADDR (10) = 0xe7e7e7e7e7
RX_PW_P0-6 (11-16) = 0x00 0x00 0x00 0x00 0x00 0x00
EN_AA (01) = 0x3f
EN_RXADDR (02) = 0x03
RF_CH (05) = 0x64
RF_SETUP (06) = 0x0f
SETUP_AW (03) = 0x03
OBSERVE_TX (08) = 0x00
CONFIG (00) = 0x0e
FIFO_STATUS (17) = 0x11
DYNPD (1C) = 0x3f
FEATURE (1D) = 0x05
Data Rate = 2MBPS
Model = nRF24l01+
CRC Length from CONFIG register
CRC Length = 16 bits
PA Power = PA_MAX
I'm using the latest version of the nrf24.py library unmodified except to put the register addresses along with the names so that I can compare them with the Arduino more easily.
Finally, here is the important part of the Python code:
pipes = [[0xc2, 0xc2, 0xc2, 0xc2, 0xc2], [0xe7, 0xe7, 0xe7, 0xe7, 0xe7]]
if name == 'main':
radio = NRF24()
#### Lib uses BCM numbering -- BCM 16 == BOARD 27
radio.begin(0, 0, 16, 28) #Set CE and IRQ pins
radio.powerUp()
radio.setChannel(100)
radio.setDataRate(NRF24.BR_2MBPS)
radio.setPALevel(NRF24.PA_MAX)
radio.enableDynamicPayloads()
radio.setAutoAck(1)
radio.setRetries(0, 3)
radio.openWritingPipe(pipes[1])
radio.openReadingPipe(1, pipes[0])
radio.openReadingPipe(0, pipes[1])
setup = radio.read_register(NRF24.RF_SETUP)
print "SETUP: " + str(setup)
setup = setup | 0x01
radio.write_register(NRF24.RF_SETUP, setup)
feature = radio.read_register(NRF24.FEATURE)
print "FEATURE: " + str(feature)
feature = feature | 0x01
radio.write_register(NRF24.FEATURE, feature)
radio.printDetails()
print 'Sending ping message'
radio.write('PING')
Any ideas?