NRF24L01+ receiving problem (using Atmega32A)

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Hi everyone. I am new here, so please correct me if I am wrong at anything.

 

I'm using Atmega32A to communicate with NRF24L01+. I observe several problems that need some explanation and solution

 

1. I successfully set my desired values for the NRF's registers and check them by displaying on the Terminal monitor. However, after toggling CE from low to high and back to low (to receive packets from Tx), I check again and see that all registers' values are changed and they remain weird numbers forever. Can someone explain this problem and should I put my NRF_Initialization (setting up all registers' values) inside the while loop to avoid weird values?

 

2. After receiving, I observe that STATUS changed from 0E to C0, which means RX_DR is set high. However, all data I receive are Zeros. Is it normal? My STATUS also automatically changes back to 0E without me resetting its value.

 

3. Can you recommend a link to a successful tutorial (best with some explanation, as I'm new with it) using  two NRFs and two AVRmegas to send and receive data? I searched for the whole last week but no help. My code is currently based on this guy: https://www.avrfreaks.net/forum/n... (the last comment in the thread)

 

Thank you very much guys. My code is a bit messed up, but if you need to see it, I'll post then. :D

This topic has a solution.

Last Edited: Fri. Oct 16, 2015 - 12:23 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

To be more clear, I am using Atmega32A in the STK500 board.

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

As always, check your connections, then look close at your code. There are lots of NRF examples on the web, one at http://barefootelectronics.com/N... though this one uses xMega for the processor. You'd just have to substitute your spi and io instructions, but the register contents should be the same.

 

If you don't know my whole story, keep your mouth shut.

If you know my whole story, you're an accomplice. Keep your mouth shut. 

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

Also; clean power on the NRF's I've been burnt by this before.  Your problem smells a bit like that.  I'm having difficulty finding the post where I saw someone debug this well.

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

@Torby: Thank you. Do you also use ATXmega with NRF24L01+?

@BrotherJe: Thank you for your idea. The capacitor saved me. Now the registers values are solved. However, I am having problem with receiving. RX_DR bit on STATUS doesn't change anymore. 

Do we need to turn off CE to send R_RX_PAYLOAD, because I see on the datasheet we must read data in Rx mode (Rx mode equals PWR_UP, PRIM_RX and CE high)? I am quite confused. Have tried all and it still doesn't work. 

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

BrotherJoe wrote:
Also; clean power on the NRF's I've been burnt by this before.

This applies to pretty much any radio transmitter (including transceivers).

 

Radio transmitters, by their very nature, take "very" large bursts of current and, therefore, require careful power supply design.

 

Typical symptoms are that things seem to "work" until the transmitter starts transmitting, then everything "goes wrong" - because the large power spike makes the supply droop out-of-spec. ("brown-out").

 

It gets orders of magnitude worse for GSM devices - where the current spikes can be on the order of several amps!!

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

RF_newbie wrote:
Do we need to turn off CE to send R_RX_PAYLOAD, because I see on the datasheet we must read data in Rx mode (Rx mode equals PWR_UP, PRIM_RX and CE high)?

Note that the NRF24L01+ is not an Atmel product - it is a Nordic Semiconductor product:

 

http://www.nordicsemi.com/eng/Pr...

 

So, for specific question about the NRF24L01+ and its operation, you should really be asking Nordic:

 

https://devzone.nordicsemi.com/q...

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Thank you all. I solved my problem. It is the power supply that caused the problem. I added a 22uF to the RF module and used Arduino Uno board to source 3.3V to get a better current (~12mA). Everything works like a charm now. :).

For people who are new to this module: The code in the link I posted works well. :)