This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf_esb_tx_success not called in receive mode

Hello, I have looked at several posts on here, including- https://devzone.nordicsemi.com/question/3769/nrf51822-to-nrf24l01/

And followed the code, but I am trying to do the same thing, but in receive mode. However, nothing is sent back to the transmitter (an NRF24LE01+) which I set pipe 0 address to default of 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7. The code is here-

    byte pipe0Address[5] = {0xE7, 0xE7, 0xE7, 0xE7, 0xE7};	
    byte temp[5] = {0xBD, 0xB0, 0x35, 0x97, 0x82};
    byte nrfRxData[32];
       
    void EsbInitialize(void)
    {
    	nrf_esb_set_xosc_ctl(NRF_ESB_XOSC_CTL_AUTO); // Set auto handling for oscillator
    	nrf_esb_init(NRF_ESB_MODE_PRX); // Set receive mode
    	nrf_esb_set_output_power(NRF_ESB_OUTPUT_POWER_4_DBM); // Set output power to maximum 4db
    	nrf_esb_set_base_address_length(NRF_ESB_BASE_ADDRESS_LENGTH_4B); // Set address length
    	nrf_esb_set_enabled_prx_pipes(0x0003); // Enable receive pipes
    	nrf_esb_enable_dyn_ack(); // Enable dynamic acknowledge
    	nrf_esb_set_crc_length(NRF_ESB_CRC_LENGTH_2_BYTE); // Set 16 bit crc 
    	nrf_esb_set_datarate(NRF_ESB_DATARATE_2_MBPS); // Set data rate
    	nrf_esb_set_retransmit_delay(250); // Set retransmit delay to 250us
    	nrf_esb_set_max_number_of_tx_attempts(15); // Set retry limit to 15
    	nrf_esb_set_base_address_0(0xE7E7E7E7); // Set pipe 0 address
    	nrf_esb_set_address_prefix_byte(0, 0xE7); // Set pipe 0 prefix byte
    	nrf_esb_set_channel(40); // Set rf channel to 40
    	nrf_esb_add_packet_to_tx_fifo(0, temp, 5, NRF_ESB_PACKET_USE_ACK); // Add data to return data to transmtter
    	nrf_esb_add_packet_to_tx_fifo(0, temp, 5, NRF_ESB_PACKET_USE_ACK);
    	nrf_esb_enable(); // Enable chip
    }

void nrf_esb_rx_data_ready(uint pipe, int rssi)
{
	nrf_esb_fetch_packet_from_rx_fifo(pipe, nrfRxData, &length);
	nrf_esb_flush_rx_fifo(pipe);
}

void nrf_esb_tx_success(uint tx_pipe, int rssi) 
{
	nrf_esb_add_packet_to_tx_fifo(0, temp, 5, NRF_ESB_PACKET_USE_ACK);
}

void nrf_esb_tx_failed(uint tx_pipe) 
{
}

void nrf_esb_disabled(void) 
{
}

I hit a breakpoint on the nrf_esb_rx_data_ready function whenever I transmit a packet, but the function nrf_esb_tx_success never gets called and no data is ever received by the transmitter. Can anyone help?

Many Thanks.

  • So you get the RX_DR on the receiver side? Do you see any activity on the IRQ on either the receiver or the transmitter? I just want try to narrow down the possible options of fault here. Which side of the link do you get the nrf_esb_rx_data_ready on?

  • Hello Asbjørn,

    On further investigation, I have noticed:

    I set the transmitter address to 0xE7, 0xE7, 0xE7, 0xE7, 0xE7.

    On the rx side I use-

    nrf_esb_set_address_prefix_byte(0, 0xE7);

    nrf_esb_set_base_address_0(0xE7E7E7E7);

    and I do NOT call nrf_esb_enable_dyn_ack(), then I receive the tx data in nrf_esb_rx_data_ready()

    and call nrf_esb_add_packet_to_tx_fifo which does successfully send data to the tx.

    This is the only way I can get it to operate properly.

    However, if I DO call nrf_esb_enable_dyn_ack(), I do receive the tx data, and a call to nrf_esb_add_packet_to_tx_fifo() returns true, but the transmitter does not receive any ack data.

    Also, if I change the address to anything other than 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, it does not matter whether I call nrf_esb_enable_dyn_ack() or not, I receive the tx data, a call to nrf_esb_add_packet_to_tx_fifo() returns true, but no data is received by the transmitter.

  • Also: This only seems to work if the address is reversible. I tested 0xC3, 0xC3, 0xC3, 0xC3, 0xC3 and 0x81, 0x81, 0x81, 0x81, 0x81 So it seems to be something to do with the bit/byte order

  • Ok, It seems that it was the byte order that was wrong and I can get it to work now. But what is curious is, that this does not work if you call nrf_esb_enable_dyn_ack(); If you do, it seems that the tx packet is received, but no data is returned to the transmitter.

  • The ACK is sent to same address that it was received on, but on the PTX, this needs to be configured as address on Pipe0. All ACK are received on pipe0. Do you have a different address configured for pipe0 on the PTX than what is used for the TX operation?

Related