Help with nRF24L01+ datasheet

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

Using this sheet

https://www.sparkfun.com/datashe...

 

I'm trying to figure out two things.

 

1) There is a section on timing but I'm a bit confused what SPI Clock rate to use (SPI2x, SPR1, SPr0 respectively).  I don't see a way to set the nRF24 via pins (as there clearly are none for clock rate) so I'm left to assume the clock rate is fixed.

 

2) When setting map tables, what is the packet format of the SPI data?

I see the Register map table and  that you set them with SPI. But how is unclear. I would have expected to see something like.  [command, addressHI, adressLO, byte1, byte2, byte3, etc....]. The ShockBurst appears to have packet data but does not seem to be what I'm looking for.
 

I'm sure its all there just need help.

 

 

 

This topic has a solution.
Last Edited: Thu. Jun 28, 2018 - 08:24 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is not general electronics; these are specific questions about a particular product - and a competitor's product at that!

 

You should be asking Nordic Semiconductor

 

https://devzone.nordicsemi.com/

 

http://www.nordicsemi.com/eng/About-us/Contact-us

 

 

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

ah, ok. thx.

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

This chip is getting a bit old skool now. The nrf51 and 52 series would be a better choice. Nevertheless, there’s heaps of examples out there - especially for Arduino, so seek these out for guidance.

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

S_K_U_N_X wrote:
There is a section on timing but I'm a bit confused what SPI Clock rate to use (SPI2x, SPR1, SPr0 respectively). I don't see a way to set the nRF24 via pins (as there clearly are none for clock rate) so I'm left to assume the clock rate is fixed.

 

That NRF chip is an SPI slave device, which means that the SPI clock is given by the master. After all, SPI means synchronous peripheral interface.

There is a maximum clock rate of 10 MHz, but as long as you stay below that, the clock frequency can be whatever you want it to.

The clock doesn't even have to be nice and periodic, so software SPI is no problem at all.

 

S_K_U_N_X wrote:
2) When setting map tables, what is the packet format of the SPI data?

 

falling edge on CSN,

then the command, MSBit first

then the data, MSBit and LSByte first. As many bytes as specified in the command.

then rising edge on CSN

 

Edit:

this probably makes the packet format command clearer. The first byte after CSN going low is the command, which already contains the register address. So the next byte(s) are the data for that register.

 

 

"Some people die at 25 and aren't buried until 75." -Benjamin Franklin

 

What is life's greatest illusion?"  "Innocence, my brother." -Skyrim

 

Last Edited: Wed. Jun 27, 2018 - 12:18 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

pawi777 wrote:
SPI means synchronous peripheral interface

Does it ... ?

 

https://en.wikipedia.org/wiki/Serial_Peripheral_Interface

 

cheeky

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...
Last Edited: Wed. Jun 27, 2018 - 12:49 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:

pawi777 wrote:
SPI means synchronous peripheral interface

Does it ... ?

 

https://en.wikipedia.org/wiki/Serial_Peripheral_Interface

 

cheeky

Uuups^^

 

I guess I was thinking of the S in USART... stupid meindecision

"Some people die at 25 and aren't buried until 75." -Benjamin Franklin

 

What is life's greatest illusion?"  "Innocence, my brother." -Skyrim

 

Last Edited: Wed. Jun 27, 2018 - 01:19 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

To be fair, it does match the acronym - and it does make sense!

 

I think "SSPI" is already taken, though ... ?

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

@S_K_U_N_X

Here's some code that might help you get going. The functions for sending and receiving stuff are not all fully finished yet and there are several versions for different purposes. But the defines and enumerations should all be fine.
To make the code work, you must either replace the NRF_spi function entirely or define the respective macros. It was meant for portability and flexibility. Here's an example definition for xmega, so you get an idea how I meant to use it:

#define NRF_CE_gp	7
#define NRF_CSN_gp	6
#define NRF_SCK_gp	1
#define NRF_MOSI_gp	0
#define NRF_MISO_gp	3
#define NRF_IRQ_gp	2

#define NRF_CE_bm (1<<NRF_CE_gp)
#define NRF_CSN_bm (1<<NRF_CSN_gp)
#define NRF_SCK_bm (1<<NRF_SCK_gp)
#define NRF_MOSI_bm (1<<NRF_MOSI_gp)
#define NRF_MISO_bm (1<<NRF_MISO_gp)
#define NRF_IRQ_bm (1<<NRF_IRQ_gp)


#define NRF_MISO PORTD.IN&NRF_MISO_bm
#define NRF_IRQ	PORTD.IN&NRF_IRQ_bm

#define NRF_CE_set PORTA.OUTSET=NRF_CE_bm
#define NRF_CE_clr PORTA.OUTCLR=NRF_CE_bm

#define NRF_CSN_set PORTA.OUTSET=NRF_CSN_bm
#define NRF_CSN_clr PORTA.OUTCLR=NRF_CSN_bm

#define NRF_SCK_set PORTD.OUTSET=NRF_SCK_bm
#define NRF_SCK_clr PORTD.OUTCLR=NRF_SCK_bm

#define NRF_MOSI_set PORTD.OUTSET=NRF_MOSI_bm
#define NRF_MOSI_clr PORTD.OUTCLR=NRF_MOSI_bm

-Patrick

Attachment(s): 

"Some people die at 25 and aren't buried until 75." -Benjamin Franklin

 

What is life's greatest illusion?"  "Innocence, my brother." -Skyrim

 

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

I'm still using the 24L01 as the range on the newer Bluetooth parts seem pretty low. Am I wrong?

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: 0

Thx pawi777 The nordic guys were slow and I ended up figure it out. This will be helpful also thx.