Jump to content

RF24 library for wireless comunication

Recommended Posts


I'm using RF24 library for my own home automation project, and fater look at RF24 code it seems to use standard SPI interface. I've not yet tested, but have you tried to compile it?

RSPI don't use Arduino'ish headers, so RF24 has been ported to it...but for pcudion it should be easier...at least, I hope... :-)

Keep my in touch, I'll do the same.

Share this post

Link to post
Share on other sites

Hey all!

I've tried to port RF24 and RF24Network libraries from maniacbug but without any success. I still got bad configuration data like:

"STATUS           = 0x07 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=3 TX_FULL=1
RX_ADDR_P0-1     = 0x0404040404 0x0404040404
RX_ADDR_P2-5     = 0x07 0x07 0x07 0x07
TX_ADDR          = 0x0404040404
RX_PW_P0-6       = 0x07 0x07 0x07 0x07 0x07 0x07
EN_AA            = 0x07
EN_RXADDR        = 0x07
RF_CH            = 0x07
RF_SETUP         = 0x07
CONFIG           = 0x07
DYNPD/FEATURE    = 0x07 0x07
Data Rate        = 1MBPS
Model            = nRF24L01
CRC Length       = Disabled
PA Power         = PA_HIGH"

I hope to see a tutorial soon  on how to have a working version for pcduino smiley.gif

Share this post

Link to post
Share on other sites
Is this SPI interface?

Hey Jim!

Yes it uses SPI interface, but I can't use SPI library provided with c_environnement. It needs little changes, but without any success...I've not yet tried software SPI interface.

Source code I use:

There's a RPI port:

But without any success too...

Thanks for you quick answer,

Share this post

Link to post
Share on other sites

Wow thanks you very much for your tutorial! I'll try now to port your great works into maniacbug's libraries(rf24 and rf24network)...  cheesy.gif

I think i'll be ready to remove Arduino from my pcduino board!

Keep up the good work!

Share this post

Link to post
Share on other sites

Ok, with the help of your tutorial I've successfully ported RF24 and RF24Network from maniacbug to pcduino! all works perfectly now:

Output from gettingStarted shipped with RF24:

"RF24/examples/GettingStarted v0.1
STATUS           = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1     = 0xf0f0f0f03c 0xf0f0f0f05a
RX_ADDR_P2-5     = 0x69 0x96 0xa5 0xc3
TX_ADDR          = 0xf0f0f0b43c
RX_PW_P0-6       = 0x20 0x20 0x20 0x20 0x20 0x20
EN_AA            = 0x3f
EN_RXADDR        = 0x3f
RF_CH            = 0x4c
RF_SETUP         = 0x07
CONFIG           = 0x0f
DYNPD/FEATURE    = 0x00 0x00
Data Rate        = 1MBPS
Model            = nRF24L01+
CRC Length       = 16 bits
PA Power         = PA_HIGH
Ok! done!"

In attachments you'll found ugly(but working) hack to use them!

Thanks to jim!


Share this post

Link to post
Share on other sites

i try those library but i have a trouble i got this 

STATUS       = 0x00 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=0 TX_FULL=0
RX_ADDR_P0-1    = 0x0000000000 0x0000000000
RX_ADDR_P2-5    = 0x00 0x00 0x00 0x00
TX_ADDR       = 0x0000000000
RX_PW_P0-6    = 0x00 0x00 0x00 0x00 0x00 0x00
EN_AA       = 0x00
EN_RXADDR    = 0x00
RF_CH       = 0x00
RF_SETUP    = 0x00
CONFIG       = 0x00
DYNPD/FEATURE    = 0x00 0x00
Data Rate    = 1MBPS
Model       = nRF24L01
CRC Length    = Disabled
PA Power    = PA_MIN

i have made some arduino shield only with nrf24l01 on it, it work on arduino uno but on pcduino if fail i don't know why can someone help me ?

Share this post

Link to post
Share on other sites

i'm connect like this

Name     arduino           radio
GND            GND                1    
3V3            3V3                2    
CE            9                3    
CSN           10                4    
SCK           13                5    
MOSI       11                6    
MISO       12                7    

and i use helloworld_rx_exemple sketch

Share this post

Link to post
Share on other sites

I am wondering why did you have to modify the library? if Hardware SPI is being used and if PcDuino is compatible with Arduino shields and core libraries are provided with the necessary changes.

Just trying to understand what to expect when utilizing the board. Thanks

Share this post

Link to post
Share on other sites

Hi Fadi!

I've tried HardwareSPI pcduino(v1) thing but without any success, so I've used some code of SoftwareSPI(ported from jim) to fix usage of RF24 lib for pcduino.

