I had used this module when I was doing my senior project in 2014-2015. This pretty small chip can handle 2.4 GHz RF operation with low cost and low energy consumption. I guess best thing for this chip is that you can find bunch of different libraries in GitHub. We will not use any of them in this note series. Instead we will try to write our own small library. Obviously it will not be comprehensive as others in market but will help you to get almost all consept of RF communication with NRF24L01+.
Let's start with block diagram of complete chip.
As you can see in the above block diagram, there are built-in RF TX and RX units inside chip. This means that you do not need two different TX and RX modules to be able to utilize TX and RX operations. Chip can be dedicated as either TX or RX by setting up a few register.
NRF communicates with MCU and other modules through SPI. Unfortunately SPI is the only way to communicates with NRF for at least NRF24L01+. Based on your TX and RX operation, you need to set related registers through SPI to start communication. One of the NRF strengths is Enhanced ShockBrust Baseband Engine which I'll cover later on this notes.
NRF24L01+ has 4 different operation modes. These are power down, stand-by, TX and RX modes. These modes are controlled by Radio Control unit as shown in block diagram. In this point, you need to know operation diagram of NRF which is shown in the below image. Check this image just to have an overall idea about chip operations. If you do not understand something as you are checking, that's totally fine because you need to know also something about a few critical register which controls these states.
4. PA CONTROL
Let's start with block diagram of complete chip.
As you can see in the above block diagram, there are built-in RF TX and RX units inside chip. This means that you do not need two different TX and RX modules to be able to utilize TX and RX operations. Chip can be dedicated as either TX or RX by setting up a few register.
NRF communicates with MCU and other modules through SPI. Unfortunately SPI is the only way to communicates with NRF for at least NRF24L01+. Based on your TX and RX operation, you need to set related registers through SPI to start communication. One of the NRF strengths is Enhanced ShockBrust Baseband Engine which I'll cover later on this notes.
NRF24L01+ has 4 different operation modes. These are power down, stand-by, TX and RX modes. These modes are controlled by Radio Control unit as shown in block diagram. In this point, you need to know operation diagram of NRF which is shown in the below image. Check this image just to have an overall idea about chip operations. If you do not understand something as you are checking, that's totally fine because you need to know also something about a few critical register which controls these states.
Now let's see what are these modes?
1. MODES
1.1. Power Down Mode
In this mode NRF is in low current consumption. All registers maintain their current status and SPI is still enabled to set/reset registers. Going power down mode is easy and all you need to do is to set
PWR_UP bit to low in CONFIG register.
1.2/ Standby Mode
There are two different standby modes in NRF24L01+. Based on user seletion NRF shows different reaction in terms of standby modes.
1.2.1. Standby-1 Mode
After 1.5ms as soon as PWR_UP bit is set to high, chip goes standby-1 mode. While you are coding you need to keep this in mind 1.5ms latency from power down mode to standby-1. MCU needs to be delayed at least 1.5ms after power up to catch up same schedule with NRF. If you don't, chip can discard your command. When chip is in RX or TX mode and CE pin is set to low, chip goes standby-1 mode.
Difference Between Power Down and Standby-1
Standby-1 mode consumes more energy than power down mode but needs less time to be ready to start TX and RX communication. So if user doesn't use RX and TX communication for a long time, it might be useful to go power down mode to decrease power consumption. Unlike, if user performs intense communication, it is better to stay in standby-1 mode for better user experience in terms of time delay.
1.2.2. Standby-2 Mode
In standby-2 mode extra clock buffers are active and more current is used compared to standby-1 mode. Chip goes standby-2 mode if CE pin is held high on TX operation with an empty TX FIFO.
Current registers setup are maintained and SPI is active during each standby modes.
1.3. RX Mode
1. MODES
1.1. Power Down Mode
In this mode NRF is in low current consumption. All registers maintain their current status and SPI is still enabled to set/reset registers. Going power down mode is easy and all you need to do is to set
PWR_UP bit to low in CONFIG register.
1.2/ Standby Mode
There are two different standby modes in NRF24L01+. Based on user seletion NRF shows different reaction in terms of standby modes.
1.2.1. Standby-1 Mode
After 1.5ms as soon as PWR_UP bit is set to high, chip goes standby-1 mode. While you are coding you need to keep this in mind 1.5ms latency from power down mode to standby-1. MCU needs to be delayed at least 1.5ms after power up to catch up same schedule with NRF. If you don't, chip can discard your command. When chip is in RX or TX mode and CE pin is set to low, chip goes standby-1 mode.
Difference Between Power Down and Standby-1
Standby-1 mode consumes more energy than power down mode but needs less time to be ready to start TX and RX communication. So if user doesn't use RX and TX communication for a long time, it might be useful to go power down mode to decrease power consumption. Unlike, if user performs intense communication, it is better to stay in standby-1 mode for better user experience in terms of time delay.
1.2.2. Standby-2 Mode
In standby-2 mode extra clock buffers are active and more current is used compared to standby-1 mode. Chip goes standby-2 mode if CE pin is held high on TX operation with an empty TX FIFO.
Current registers setup are maintained and SPI is active during each standby modes.
1.3. RX Mode
To enter this mode, PWR_UP, PRIM_RX register bits have to be set to high. Also CE pin must be pulled high to enable chip.
In RX mode the receiver demodulates RF channel signals and send demodulated data to baseband protocol engine. Baseband protocol engine looks for valid packet in terms of address and CRC. If there is match, data stored in RX FIFO register. If there is no vacant slot in RX FIFO, received packet is discarted.
So as we understand from the upper paragraph, we have to setup a pipline address between TX and RX devices based on address rules on datasheet. This is important to have smooth communication.
1.4. TX Mode
Entering TX mode is quite similar with going RX mode. Only difference is you need to reset PRIM_RX bit instead of setting. All the others are same.
All this settings are compulsory but not enough to have healthy communication between two devices. Also you need to set others settings such as air rate, RF channel frequency and so on. Let's summarize one by one.
2. AIR DATA RATE
The air data rate is the modulated signaling rate the NRF uses when transmitting and receiving data. It can be 250Kbos, 1Mbps or 2Mbps.
As lower air rate provides better receiver sensitivity, higher air rate provides lower power consumption.
Air data rate is set by RF_DR bit in RF_SETUP register. It is important to set both transmitter and receiver with same air data rate.
3. RF CHANNEL FREQUENCY
NRF can be operated on frequencies from 2.400GHz to 2.525Ghz. The RF channel is set by RF_CH register. Also it is crucial to share same frequency both for transmitter and receiver.
F = 2400 + RF_CH[MHz] is the equation to calculate frequency of device depending on RF_CH register.
4. PA CONTROL
Power amplifier is used to set output power of NRF. In TX mode PA might have four programmable modes.
Comments
Post a Comment