Hi.
I am experimenting with using a nRF52832 to communicate with a nRF24L01+. It is almost working, the nRF52 is sending a packed to the nRF24 ok, and the NRF_ESB_EVENT_TX_SUCCESS event is triggered when the device is in range, so it must be at least detecting the ACK packet back to know the message got through ok. If I turn the nRF24 off (which is setup as RX) then the NRF_ESB_EVENT_TX_FAILED event is triggered instead.
However I am struggling to get the NRF_ESB_EVENT_RX_RECEIVED: event to trigger so I can read the ACK packet.
Basically my question is what will cause the NRF_ESB_EVENT_RX_RECEIVED event to trigger rather than the NRF_ESB_EVENT_TX_SUCCESS? Will it only be triggered when in RX mode, and not by an ACK packet. If so where would I read this ACK payload?
Thanks
void nrf_esb_event_handler(nrf_esb_evt_t const * p_event)
{
nrf_gpio_pin_set(LED_3);
nrf_gpio_pin_set(LED_4);
switch (p_event->evt_id)
{
case NRF_ESB_EVENT_TX_SUCCESS:
nrf_gpio_pin_clear(LED_4); //turn on LED
//NRF_LOG_DEBUG("TX SUCCESS EVENT");
break;
case NRF_ESB_EVENT_TX_FAILED:
nrf_gpio_pin_clear(LED_3); //turn on LED
//NRF_LOG_DEBUG("TX FAILED EVENT");
(void) nrf_esb_flush_tx();
(void) nrf_esb_start_tx();
break;
case NRF_ESB_EVENT_RX_RECEIVED:
//NRF_LOG_DEBUG("RX RECEIVED EVENT");
while (nrf_esb_read_rx_payload(&rx_payload) == NRF_SUCCESS)
{
nrf_gpio_pin_clear(LED_2);
if (rx_payload.length > 0)
{
//NRF_LOG_DEBUG("RX RECEIVED PAYLOAD");
}
}
break;
}
NRF_GPIO->OUTCLR = 0xFUL << 12;
NRF_GPIO->OUTSET = (p_event->tx_attempts & 0x0F) << 12;
}