So i changed the pi I was using to a newer one (pi 5). Since it doesnt support the old gpio tools, i am now using a different module (circuitpython_nrf24l01). I have succeeded in getting the print_details() right, however i have not yet succeeded in achieving any communication between the 2 devices. I haven't changed anything on the arduino side (receiver), have adapters on both devices and made sure all the wiring is correct.
Updated pi code:
import gpiozero
import keyboard
import time
import sys
import tty
import termios
from digitalio import DigitalInOut
import spidev
from circuitpython_nrf24l01.rf24 import RF24
import board
print("running controller.py")
pipes = [[0xe7, 0xe7, 0xe7, 0xe7, 0xe7]]
SPI_BUS = spidev.SpiDev()
CSN_PIN = 0
CE_PIN = DigitalInOut(board.D22)
pitch = 0
roll = 0
yaw = 0
radio = RF24(SPI_BUS, CSN_PIN, CE_PIN)
radio.pa_level = -12
radio.channel = 76
radio.open_tx_pipe(pipes[0])
radio.dynamic_payloads = False
radio.payload_length = 32
radio.listen = False
radio.print_details(dump_pipes=True)
def send_message(radio, message: bytes) -> bool:
if isinstance(message, str):
message = message.encode("utf-8")
print("step 1")
if not radio.write(message):
print("Message failed to send.")
return None
print("step 2")
if radio.ack:
payload = radio.read()
print("ACK payload received:", payload)
return payload
print("Message sent, no ACK payload.")
return None
while True:
print("trying to send")
send_message(radio, "Hello world")
time.sleep(1)
Print details before the write() is called (on the pi):
Is a plus variant True
Channel 76 ~ 2.476 GHz
RF Data Rate 1 Mbps
RF Power Amplifier -12 dBm
RF Low Noise Amplifier Enabled
CRC bytes 2
Address length 5 bytes
TX Payload lengths 32 bytes
Auto retry delay 1500 microseconds
Auto retry attempts 15 maximum
Re-use TX FIFO False
Packets lost on current channel 0
Retry attempts made for last transmission 0
IRQ on Data Ready Enabled Data Ready False
IRQ on Data Fail Enabled Data Failed False
IRQ on Data Sent Enabled Data Sent False
TX FIFO full False TX FIFO empty True
RX FIFO full False RX FIFO empty True
Ask no ACK Allowed Custom ACK Payload Disabled
Dynamic Payloads Disabled Auto Acknowledgment Enabled
Primary Mode TX Power Mode Standby-I
TX address 0xE7E7E7E7E7
Pipe 0 ( open ) bound: 0xE7E7E7E7E7
expecting 32 byte static payloads
Pipe 1 (closed) bound: 0xC2C2C2C2C2
Pipe 2 (closed) bound: 0xC2C2C2C2C3
Pipe 3 (closed) bound: 0xC2C2C2C2C4
Pipe 4 (closed) bound: 0xC2C2C2C2C5
Pipe 5 (closed) bound: 0xC2C2C2C2C6
after the write() function is called (on the pi):
Is a plus variant True
Channel 76 ~ 2.476 GHz
RF Data Rate 1 Mbps
RF Power Amplifier -12 dBm
RF Low Noise Amplifier Enabled
CRC bytes 2
Address length 5 bytes
TX Payload lengths 32 bytes
Auto retry delay 1500 microseconds
Auto retry attempts 15 maximum
Re-use TX FIFO False
Packets lost on current channel 0
Retry attempts made for last transmission 0
IRQ on Data Ready Enabled Data Ready False
IRQ on Data Fail Enabled Data Failed False
IRQ on Data Sent Enabled Data Sent False
TX FIFO full True TX FIFO empty False
RX FIFO full False RX FIFO empty True
Ask no ACK Allowed Custom ACK Payload Disabled
Dynamic Payloads Disabled Auto Acknowledgment Enabled
Primary Mode TX Power Mode Standby-II
and the arduino output is the same as before (not receiving anything):
RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR = 0xe7e7e7e7e7
RX_PW_P0-6 = 0x20 0x20 0x20 0x20 0x20 0x20
EN_AA = 0x3f
EN_RXADDR = 0x03
RF_CH = 0x76
RF_SETUP = 0x05
CONFIG = 0x0f
DYNPD/FEATURE = 0x03 0x06
Data Rate = 1 MBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_HIGH
ARC = 0
My main problem right now is that i do not know where the problem is occuring and if the transmitter or receiver isn't working.