nRF5 SDK v16.0.0
Low Power Transmitter/Receiver Example

This example shows how to use Enhanced ShockBurst (ESB) in an energy-efficient way. Conserving energy is important, for example, when one device is on a small battery that is intended to last for a long period of time while the other device has access to an abundant power source.

This example consists of two applications: a low power Transmitter and a Receiver. The idea is that the Transmitter conserves as much energy as possible and can therefore run on a small battery, while the Receiver needs more power. The Receiver is always on and listens for packets from the Transmitter whenever the Transmitter is active.

The applications are compatible with the nRF24L ESB examples found in the legacy nRFgo SDK. Therefore, you can test the example by programming the supplied applications on two nRF5 development boards, or by programming one of the applications on an nRF5 development board and testing it with the counterpart application from the legacy nRFgo SDK, programmed on an nRF24LE1 device.

If you choose to test one of the applications against a legacy example, you must do a small change to the application code, because the nRF24L ESB examples do not support all features that the Enhanced ShockBurst module provides. Before you compile and program the application to the nRF5 development board, add the following define to the main.c file of the example to make it compatible with nRF24L:

#define NRF_ESB_LEGACY

Low power Transmitter

You can find the source code and the project file of the example in the following folder: <InstallFolder>\examples\proprietary_rf\esb_low_power_ptx

Compile and program the Transmitter application on a board. This application requires a Receiver as counterpart. Either program the Receiver application on a second board or use an nRF24LE1 device running the PRX example from the nRFgo SDK.

This example application focuses on powering off as much as possible to conserve energy. Most of the time is spent in System OFF state, where almost all parts of the system (including the RAM) are powered off to conserve power. The system does not resume execution when it wakes up, but rather restarts and recovers the state of the system from the GPREGRET register.

When the device is connected to a power source, the application sets up the retention register GPREGRET to count the number of times that the system has woken up. This information is also used to detect the difference between the first startup and waking up, and it is added to the payload that is transmitted to ensure that packets are not identical (and therefore discarded as retransmits). Finally, the application configures the GPIO to wake up the system when a button press is detected, and the system goes to System OFF.

When a button is pressed to wake up the device, the application transmits a packet that describes which button was pressed. It then waits for either a failure or a response from a Receiver.

The Receiver application sends an acknowledgment with payload, where the payload describes the state of the LEDs of the Receiver. This response is visualized by lighting the LEDs on the Transmitter identically to the LEDs on the Receiver. The LEDs are lit as long as the user pushes a button.

The legacy Receiver example from the nRFgo SDK does not support acknowledgments with payload. Therefore, there is no LED activity if you use the low power Transmitter with a legacy Receiver.

After each successful transmission, the wakeup count in the GPREGRET register is updated, and the system returns to System OFF.

Receiver

You can find the source code and the project file of the example in the following folder: <InstallFolder>\examples\proprietary_rf\esb_low_power_prx

Compile and program the Receiver application on a board. This application requires a Transmitter as counterpart. Either program the Low power Transmitter application a second board or use an nRF24LE1 device running the PTX example from the nRFgo SDK.

This example application is always on and listens for ESB packets. This behavior is not energy efficient, but the purpose is to allow the Transmitter to conserve energy by receiving transmissions at arbitrary times.

Each LED on the board that runs the Receiver application is either on or off. Every time a payload is received that indicates that a button on the Transmitter was pressed, the state of the corresponding LED is toggled. After receiving data from the Transmitter, the application sends an acknowledgment with a payload that contains the state of the LEDs.

Note that because of timing requirements, the Enhanced ShockBurst module does not wait for the application to upload an acknowledgment packet, but rather uses a packet that was uploaded before the radio interrupt. This means that the state that is shared in the acknowledgment payload is always outdated by one event, but because the pressed button is known to the Transmitter, the state can be updated when the packet is received.


Documentation feedback | Developer Zone | Subscribe | Updated