Jump to content

Orange Pi One with nrf24l01


tao

Recommended Posts

I'm trying to get an nrf24l01 radio to work on my Orange Pi One but have not been successful.  I'll document what I've done here.  If you spot an error, please let me know.

 

Start with fresh Armbian_5.20_Orangepione_Debian_jessie_3.4.112 image.  Then apt-date update and apt-get upgrade.

 

Attached nrf24l01 like this (pictures of header and radio are attached for verification);

nrf24l01  color    opo pin  opo fn
1 GND     blk        25     ground
2 VCC     red        17     3v3
3 CE      org        29     PA7
4 CSN     ylw        24     CS0 (SPI-CE0)
5 SCK     grn        23     SCLK
6 MOSI    blu        19     MOSI
7 MISO    mag        21     MISO
8 IRQ     n/c

git clone https://github.com/TMRh20/RF24

cd RF24

./configure

make

make install

cd examples_linux

 

edit gettingstarted.cpp

  comment line 49 RF24 radio(22,0);

  add line 70 RF24 radio(7,0);

diff gettingstarted.cpp gettingstarted.cpp.orig
49c49
< // RF24 radio(22,0);
---
> RF24 radio(22,0);
70d69
< RF24 radio(7,0);

make gettingstarted

run gettingstarted ./gettingstarted

./gettingstartedRF24/examples/GettingStarted/
STATUS           = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1     = 0x65646f4e32 0x65646f4e31
RX_ADDR_P2-5     = 0xc3 0xc4 0xc5 0xc6
TX_ADDR          = 0x65646f4e32
RX_PW_P0-6       = 0x20 0x20 0x00 0x00 0x00 0x00
EN_AA            = 0x3f
EN_RXADDR        = 0x02
RF_CH            = 0x4c
RF_SETUP         = 0x07
CONFIG           = 0x0e
DYNPD/FEATURE    = 0x00 0x00
Data Rate        = 1MBPS
Model            = nRF24L01+
CRC Length       = 16 bits
PA Power         = PA_MAX

 ************ Role Setup ***********
Choose a role: Enter 0 for pong_back, 1 for ping_out (CTRL+C to exit)
>1
Role: Ping Out, starting transmission

Now sending...failed.
Failed, response timed out.
Now sending...failed.
Failed, response timed out.
Now sending...failed.
Failed, response timed out.

I'm certain I'm making a fundamental error but I cannot see it yet.  The initial details printed by the program make me think it's found the radio and can interact, but it stays in a sending...failed loop until stopped.

 

The armbianmonitor -u for the system is http://sprunge.us/QVhS

 

 

 

post-2023-0-01132700-1483033540_thumb.jpg

post-2023-0-40880300-1483033549_thumb.jpg

Link to comment
Share on other sites

Please try reducing the transmit power - these modules are known for instability with insufficient power supply or relatively long power cables when using HIGH or MAX power levels.

Soldering a ceramic 0.1uF capacitor or a tantalum capacitor directly to module pins (on top) may help too.

I tested it some time ago and it worked for me: https://github.com/TMRh20/RF24/issues/257

Link to comment
Share on other sites

I added a 0.1uF cap across VCC and GND on the top of the nrf24l01. I also added code to lower the transmit power right after radio.begin.

// Setup and configure rf radio  
radio.begin();  
radio.setPALevel(RF24_PA_MIN);

Selecting 1 for ping_out with gettingstarted still fails:

Now sending...
failed.
Failed, response timed out.
Now sending...
failed.
Failed, response timed out.

I've attached a picture of the soldered cap across VCC and GNC on top of the nrf24l01.  I know ... I was a liberal arts major and have been working to improve my soldering skills bit by bit but I have a lot of room for improvement.

 

post-2023-0-69794700-1483041008_thumb.jpg

Link to comment
Share on other sites

I have two identical setups, both on my desk.  I'm not sure what you mean by registers dumps, but in case that data is included in the details printed by gettingstarted I've included that information below.

 

orange pi one #1  (rx mode)

./gettingstarted
RF24/examples/GettingStarted/
STATUS           = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1     = 0xe7e7e7e7e7 0xc2c2c2c2c2
RX_ADDR_P2-5     = 0xc3 0xc4 0xc5 0xc6
TX_ADDR          = 0xe7e7e7e7e7
RX_PW_P0-6       = 0x00 0x00 0x00 0x00 0x00 0x00
EN_AA            = 0x3fE
N_RXADDR         = 0x03
RF_CH            = 0x4c
RF_SETUP         = 0x01
CONFIG           = 0x0e
DYNPD/FEATURE    = 0x00 0x00Data 
Rate             = 1MBPS
Model            = nRF24L01+
CRC Length       = 16 bitsPA 
Power            = PA_MIN
 ************ Role Setup ***********
Choose a role: Enter 0 for 
pong_back, 1 for ping_out (CTRL+C to exit)
>0
Role: Pong Back, awaiting transmission

orange pi one #2  (tx mode)

