Looking for Faster Objects for Nordic Wireless Modules nRF24L01+ and nRF2401A
Duane Degn
Posts: 10,588
Edit: See post #74 for the most recent driver.
You may want to compare the most recent driver to the earlier on in attached to post #9.
There are two objects in the OBEX to use with these Nordic modules:
Nordic nRF2401 Rf Transceiver Handler
and
nRF24L01 driver and demo
Both of these objects use Spin to communicate with the transceivers.
I have a bunch of nRF2401A modules and at Leon's suggestion I purchased a couple of the newer nRFL01+ modules.
I found this old thread about Nordic modules. I was tempted to resurrect it but I "Want to make me some Propeller Code?" isn't a very helpful thread title.
I'm wondering if anyone else is using these modules and if they have faster objects.
These modules can communicate pretty fast. The nRF24L01+ can use SPI with a 10MHz clock. I'm pretty sure SPI with Spin doesn't come close to this speed.
If someone hasn't already made a faster version of these objects, I'll probably just adapt the SPI one to use the SPI_Asm object.
BTW, I also use XBees but these Nordic modules are generally less expensive and they are smaller than XBees so there are some applications where the Nordic modules are a better choice IMO.
Duane
Here's the datasheets on the two Nordic devices.
nRF24L01P_Product_Specification_1_0.pdf
nRF2401A.pdf
Edit(3/11/15): Warning, the code attached is an old version. There are better options available.
I plan to upload this program or an improved version to my GitHub account
If there isn't a replacement on GitHub send me a message and I'll make sure to upload the replacement code.
You may want to compare the most recent driver to the earlier on in attached to post #9.
There are two objects in the OBEX to use with these Nordic modules:
Nordic nRF2401 Rf Transceiver Handler
and
nRF24L01 driver and demo
Both of these objects use Spin to communicate with the transceivers.
I have a bunch of nRF2401A modules and at Leon's suggestion I purchased a couple of the newer nRFL01+ modules.
I found this old thread about Nordic modules. I was tempted to resurrect it but I "Want to make me some Propeller Code?" isn't a very helpful thread title.
I'm wondering if anyone else is using these modules and if they have faster objects.
These modules can communicate pretty fast. The nRF24L01+ can use SPI with a 10MHz clock. I'm pretty sure SPI with Spin doesn't come close to this speed.
If someone hasn't already made a faster version of these objects, I'll probably just adapt the SPI one to use the SPI_Asm object.
BTW, I also use XBees but these Nordic modules are generally less expensive and they are smaller than XBees so there are some applications where the Nordic modules are a better choice IMO.
Duane
Here's the datasheets on the two Nordic devices.
nRF24L01P_Product_Specification_1_0.pdf
nRF2401A.pdf
Edit(3/11/15): Warning, the code attached is an old version. There are better options available.
I plan to upload this program or an improved version to my GitHub account
If there isn't a replacement on GitHub send me a message and I'll make sure to upload the replacement code.
Comments
The one in the OBEX has a serious bug.
After fixing the OBEX object and writing a transmit method I tried to increase the object's speed.
I initially used the SPI_Asm object. I then modified the SPI_Asm object by taking out the delays.
I'm attaching a demo that uses two instances of the driver to have one module communicate with a second one.
This object has the basics to allow two modules to communicate. There are lots of improvements needed.
I'd like to improve this driver so it has a FDX type interface. I also want to take advantage of the "Enhanced ShockBurst" mode of these modules.
Another important feature is to make the object compatible with the older nRF2401A modules.
I'm posting what I have so far in case anyone else wants to use these modules with a Propeller. This should make it relatively easy to get one module talking to another.
NordicPlusPlusDemo110409i - Archive [Date 2011.04.09 Time 14.36].zip
I can not get the the newer nRF24L01+ modules to communicate with the older nRF2401A modules.
I've attached a test program that uses two Nordic modules to make sure they can communicate.
The program can use any of three possible combinations of modules. Two new modules, two old modules or one new module and one old module.
If I use two new modules or two old modules it works fine. My problem is when I try to use a new module and an old module.
There's one constant to change "_CurrentConfig" in order to let the program know which combination of modules to use. This can be set to one of three values: _TwoNewModules, _TwoOldModules, _OneNewAndOneOld (0, 1, 2).
These constants are located at the end of the constant section
I thought I had all the registers set correctly to let the old and new communicate.
I'm hoping someone will be willing to look this over and help me get this working correctly.
Much of the driver code is based on C code Leon posted.
I know Leon has used these modules before. Leon, do you have time to look at this?
I'm pleased with how the driver is working with the newer modules. I'm still using the object from the OBEX to control the older modules.
I have lots of older Nordic nRF2401A modules and I'd really like to get them to work with the new nRF24L01+ modules.
Here's my latest code. I've tried to clean it up to make it easier to read.
Thanks,
Duane
NordicPlusPlusDemo110416f - Archive [Date 2011.04.16 Time 14.53].zip
Edit(3/11/15): Warning, the code attached is an old version. There are better options available.
I plan to upload this program or an improved version to my GitHub account
If there isn't a replacement on GitHub send me a message and I'll make sure to upload the replacement code.
Here's the configuration data for the nRF24L01+
I think the first six registers are he ones I need to worry about when using these with the older modules.
And here's the configuration data to the nRF2401A
The older modules need the tx address to precede the payload. The new modules use a register for the tx address.
I've tried various combinations of addresses without success.
I've spent a lot of time reading the nRF24L01+ datasheet but I haven't read the nRF2401A nearly as much. I'm afraid it's time to read nRF2401A datasheet again.
Thanks Leon for the original C code. It made this task a lot easier.
http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=320674876163&ssPageName=STRK:MEWNX:IT
The price is very good. They'll take a couple of weeks to arrive, as I went for the free postage option.
I'll have to modify my PCB design slightly for the different connector.
I think the same place is selling them to the states for $6.40. I might buy several of these.
If anyone else is thinking about using these nRF24L01+ modules, the code I posted in #3 makes these relatively easy to use with the Propeller.
I don't have the auto acknowledgment and resend features supported yet but you can use the code for two way communication.
I'm taking some time off of working on this object but I plan to return to it and add some more features after a bit of a break.
I'm getting 2 @$7 each with shipping from http://cgi.ebay.com/Mini-2-4Ghz-Wireless-NRF24L01-Transceiver-Module-/320608404697?pt=LH_DefaultDomain_0&hash=item4aa5c004d9
Seems like he has a longer time on eBay.
Is that an etched antenna?. Anyone know what the real-world range is with this type of set-up?
I've received a request to for a different demo program for this object. Here are a couple of new demos for the Nordic object.
These demos will only work with the newer nRF24L01 modules.
There is both a master demo and a slave demo.
The master sends two bytes to the slave device. The slave device adds these two numbers together and sends the original two bytes with the sum back to the master device.
I had the numbers sent as ASCII characters of hexadecimal numbers. I've recently been using this method with one of my robots so I used it here also.
These demos use different pins than my earlier demo.
I realize I've only looked at the output from the master board. Here's what I get in the PST window.
As you can see, I've also outputted the value of the status register.
The "<$00>" is part of the packet that wasn't used. I had the whole packet displayed. Any characters that aren't printable ASCII (or carriage return) characters are displayed as hexadecimal values.
I just now successfully tested these demos out on two of my Propeller boards. I hope they work for you.
Duane
**** Warning Old Buggy Demos ****
Nordic_nRF24L01_DemoSlave110505a - Archive [Date 2011.05.05 Time 19.14].zip
Nordic_nRF24L01_DemoMaster110505a - Archive [Date 2011.05.05 Time 19.16].zip
EDIT: I'm posting an update version of these demos. I've decided to leave the old demos in place.
Here are the new ones:
**** New Demos, As of 7/19/11 ****
Nordic_nRF24L01_DemoMaster110719a - Archive [Date 2011.07.19 Time 12.21].zip
Nordic_nRF24L01_DemoSlave110719a - Archive [Date 2011.07.19 Time 12.21].zip
These demos have different pin assignments than the earlier ones.
The new start method only uses one pointer.
All the configuration information needs to be in the correct order.
This order is different than the previous driver.
Here's the output of the slave demo.
Here's the ouput from the master demo.
I matched the payload size to the size of the message so there aren't the extra zeros anymore.
Duane
Edit(3/11/15): Warning, the code attached is an old version. There are better options available.
I plan to upload this program or an improved version to my GitHub account
If there isn't a replacement on GitHub send me a message and I'll make sure to upload the replacement code.
I was going to order some from the link in post #8. Any reports on how they work?
Leon, how did yours work?
koehler, have you received the ones you ordered?
Bill, are you reading this?
I've personally just used the modules from SparkFun. I know they work well but I'd like to get a bunch of the cheaper ones, if they work.
Duane
I guess I am reading this
I tried two cheapie Ebay modules so far, no dice. Since you have had success with the Sparkfun ones, I think I'll order a couple to play with.
Bill
Yeah, the ones at SparkFun work fine. I was hoping to buy a bunch of cheap ones off ebay and use one at each air vent in our house (automated temperature control stuff).
Anyone else? Leon?
Duane
Duane
I need to bring some of the PIC I/O out to pads, for interfacing sensors etc. on the prototyping area.
In particular you can't use 2Mb mode, nor the 'enhanced shockburst' packetizing (which is on by default and needs disabling in various ways with various config registers - auto reply must be switched off, packet id and crc fields must be correct and variable length packets must be disabled - not that I've the older ones to test against either.) I'm using them to pipe digital audio at 2Mb (which needs all the clever stuff disabled for throughput).
Mark,
Can you go into more detail? Do remember the vendor on eBay you used?
I'm not sure what you mean by "real" and "cloned". I think as long as a board uses the nRF24L01+ chip it's real.
Duane
Edit: Mark, what kind of microcontroller are you using with your modules?
What exactly was the problem you had with those modules? Were they getting the SPI data and responding OK?
They were not responding to SPI commands sent with the same code that worked for Duane.
I have a couple of spare modules and will try again soon, this time under a logic analyzer - the price/performance on these modules is hard to ignore, therefore it is worth some effort
I'm going add a basic test method to the demo I posted earlier. I noticed in the "Similar Threads," Leon made this suggestion before.
I'm thinking I'll read the rx address from the module, then write a different address to it and read the address back. This should indicate if the Propeller is communicating with the Nordic device via SPI.
I should have time to write the code now. I'm post it here when I'm done.
Duane
My driver is based on the code you posted here.
Do you have any code significantly different?
Duane
Bits were being sent to the module, it just was not responding. I checked my wiring about 100x, so I don't think that was the problem.
It will be a few days before I can get a test setup running again for the nRF modules; I have some RoboProp work I must finish first.
Just in case I got a bad batch of cheap modules, I will order some from SparkFun today.
I appreciate the help guys, thanks.
No, I didn't have that code. It's pretty much what I'm planning to do with the Propeller. I was going to use the RX address instead of the TX address. I don't think it matters. We just want to make sure we can communicate with the device.
Thanks. Your C code really helped me get the hang of these modules.
Duane
Here's the output to the debug window.
To make sure the Propeller actually does write to the module, the program makes sure the information it plans to write isn't already present. If the current rx address is the same as the test rx address, then the test rx address is changed so we can be sure the data really was written.
You can see this in the above output. The first time the test is run the rx address was different than the test address. The the test address had to be changed on the second test since it already matched what was stored in the rx address register.
As you can see, the program continues to loop with the press of any key on the keyboard.
Duane
Edit: This original code had a bug in it. It worked in determining if the Prop was communication with the Nordic module. The program displayed the incorrect address after the second reading of the module.
Here's the output. I unplugged the module and ran the test again.
Here's the fixed program.
Nordic_nRF24L01_SpiTest110719a - Archive [Date 2011.07.19 Time 13.35].zip
This program uses an updated driver. The pin assignments are different than the original program I posted.
Duane
Edit(3/11/15): Warning, the code attached is an old version. There are better options available.
Edit(3/7/20): I believe the best version of my driver available is attached to post #74. There are likely better versions available from other sources.
I have two sets, one from ebay (http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=320696838110&ssPageName=STRK:MEWNX:IT) and one from mdfly. They look identical - under a lens there are some clues its a clone board for the ebay ones, such as slightly different ground vias and some tiny chinese lettering silk screened on the ebay ones.
Actually a clone might have substandard aerial filter components so it might matter (also the board material matters for tuning the pcb antenna).
I tested them at 2MB with no noticeable difference between real and ebay ones. The crystal accuracy doesn't matter at 2.4G anyhow with 1MHz channel spacing...
I'll leave it to those who have a spectrum analyzer to really compare them thoroughly.
Someone asked about range - I get about 8m at 2Mb rate, but with interference from a hifi audio sender (frequency hopping ISM) 250kb should get at least 10dB more
I'm using propeller to interface of course! PASM for speed
So did you write your own object? I don't suppose I could talk you into posting it?
I was just adding up instructions in my SPI driver and I think it's sending data to the device at 3.6Mb/s (454.5kB/s) @80MHz. Since I'm using packets there is some overhead. I haven't tested what kind of continuous data rate I can get with these transceivers. So far I haven't needed much speed but it would be nice to know what they are capable of.
I just ordered six of the transceivers you linked to on ebay. (The six cost less than buying two from SparkFun.)
Duane