SparkFun Forums 

Where electronics enthusiasts find answers.

All things pertaining to wireless and RF links
By brennen
#28915
After a few weeks of development, I have rewritten a large chunk of my include library for the nRF24L01 chip. All of the old SPI functions are gone now, and there is only one SPI function you must write. It simply takes one byte as an argument and sends it over the SPI bus to the 24L01. It then waits for the response from the 24L01 and returns that value. It doesn't get much simpler than that. You still have to implement the microsecond delay function that takes the number of microseconds as the argument. You also have to set up the registers and pin masks in the .h file. (All of this is extremely well-documented in the .h file.)

Another thing that I changed in this code version was the elimination of the 130 uS delay. The one time this is necessary is when a receiver goes from standby mode (CE = 0) to RX mode (CE = 1). The function should not be added to the receiving device, but to the transmitter such that it waits the necessary 130 uS for the receiver to get into RX mode. Without using this delay, you may miss packets at the receiver until it gets fully into RX mode.

I have two tutorials that are totally written right now code-wise, and I have to make write-ups for explaining them. I also have a sort of "everything you need to know" document almost ready describing just about everything about the 24L01 and the MiRF-v2 breakout. Watch for these to be posted in the coming few weeks.

As for the links to the code, they are the same as they always are: nrf24l01.h and nrf24l01.c.
By lucicop
#31703
Thank you, brennen, for your kindness for sharing the code with us. I have a few nRF24L01 modules and I want to try them out. I will use your code as a starting point for a low level driver.
By brennen
#31709
This is actually a really dated post. If you're gonna try out the 24L01, I would recommend you reading the tutorials on my website, which can be found below in my tag line. I have implementations for ARM (LPC2148) and PIC (18F452) at the current moment, so enjoy! 8)
By lucicop
#31847
Yes, I have seen your site and it is great ! I've read the four tutorials about PIC and nRF24L01 and I plan to develop my own code for a low level driver. If anything should go wrong, I will take a look at your code to see where I'm mistaking. It's good to know you have a very clear written code available if you need it.
By beanx10
#136733
hi Brennen...where can I find the nrf24l01.h and nrf24l01.c code?...i've been looking on your page and nothing...can you share the updated code?...thanks in advance...