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

How to hope frequency after send Ack in ESB

Hi, I use a nRF52832 on pca10040 with s132 as RX and an arduino uno with a nRF2401L+ as TX

The nRF52 is a BLE NUS peripheral and can receive ESB packet with timeslot like this

The nRF24 send ESB packet every 10ms to the nRF52 and check for acknowledge

All this is working fine but, now i want the nRF52 and the nRF24 to change frequency every packet.

I can't find in nrf_esb.c where is send the acknowledge so i can change the frequency right after and I don't understand how work the acknowledge payload ( use the same fifo than tx packet ? )

Please, could anyone explain me. Thanks for you help!!

  • Hi Spectre,

    You don't have to modify the ESB library to implement frequency hopping. You can wait to catch NRF_ESB_EVENT_TX_SUCCESS in the event handler, this mean the packet is ACKed.

    The acknowledge payload use the TX fifo, it's true.

    If you want to dig deeper in the code, the ACK handling on the PRX side is handled at on_radio_disabled_rx() this is called right after we disable RX to get to TX and check if ACK is needed to send.

    Note that there is a SHORT set at the beginning of RX period in nrf_esb_start_rx():

       NRF_RADIO->SHORTS      = RADIO_SHORTS_COMMON | RADIO_SHORTS_DISABLED_TXEN_Msk;
    

    This mean when the radio (in RX mode) is disabled, try to send TX packet (the ACK packet) What on_radio_disabled_rx() does is to decide if we should send the TX packet (ACK packet) and what should be inside that ACK packet. If we don't need to send ACK then TASK_DISABLE will be called to cancel the TXEN task.

    Anyway, you don't have to modify the library to achieve what you want to do. The only draw back of this solution (instead of using timeslot like in Gazell for channel hopping) is that if the current channel is totally blocked, you have no way to tell the peer device to switch to other channel. But this is not a very common situation I would assume.

  • When empty ack packet is send, i don't receive a NRF_ESB_EVENT_TX_SUCCESS

  • Sorry for late response. Which event you receive if you don't receive NRF_ESB_EVENT_TX_SUCCESS ? If a packet is ACKed it should send the NRF_ESB_EVENT_TX_SUCCESS event on the PTX side. On the PRX side you should not receive that event.

Related