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

ESB - One RX and two Tx-es problem with payload.

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.

Parents Reply Children
  • Hello,

    I think I've find out what the problem is. In the ESB User Guide there is: 

    Note that this TX packet must have been uploaded to the TX FIFO before the packet is received.

    So in my code, the nrf_esb_write_payload function can't be used in a RX_RECEIVED event. Other problem is related with the topic, because I want to add different payload to each pipe:

    https://devzone.nordicsemi.com/f/nordic-q-a/40009/esb-ack---queuing-different-payload-by-rx-pipe

    "In the nRF52 implementation you can have a much larger FIFO if you like, but when a packet is received on the radio the ESB library will only look at the oldest packet in the FIFO to see if there is a pipe match. In other words, if you have multiple packets loaded for different pipes then you need to send packets in the same pipe order from the TX as you upload packets on the RX side, which severely limits the flexibility of the ACK payload feature when using more than one pipe. "

    In the ESB User Guide there is also an information:
    "When multiple packets are queued, they are handled in a FIFO fashion, ignoring pipes.", which I think occur in my case. In conclusion, I can't send differend payloads to different pipes using only one TX_FIFO without changing the library - am I right?

  • Hi,

    Sorry for missing this..

    asobol said:
    In the ESB User Guide there is also an information:
    "When multiple packets are queued, they are handled in a FIFO fashion, ignoring pipes.", which I think occur in my case. In conclusion, I can't send differend payloads to different pipes using only one TX_FIFO without changing the library - am I right?

    I verified the behavior by checking with the developer. Your understanding is correct.

     

    Kind regards,

    Håkon 

Related