2

I got a Raspberry Pi B 512MB RAM and hooked up a NRF24l01. Now using the TMRh20 library I wanted to configure the radio as followed:

#!/usr/bin/env python

from __future__ import print_function
import time
import sys
from RF24 import *
import RPi.GPIO as GPIO

irq_gpio_pin = None

try:
        radio = RF24(RPI_V2_GPIO_P1_15, BCM2835_SPI_CS0, BCM2835_SPI_SPEED_8MHZ)
        pipes = [0xF0F0F0F0E1, 0xF0F0F0F0D2]

        print('pyRF24 - testing')
        radio.begin()
        radio.setChannel(60);
        radio.setDataRate(RF24_2MBPS);
        radio.setPALevel(RF24_PA_MIN);
        radio.setAutoAck(True);
        radio.enableDynamicPayloads();
        radio.enableAckPayload();
        radio.setRetries(5,15)

        radio.printDetails()
        radio.openReadingPipe(1,pipes[0])

        radio.startListening()
        print("Started to listen..")

        while True:
                [... stuff ...]
except KeyboardInterrupt:
        print("\nProgram manually interupted.")
except:
        print("\nUnexpected error:", sys.exc_info())
finally:
        GPIO.cleanup() # this ensures a clean exit 

Looking at the output of radio.printDetails() it seems like nothing changed (e.g. PA_Power still max and data rate at 1MBPS).

pyRF24 - testing
================ SPI Configuration ================
CSN Pin      = CE0 (PI Hardware Driven)
CE Pin       = Custom GPIO22
Clock Speed  = 8 Mhz
================ NRF Configuration ================
STATUS       = 0xff RX_DR=1 TX_DS=1 MAX_RT=1 RX_P_NO=7 TX_FULL=1
RX_ADDR_P0-1     = 0xffffffffff 0xffffffffff
RX_ADDR_P2-5     = 0xff 0xff 0xff 0xff
TX_ADDR      = 0xffffffffff
RX_PW_P0-6   = 0xff 0xff 0xff 0xff 0xff 0xff
EN_AA        = 0xff
EN_RXADDR    = 0xff
RF_CH        = 0xff
RF_SETUP     = 0xff
CONFIG       = 0xff
DYNPD/FEATURE    = 0xff 0xff
Data Rate    = 1MBPS
Model        = nRF24L01
CRC Length   = 16 bits
PA Power     = PA_MAX

I tried similar stuff with C++ and had the same effect. Also I googled about it, but couldn't find related problems. Therefor I think, that I got a stupid mistake that I'm currently unable to see.

So my question is: What am I doing wrong here? How to configure the radio object?

JustCoding
  • 121
  • 2

1 Answers1

1

This answer fixed my issues

In lib_nrf24.py in function:

def begin(self, csn_pin ... after self.spidev.open add:

self.spidev.max_speed_hz = 4000000
Jak
  • 131
  • 2