I don't really know why pcduino HardwareSPI lib don't works, but dmesg buffer seems to be flooded with many complaint about SPI device that block correct usage of it. Maybe we can try to remove debug things from spi module on pcduino v1(fdon't know for pcduino v2...) 

I'm using pcduino3 now, and I've tried to use RF24 directly with spi device...It's on my TODO list, but my TODO list is very very big...and my time very very limited...  angry.gif

Many arduino libraries needs adaptation(specially code using interrupt, register, atmega things...) to works with pcduino..don't expect plug&play at 100% but in 'normal' case you can use them without any problem. Pcduino3 seems to have better module(gpio,spi...) support that ease import of arduino libs.


Share this post

Link to post
Share on other sites

Thank you Alex for the quick reply.

Understood. I have pcDuino v2, so let's hope that I have better luck with it.
I thought it is 100% compatible without issues, seems that they still need to
do more work.

As long as the product is not dying and is being actively worked on that is good.
(in hopes that we are not forced to buy new boards just to get the functionality promised in the older ones!)


Share this post

Link to post
Share on other sites

ood luck working on those cheesy.gif.
the obstacle is hardwarelib is closed source tongue.gif
I prefer on arduino on interfacing to  sensors and I/O. fast and simple where many open source libs around the net.

I am using RF24 on my arduino project, very solid. 
how I connect to devices including arduino, pcduino, and others? pretty simple -> IoT that I use MQTT opensource implementations. No messy coding and configuration.

once again good luck on your project

we need AllWinner to open hardwarelib or partially gives us API, in addition they release fixes in blob( if they want to open partially)..

my pcduino3 serves me as a low power headless ubuntu server(MQTT Broker, Apache, mysql, zone minder,and on going).
Since I connects my pcduino3 to Wild Wild World of internet. all fixes/patches are done by updating  ubuntu. No Heartbleed, and No Bash exploit. Ubuntu is very fast on delivering fixes. I am using 14.04LTS
One thing to be done is to use GPIO for switches and LED since headless. 
Other  thought, connect my all serial 4X20 LCD display or buy a new USB model. USB Model basically is USB-serialport .

Share this post

Link to post
Share on other sites

Hey superbima and Fadi!

Faid, I only bought pcduino3 for better perfs and additions(audio jack output, csi camera, battery support). I don't think(or at least I hope!) linksprite force users to buy new things just to have better support...but future time say us the truth...but yes, you've right stille needs more works to be really simple for many people...

superbima has right, hardwarelib and AllWinner attitude are very very bad things!  angry.gif when I'm speaking about pcduino3 support I'm speaking about using more recent kernel(3.4.79 vs 3.4.29+)...but hardwarelib is closed on both platform!

RF24 modified source code works perfectly, so for using RF24 networks driven with pcduino(ie:without using Arduino) no problem if using HardwareSPI or not...speed is the same, no difference at all...but in a more 'generic' way, using one or one Arduino library is more problematic since you must port them to pcduino(when they require specific things..as I said in my previous message).

In my current project, I'm driving nrf24l01 from arduino linked to pcduino with serial link. I'd like to use nrf24l01 directly from pcduino3...to save some arduino pins(and to prove me I can do it!  grin.gif) but my main problem is to port RF24 code to C(C++ to C is hard to implement).


Share this post

Link to post
Share on other sites

RF24 is pretty solid, not mess-up with old technology aka car toys remote control which running in MHz

the range is pretty solid, and cheap to buy on ebay, I always buy in 10X quantity, some  are bad which I toss out  without bothering the seller. 1 of 10 is failed, I accept that.

total I already bought 30 nRF24L+ cheesy.gif
pretty impressive, just do remote sensing with full-duplex by using  sensor/output with arduino nano/ clones+nRF24L+ module.

the issue is only 5 device can be connected one time, actually 4 remote device and 1 device as a master/central.

I just use   3 central arduino and 12 remote arduino ( 4 remote connect on each central).  3 central arduinos are running mqtt client with extra functionality.

pcduino3 is running mqtt broker, I can control all arduino by sending command  to do or request  via mqtt command to broker.

no messy coding and building infrastructure.

just my one cent

Share this post

Link to post
Share on other sites

i find it on library nrf24l01.h at the end you got sck on pin 10 but in my case it pin 13, i change that and i work. 


Thank you for your help and for those library

 Thank you Jim.


Just to clarify, if you find responses like: 



RX_ADDR_P0-1 = 0x0000000000 0x0000000000
RX_ADDR_P2-5 = 0x00 0x00 0x00 0x00
TX_ADDR = 0x0000000000
RX_PW_P0-6 = 0x00 0x00 0x00 0x00 0x00 0x00
EN_AA = 0x00
EN_RXADDR = 0x00
RF_CH = 0x00
RF_SETUP = 0x00
CONFIG = 0x00
DYNPD/FEATURE = 0x00 0x00
Data Rate = 1MBPS
Model = nRF24L01
CRC Length = Disabled
PA Power = PA_MIN
Check the file nrf24l01.h at the end and double check the pinouts.
#define SCK      13 // SCK BIT:  Digital Input     SPI Clock
#define MOSI     11 // MOSI BIT: Digital Input     SPI Slave Data Input
#define MISO     12 // MISO BIT: Digital Output    SPI Slave Data Output, with tri-state option

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now