nRF51 SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Enhanced Shockburst Transmitter (PRX)

Functions

int main ()
 Main function. More...
 

Configuration

static uint8_t my_tx_payload [TX_PAYLOAD_LENGTH]
 Payload to send to PRX.
 
static uint8_t my_rx_payload [NRF_ESB_CONST_MAX_PAYLOAD_LENGTH]
 Placeholder for received ACK payloads from PRX.
 
#define PIPE_NUMBER   0
 We use pipe 0 in this example.
 
#define BUTTONS   NRF_GPIO_PORT_SELECT_PORT0
 GPIO port for reading from buttons.
 
#define LEDS   NRF_GPIO_PORT_SELECT_PORT1
 GPIO port for writing to LEDs.
 
#define TX_PAYLOAD_LENGTH   1
 We use 1 byte payload length when transmitting.
 

ESB callback function definitions

void nrf_esb_tx_success (uint32_t tx_pipe, int32_t rssi)
 TX success callback. More...
 
void nrf_esb_rx_data_ready (uint32_t rx_pipe, int32_t rssi)
 RX data ready callback. More...
 
void nrf_esb_tx_failed (uint32_t tx_pipe)
 TX failed callback (PTX mode only). More...
 
void nrf_esb_disabled (void)
 Disabled callback. More...
 

Detailed Description

This project requires that a device running the Enhanced Shockburst Transmitter (PRX) is used as a counterpart for receiving the data. This can be on either nRF51 device or a nRF24LE1 device running the esb_prx_example in the nRFgo SDK.

This example listens for a packet and sends an ACK when a packet is received. The contents of the first payload byte of the received packet is output on the GPIO Port BUTTONS. The contents of GPIO Port LEDS are sent in the first payload byte (byte 0) of the ACK packet.

Function Documentation

int main ( void  )
Returns
ANSI required int return type.
void nrf_esb_tx_success ( uint32_t  tx_pipe,
int32_t  rssi 
)

In PTX mode this function is called after the PTX has sent a packet and received the corresponding ACK packet from a PRX.

In PRX mode this function is called after a payload in ACK is assumed successfully transmitted, that is when the PRX received a new packet (new PID or CRC) and the previous ACK sent to a PTX contained a payload.

Parameters
tx_pipeThe pipe on which the ACK packet was received.
rssiReceived signal strength indicator in dBm of measured ACK.

As the RSSI measurement requires a minimum on-air duration of the received packet, the measured RSSI value will not be reliable when ALL of the following criteria are met:

  • Datarate = 2 Mbps
  • Payload length = 0
  • CRC is off
void nrf_esb_rx_data_ready ( uint32_t  rx_pipe,
int32_t  rssi 
)

PTX mode: This is called after an ACK is received from a PRX containing a payload.

PRX mode: This is called after a packet is received from a PTX ACK is received from a PRX containing a payload.

Parameters
rx_pipeis the pipe on which a packet was received. This value must be < NRF_ESB_CONST_PIPE_COUNT.
rssiReceived signal strength indicator in dBm of packet.

As the RSSI measurement requires a minimum on-air duration of the received packet, the measured RSSI value will not be reliable when ALL of the following criteria are met:

  • Datarate = 2 Mbps
  • Payload length = 0
  • CRC is off
void nrf_esb_tx_failed ( uint32_t  tx_pipe)

This is called after the maximum number of TX attempts were reached for a packet. The packet is deleted from the TX FIFO.

Note that when NRF_ESB_PACKET_NO_ACK is used this callback is always made after sending a packet.

See Also
nrf_esb_set_max_number_of_tx_attempts().
Parameters
tx_pipeThe pipe that failed to send a packet.
void nrf_esb_disabled ( void  )

This is called after ESB enters the disabled state. There is no further CPU use by ESB, the radio is disabled and the timer is powered down.