NRF24L01+ 2.4GHz WIN-AVR Library??

14 posts / 0 new
Last post
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is there a good library already written for the NRF24L01+ wireless transceiver that is NOT for the arduino?? I use WIN-AVR.

If I use the ATMega328p would I be able to use the arduino libraries?? That would be cool.

Here is a link to the chip I will be using. It has a built in antenna.
http://www.ebay.com/itm/Perfect-High-Quality-New-NRF24L01-2-4GHz-Wireless-Transceiver-Module-Arduino?item=260920481575&cmd=ViewItem&_trksid=p5197.m7&_trkparms=algo%3DLVI%26itu%3DUCI%26otn%3D3%26po%3DLVI%26ps%3D63%26clkid%3D7625350354661330880#ht_3057wt_905

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I found a library here:
http://www.tinkerer.eu/AVRLib/nRF24L01

However, it uses the non-plus version of the transmission protocol, with fixed buffer size etc. It also had some other integration problems with my current project, so I'm actually trying to write one from the data book. Currently I'm stuck at not receiving the IRQ signal back somehow, and I don't have a scope to look at it :-(
Maybe tomorrow will bring more clarity.

iteadstudio.com sells the modules for $5.50, and has some sample code, although it's very crufty:
http://iteadstudio.com/store/index.php?main_page=product_info&cPath=7&products_id=53
Note: they also have Arduino sample code, but the code in the archive of support files is not Arduino-based.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I just got code working to be able to read and write to registers. That was even a pain for me. Now i'm trying to get the right configuration to get it transmitting. I'm not even worrying about the receiver yet. I want to be able to have the chip transmit, do the number of re-transmits and then have the IRQ pin go low. I cant seem to trigger any kind of interrupt on that pin.

How far have you gotten?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I can understand that without scope it's hard to find the problem on the SPI-bus.
However i get progres from the moment i used a logic analyser. (ikalogic) but any other type will do also i think. I hope you find anything usefull in the attatchment. It contains two folders (TX&RX) The original files are from sparkfun etc. I made a mash-up of various things and authors it was for testing the NRF but i found that the actual range was to short.
Regards.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I looked at the configuration for RX and TX. I'm doing the same thing it seems like. My transmitter is transmitting. I send the STATUS register to my computer and is has the "data sent" interrupt triggered after I transmit. The IRQ pin does not trigger but the status reg says it did. I'm just not receiving anything.
I attached my code if anyone wouldn't mind looking at it. The important functions are setup_RX, setup_TX, TX, and write_payload.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I did a quick look to your code but in the TX part you call the RX config in the TX module I think this is incorrect. In the SPI_INT (init) you enable the interrupt of the SPI and the global Interrupt flag (sei) before the clock source is selected. this can cause strange results (in the simulator the interrupt is fired by this for example and stops in a infinite loop) I suggest that you first try a working example from someone and modify this to your needs. Also build a test without interrupts, when this works (by polling as you do for the status reg). Provide also the exact device you use (otherwise the forum users have to guess it )I hope this will help you.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey stedew,
I am also using the nRF24l01+ chip from sparkfun. I am using it with stefan's library (Here http://www.tinkerer.eu/AVRLib/nRF24L01 ). I used interrupt driven approach for sending the packet. and used polling at receiver. The devices do communicate flawlessly sometimes. These are the problems i'm getting,
When i reset my uC during communication, the uC and communication both hang, and there is no effect of further resetting either Rx,Tx or both, They only work again when i power off them and Re power them.????
HAs anyone else got similar issue's.
I have tried clearing the PWR_UP bit upon reset then wait and again set it.

I feel there really should be a reset pin on these nRF24l01+ ic's. :?

- Will find's a Way.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MR vvyogi,
I had this item also with the NFR24L01+ after a (long) idle period there is no means to get the communnication back on rails. And as you stipulated only a compleet power shutdown off the NRF make it responsive again. To be very honest i never had a clou why this happens because on the spi-bus side everything seems to work? A have found that the problem was on one side (RX -ithink ). The problem seems that the NRF sometimes looses his configuration (especially RF-channel and RX/TX Adress) The "dirty" approach is to reconfigure every TX (not optimal)A global config (and state) reset command should be helpfull idd.Maybe you can order a batch by Nordic ;-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you for you reply Stedew,
I was in haze regarding this problem and i thought this was probably a programming error. As from your confirmation now i am quite sure.
AS you say

Quote:
The "dirty" approach is to reconfigure every TX (not optimal)A global config (and state) reset command should be helpfull

Have you tested the above approach ? Does it work ?

Till now I did following at my receiver side:
1. Set myRX_add = TX_add( address of target nRF).
2. Write payload to pipe0, and wait for either TX_DS or MAX_RT flag in STATUS register of nRF.
3. Set myRX_add( now my own address). wait for 10ms to get a packet back from the target nRF.
4. so on.

When i reset the device, i guess it hangs at step 2 above( as i wait for the TX_DS/ MAX_RT using a while loop)... :(

Now i am going to try the transmitter without the interrupt led approach like this,
1. Set myRX_add = TX_add( address of target nRF).
2. Write payload to pipe0, wait for a predetermined time( i am unsure how much to wait at this point :? suggestions invited )
3. Set myRX_add( now my own address). wait for 10ms to get a packet back from the target nRF.
4. so on.

- Will find's a Way.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The following code hangs on startup.. just after the line where "init.." is printed.
on resetting the code runs flawlessly, but no data is received. At the Receiver side even worse, for the first time it gives acknowledge that it has received a packet, then it is just sitting there.

Attachment(s): 

- Will find's a Way.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is the interrupt driven code that i came up with earlier.
It just works best....
Only problem, is the occasional reset issue. It (occasionally) hangs on uC reset while ongoing communication. still trying to fix it.
There has to be a solution.
This code is for transmitter and does works with the receiver code i posted in previous post. Guy's if you can help fixing this plz do !!!

Attachment(s): 

- Will find's a Way.

Pages