Hello everyone,
I've got an issue with ESB. I'm using 3 nRFs 52840 with firmware based on SDK 15.2. One of them, the radio-receiver is RX, and two of them, PilotA and PilotB are TX. The communication works fine, but the problem is releated with the payload, which is sent with ack by RX (radio receiver) to Tx (Pilots). The payload should be different and sent to TX1 through pipe 0, and to TX2 through pipe1. I'm using a segger_printf function to see what payload is received by the Pilots. Tx1 (PilotA) should receive payload from Rx with the first byte payload 0xAA, and the PilotB should receive 0xBB.
The addresses are set properly, because the transmission works fine, they are the same as in example.
The transmission log from PilotB is like follows:
I think this can be realeated with tx_fifo in the RX. Is there any way to make it works as I want? In fact, the communication rate is 50% because of this issue. The payload, which should be sent to PilotA is useless to PilotB.
event_handler in Radio-receiver (Rx):
void nrf_esb_event_handler(nrf_esb_evt_t const * p_event)
{
switch (p_event->evt_id)
{
case NRF_ESB_EVENT_TX_SUCCESS:
SEGGER_RTT_printf(0,"Sending packet to %d, SUCCESS\n", tx_payload.pipe);
break;
case NRF_ESB_EVENT_TX_FAILED:
SEGGER_RTT_printf(0, "TX FAILED EVENT");
break;
case NRF_ESB_EVENT_RX_RECEIVED:
if (nrf_esb_read_rx_payload(&rx_payload) == NRF_SUCCESS)
{
// Set LEDs identical to the ones on the PTX.
SEGGER_RTT_printf(0,"RX RECEIVED FROM PIPE %02x\n", rx_payload.pipe );
SEGGER_RTT_printf(0,"RECEIVED PACKET: %02x:%02x:%02x:%02x\n", rx_payload.data[0], rx_payload.data[1], rx_payload.data[2],
rx_payload.data[3]);
if(rx_payload.pipe == 0) tx_payload.data[0] = 0xAA;
else if (rx_payload.pipe == 1) tx_payload.data[0] = 0xBB;
tx_payload.pipe = rx_payload.pipe;
SEGGER_RTT_printf(0,"RX PIPE: %02x\n", rx_payload.pipe);
SEGGER_RTT_printf(0,"TX PIPE: %02x\n", tx_payload.pipe);
SEGGER_RTT_printf(0,"SENDING PACKET: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", tx_payload.data[0], tx_payload.data[1], tx_payload.data[2]);
nrf_esb_write_payload(&tx_payload);
}
break;
}
}
event_handler in Pilots (Tx):
void nrf_esb_event_handler(nrf_esb_evt_t const * p_event)
{
switch (p_event->evt_id)
{
case NRF_ESB_EVENT_TX_SUCCESS:
SEGGER_RTT_printf(0, "TX SUCCESS EVENT\n");
SEGGER_RTT_printf(0,"Sending packet to %d, SUCCESS\n", tx_payload.pipe);
break;
case NRF_ESB_EVENT_TX_FAILED:
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)
{
SEGGER_RTT_printf(0,"RECEIVED PACKET FROM PIPE %02x\n", rx_payload.pipe );
if (rx_payload.length > 0)
{
SEGGER_RTT_printf(0,"PACKET RECEIVED: %02x:%02x:%02x\n", rx_payload.data[0], rx_payload.data[1], rx_payload.data[2]);
}
}
break;
}
}
Thank you for replies.