This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Advice for simple communication from nrf51822 to nrf24l01 ?

Hi everyone ! I'm trying to send data from an nrf51822 to an nrf24l01 with arduino and I guess I'm doing something wrong...

For the moment I succeeded to have these talking together:

...so I guess the hardware is not the problem :) (if you're curious about the context, the project is explained here: hackster.io/cedric/twi)

I looked for similar problems on the forum but I don't find the solution to my problem, if anyone has a suggestion I would be infinitely grateful ;D

Here is the configuration I use:

nrf51 (TX): radio_config.c main.c

nrf24 (RX) with arduino: Mirf.cpp RX.ino

I used the nrf51 sdk suggestions and an nrf24 library (+datasheets) to understand it, but it doesn't work (yet!), the nrf24 reception pipe stays empty.

Anyone has any suggestion to offer ? Thanks a lot !! ;)

  • Yes, am receiving acks to trigger the success portion of the uesb_event_handler. Occasional false-negatives when I am the edge of range, but generally it works.

    Almost year ago, so my memory is a little hazy, but if I remember correctly it was the edit to the RF24.cpp file that sorted the problem.

  • The only other thing I can think of is that I am working off of an older version of Nordic's micro esb library on the NRF 51822- I wonder if something has changed that might be affecting behaviour? The one that I am using is here

  • Interesting.. I'm still not able to get the nrf51822 to enter into the success portion of uesb_event_handler. It keeps going right into the tx failed section instead. I copy/pasted the same library you're using for micro esb without luck, but perhaps the difference lies in the RF24 library instead? which version are you using there? I'm on the one here.

    Is there anything that may have been lost in your posted code due to the formatting? I did notice a few oddities, for example the 'ackd = true' line in your 51 code causes a compiler error and had to be removed.

    I'm also trying to dig through to see if there may be any differences between the RPi version and Arduino that I may have missed.

  • The library I have for the RPi is clearly based on the Arduino one at maniacbug's GitHub repository - though someone has made some tweaks to port it for the RPi. I was convinced I had downloaded it from there but must be mistaken - my bad.

    I have done a text comparison and found that apart from changes required to port to the RPi (minor language differences), there are a few more changes which you could try and replicate in your Arduino library. So aside from setting the EN_DYN_ACK registers as above:

    1. comment out the flush_rx and flush_tx commands near the top of the startListening routine - just above the Go! comment (comments in mine say 'as per gcopeland fork')
    2. Add 150 microsecond delays in the powerDown and powerUp routines after the write_register commands
    3. comment out the powerDown and flush_tx commands from the end of the write routine
    4. comment out the 150 microsecond delay at the start of the startWrite routine
    5. adjust the 15 microsecond delay to 10 microseconds in the startWrite routine (beneath the Allons! comment)

    The ackd=true command in my NRF51 code is safe to remove - it's one of my global vars that's specific to my application (which I didn't define in the code snippet)

  • Finally got it! I tried those further changes to the rf24 library without luck. Did some more digging, and saw that in the latest library release for micro-esb on github they reversed the polarity of the NOACK flag. Changing back to the original fixed my problem. I guess I wasn't getting an ACK because I wasn't asking for one in my packet! :) I can now read ACK payloads as well. Thanks for all the help, Gavin!

Related