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

ESB event handler not called in PTX mode

Hi,

I wrote a program that uses ESB communication between two nodes. On both sides I use the same ESB configuration and the same ESB init function, the difference is only what the nrf_esb_mode is being set to (NRF_ESB_MODE_PTX or NRF_ESB_MODE_PRX, respectively).

Now if I set my node to be PRX, my event handler is called with NRF_ESB_EVENT_RX_RECEIVED for each incoming packet, which is good.

But if I set my node to be PTX, and I put a payload into the ESB FIFO by calling nrf_esb_write_payload(...) [which returns with NRF_SUCCESS], nothing happens. I see no packets coming in on the other side, and also, my event handler is not called with whatever event (no NRF_ESB_EVENT_TX_SUCCESS nor NRF_ESB_EVENT_TX_FAILED) on the TX side.

How can that be?

May that be an issue of changing ESB mode from RX to TX and vice versa, which I do quite often in my code?

(It is not easy to extract my code from the framework I use, so theoretical answers would be preferred.)

Thanks! NewtoM

  • OK, it was a long journey, but I seem to have the answer.

    To properly change role from PRX to PTX it is not enough to change nrf_esb_mode and call nrf_esb_init() with the changed configuration. It is also necessary to call nrf_esb_stop_rx() prior to that. Then, events will occur and can be handled in PTX mode as expected.

    Vice versa, when changing from PTX to PRX, aftger the nrf_esb_init() also nrf_esb_start_rx() needs to be called.

Related