Getting started with nrf24: Hardware connection2010/09/27
The nrf24 chips are all SPI-based, which means they use a bit clock (SCK), chip select (CS#), and two data lines (MISO, MOSI) to communicate with the host. In addition, there is a chip enable (CE) that is used as an external control over the radio itself. Finally, if your application calls for it, you can elect to connect the interrupt line (IRQ), which tells you when various events complete within the nrf24 itself, to save you from status polling.
I won’t cover the various non-digital connections at this point, but rather leave that to other sources such as the schematic for SparkFun’s nrf24l01+ module. I’ll probably write a section on that eventually though, stay tuned.
Now, to connect it to your average microcontroller, you simply want to find the SCK/MISO/MOSI pins and connect them straight across. The CS# pin may or may not go to one labeled on the microcontroller as such (or SS# for “slave select”), and in general it doesn’t matter because most microcontrollers do not maintain automatic control over the slave/chip select lines in master mode, since there could be an arbitrary number of them. CE is even more loose as far as were you connect it, since it’s not actually part of the SPI interface itself anyway. IRQ would ideally connect to a microcontroller pin that’s capable of actually triggering an interrupt, should you wish to use that functionality.
Here’s the nrf24l01+ connected up to an ATmegaXX8:
An Xmega is “better” since you can use any of the “serial” ports you want, and since every single pin is capable of triggering an interrupt you can wire IRQ anywhere you want as well:
However, if you are prepared to “bitbang” your interface, you can connect it any which way you want. If communication speed and efficiency is not your main concern, this can make your board routing significantly easier:
A special case are the various nrf24 chips which also contain microcontrollers. Examples are the nrf24LE1 and nrf24LU1(+). The actually SPI interface is present inside the chip, but instead of having to wire it up, they’ve simply connected them inside the chip. In that sense it’s almost the same as connecting up a nrf24l01+ to a regular 8051 microcontroller and using the existing SPI registers, except you’re just using a different SPI port. Kindof.
Now another option to seriously consider in your PCB design is that of actually driving the chip’s power entirely from the microcontroller. This gives you the ability to completely turn off the chip if you so desire (for power savings), or to hard reset the chip in case it goes wonky (which I seem to have happen on a regular basis):
Be sure that the maximum current of the nrf24l01+ does not exceed that which your microcontroller can supply. In the above case, the Xmega is capable of driving 20mA on each pin, which is plenty of headroom over the 13.5mA max draw of the nrf24l01+. If your chip doesn’t drive that hard, you can simply connect multiple pins together. Just make sure those pins all turn on at exactly the same time, or you’ll short out your power supply and probably fry your microcontroller…
The next post will cover the software side of the physical connection: getting and setting registers, transferring actual packet data, and making the radio actually radiate.