./gettingstarted
RF24/examples/GettingStarted/
STATUS           = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1     = 0x65646f4e32 0x65646f4e31
RX_ADDR_P2-5     = 0xc3 0xc4 0xc5 0xc6
TX_ADDR          = 0x65646f4e32
RX_PW_P0-6       = 0x20 0x20 0x00 0x00 0x00 0x00
EN_AA            = 0x3f
EN_RXADDR        = 0x02
RF_CH            = 0x4c
RF_SETUP         = 0x01
CONFIG           = 0x0e
DYNPD/FEATURE    = 0x00 0x00
Data Rate        = 1MBPS
Model            = nRF24L01+
CRC Length       = 16 bitsPA 
Power            = PA_MIN
 ************ Role Setup ***********
Choose a role: Enter 0 for pong_back, 1 for ping_out (CTRL+C to exit)
>1
Role: Ping Out, starting transmission
Now sending...
failed.
Failed, response timed out.
Now sending...
failed.
Failed, response timed out.
Link to comment
Share on other sites

As you can see, RX_ADDR and TX_ADDR pairs are different. You need to make sure that RX_ADDR (RX_ADDR_P0-1)on one device matches TX_ADDR on the other device and the other way around.

 

Edit: 0x65646f4e32 is "2Node", 0xe7e7e7e7e7 and 0xc2c2c2c2c2 don't look right unless you changed default strings to byte arrays, but it may indicate hardware issues like power supply problem or software issues like different library version.

Link to comment
Share on other sites

I'd like to pretend the following didn't happen, but it's important to admit when responsible for dumb things.

 

You hit it on the mark.  I didn't make the radio number unique.  Changed the following value for each radio, and now they communicate like champs.

 

/********** User Config *********/
// Assign a unique identifier for this node, 0 or 1
bool radioNumber = 0;

 

Thank you for your help.  I'm completely new to the RF24 world so I've spent a lot of time messing around.  I hope to make a network of sensors and wanted to use my orange pi one as the gateway.  And this was the first step.

Link to comment
Share on other sites

I face with a problem using OrangePi Zero. There is no gpio22 as well as IO-7, so I can not use "RF24 radio(7,0)". 

I'm a beginner with Orange, and have some questions. I would be happy to be these questions answered)

1. Which pins can I put in this function (radio(?,?))

2. What are these pins? Are they simply phisical numbers of H2+ processor? Or they are GPIO pins? 

Link to comment
Share on other sites

Hi, martinayoutte!

Thanks for your answer!

But there is no problems with nrf24l01, its pins and so on. There are problems with Orange Pi Zero. 

In RF24 libruary there is function radio(ce_pin, csn_pin). The arguments are pins.

For example, in the code there was:

      RF24 radio(7,0);

That does not mean that GPIO.7 is CE-pin and not GPIO.0 is CSN-pin.

Actually, "0" means CE0-pin on Orange Pi Zero.

Here is the problem.  I don't kow what to write instead of "7".

What I know is that arguments are not GPIO names of pins and not H2+ numbers of pins. So, what are they?

Link to comment
Share on other sites

34 minutes ago, ccc_ffs said:

Here is the problem.  I don't kow what to write instead of "7".

What I know is that arguments are not GPIO names of pins and not H2+ numbers of pins. So, what are they?

https://linux-sunxi.org/Orange_Pi_Zero#Expansion_Port

Use the numbers from GPIOx names (i.e.198 from GPIO198), or convert the SoC pin names (like PA7 or PG6) to numbers directly: https://linux-sunxi.org/GPIO#Accessing_the_GPIO_pins_through_sysfs_with_mainline_kernel

Link to comment
Share on other sites

Thanks, tested all GPIOx.

Unfortunately, after starting "gettingstarted.cpp":

./gettingstarted

i saw this in my terminal:

STATUS		 = 0x00 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=0 TX_FULL=0
RX_ADDR_P0-1	 = 0x0000000000 0xff00000000
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		 = 0x00
RF_SETUP	 = 0x00
CONFIG		 = 0x00
DYNPD/FEATURE	 = 0x00 0x00
Data Rate	 = 1MBPS
Model		 = nRF24L01
CRC Length	 = Disabled
PA Power	 = PA_MIN

 ************ Role Setup ***********
Choose a role: Enter 0 for pong_back, 1 for ping_out (CTRL+C to exit) 
>1
Role: Ping Out, starting transmission 

Now sending...
RF24 HARDWARE FAIL: Radio not responding, verify pin connections, wiring, etc.
RF24 HARDWARE FAIL: Radio not responding, verify pin connections, wiring, etc.

As I understood, all the addresses can not be known because of wrong connection with NRF24L01+. 

I definitely have no idea how to fix it.

In gettingstarted.cpp:

RF24 radio(7,0);

Connections:

NRF24L01+   ----- NRF func ----- Orange Pi Zero ----- Orange func

      1                       GND                 9                         GND

      2                       VCC                  1                         3.3 v

      3                       CE                    12                       PA07 / GPIO7

      4                       CSN                  13                       PA00 / GPIO0

      5                       SCK                  23                       SPI1_CLK / PA14 / GPIO14

      6                       MOSI                19                       SPI1_MOSI / PA15 / GPIO15

      7                       MISO                21                       SPI1_MISO / PA16 / GPIO16

      8                       IRQ                     -                                 -

 

What's wrong?

Link to comment
Share on other sites

 

I think the MySensors library comes also from this one basically. They made it quite easy to set up an nrf24... I left finally cause on arduinos node side they used outdated libraries which messed up with my other projects. I think it wouldn't be such a problem to separate arduinos libs, and get it running but my interests in nrf24 driven nodes is somehow limited.

 

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines