ESB PTX and PRX with no ACK - how to wait for TX ready

Hi,

we have ESB PTX and PRX couple from nRF54H20

nRF54H20DK (rev. 0.9.1), SDK: v2.9.0-nRF54H20-rc2 and the same Toolchain, IDE: VSCode + nRF Connect plugin

build for CPURAD


configured to 4Mbps
noACK and never disable TX radio

I need transmit about 10kBytes of data so speed as possible. When we used (ACK was activated) K_SEM() in PTX for TX ready detecting it was works good, but real data rate (including overhead) was about 2.3Mbps.
After this we deactivated the ACK, but ESB handler is not serviced in this mode.
I tried to check ESB TX ready by functions esb_tx_full() and esb_is_idle() but without success.
How can I check in PTX when is ESB ready for next TX?

Another, similar question - how to check in PRX whether ESB packet is received? (I hope that ESB handler works as usual (with AKC), but I am not sure).

My complementary question: How to set up config.slective_auto_ack for the right work with NoAck?

my prj.conf

CONFIG_NCS_SAMPLES_DEFAULTS=y
CONFIG_ESB=y
CONFIG_DK_LIBRARY=y
CONFIG_CLOCK_CONTROL=y

CONFIG_ESB_MAX_PAYLOAD_LENGTH=251
CONFIG_ESB_TX_FIFO_SIZE=256
CONFIG_ESB_RX_FIFO_SIZE=256
CONFIG_CRC=y
CONFIG_ESB_FAST_CHANNEL_SWITCHING=y
CONFIG_ESB_FAST_SWITCHING=y
CONFIG_ESB_NEVER_DISABLE_TX=y

Here is my ESB_init():

// *****************************************************************************
int drv_esb_init(ESBcontrol_t * esb_ptr, ESBconfig_t * esb_cfg)  // Attention, a function named "esb_init()" already exists in esb.c.
{
	int err;
	/* These are arbitrary default addresses. In end user products
	 * different addresses should be used for each set of devices.
	 */
    Esb_driver_ptr = esb_ptr;                               // catch pointer to instance
    esb_ptr->tx_sem_ptr = &esb_tx_done_sem;
	esb_ptr->rx_sem_ptr = &esb_rx_done_sem;
	esb_ptr->rx_fifo_ptr = &esb_rx_data_fifo;
    esb_ptr->tx_ready = true;
    esb_ptr->ack_enable = esb_cfg->ack_enable;

	struct esb_config config = ESB_DEFAULT_CONFIG;

	config.protocol = ESB_PROTOCOL_ESB_DPL;
	config.retransmit_delay = 250;
	config.bitrate = ESB_BITRATE_4MBPS;
	config.mode = esb_cfg->mode;
	config.event_handler = drv_esb_event_handler;
	config.payload_length = CONFIG_ESB_MAX_PAYLOAD_LENGTH;
//    config.selective_auto_ack = esb_cfg->ack_enable ? true : false;   // identity - old try
//    config.selective_auto_ack = esb_cfg->ack_enable ? false : true;   // inversion of user config: Selective auto acknowledgement.
				   // When this feature is disabled, all packets will be acknowledged ignoring the noack field.
	config.selective_auto_ack = true;				// respects the ACK configuraion (MS note)

	if (IS_ENABLED(CONFIG_ESB_FAST_SWITCHING)) {
		config.use_fast_ramp_up = true;
	}
		
#if TEST_DRV_ESB_INIT_PARAM_PRINT
    LOG_DBG("base_addr_0_ptr=%p, base_addr_1_ptr=%p, addr_prefix_ptr=%p ",
        esb_cfg->base_addr_0_ptr, esb_cfg->base_addr_1_ptr, esb_cfg->addr_prefix_ptr);
	LOG_DBG("tx_sem_ptr=%p, rx_fifo_ptr=%p, ack_enable=%d, selective_auto_ack=%d, use_fast_ramp_up=%d", 
		esb_ptr->tx_sem_ptr, esb_ptr->rx_fifo_ptr, esb_ptr->ack_enable, config.selective_auto_ack, config.use_fast_ramp_up);
#endif

	err = esb_init(&config);
	if (err) {
        LOG_ERR("esb_init() failed, err %d", err);
		return err;
	}

	err = esb_set_base_address_0(esb_cfg->base_addr_0_ptr);
	if (err) {
        LOG_ERR("esb_set_base_address_0() failed, err %d", err);
		return err;
	}

	err = esb_set_base_address_1(esb_cfg->base_addr_1_ptr);
	if (err) {
        LOG_ERR("esb_set_base_address_1() failed, err %d", err);
		return err;
	}

	err = esb_set_prefixes(esb_cfg->addr_prefix_ptr, ESB_PREFIX_SIZE);
	if (err) {
        LOG_ERR("esb_set_prefixes() failed, err %d", err);
		return err;
	}

	return 0;
}

Which is called from main() using:

    /* Initialize ESB driver. */
	ESBconfig_t drv_esb_cfg = {
		.base_addr_0_ptr = Base_addr_0,
		.base_addr_1_ptr = Base_addr_1,
		.addr_prefix_ptr = Addr_prefix,
		.mode = TRANSMIT_ESB_MODE,
		.ack_enable = TRANSMIT_ACK_CTRL,
	};

	err = drv_esb_init(&Esb_ctrl, &drv_esb_cfg);

Here is my project: 3386.ESB_noACK tetsing.ZIP

There is the  directory "ConfigInfo" with build info.

BR

Parents
  • Hi Peter, 

    I'm not so sure why you don't have the callback. On the sample the callback is triggered regardless if noack is set or not. My understanding is that if noack is set 

    ESB_EVENT_TX_SUCCESS will always returned. 
  • Hi,

    Now we are testing the modified original sample. We have increased the ESB payload to 251 bytes (CONFIG_ESB_MAX_PAYLOAD_LENGTH=251). What is the role of the following parameters?
    CONFIG_ESB_TX_FIFO_SIZE
    CONFIG_ESB_RX_FIFO_SIZE

    What values ​​should they have when we want to send more than 10 ESB packets in a row?

    What about the "PIPE" variable in the "esb_payload" structure? Should I, as a user, set it?

    How to properly use "esb_flush_tx()" when I want to have minimal delay between ESB packets?

    ******************

    When I changed the parameter on PTX and PRX "Never turn off radio transmission stage" to YES, communication stopped.

    BR

Reply
  • Hi,

    Now we are testing the modified original sample. We have increased the ESB payload to 251 bytes (CONFIG_ESB_MAX_PAYLOAD_LENGTH=251). What is the role of the following parameters?
    CONFIG_ESB_TX_FIFO_SIZE
    CONFIG_ESB_RX_FIFO_SIZE

    What values ​​should they have when we want to send more than 10 ESB packets in a row?

    What about the "PIPE" variable in the "esb_payload" structure? Should I, as a user, set it?

    How to properly use "esb_flush_tx()" when I want to have minimal delay between ESB packets?

    ******************

    When I changed the parameter on PTX and PRX "Never turn off radio transmission stage" to YES, communication stopped.

    BR

Children
  • Hi Peter, 

    Peter Langer Keysoft said:
    CONFIG_ESB_TX_FIFO_SIZE
    CONFIG_ESB_RX_FIFO_SIZE

    They are the length of the buffers, aka how many packets you can queue:

    Peter Langer Keysoft said:

    What values ​​should they have when we want to send more than 10 ESB packets in a row?

     If you want to be able to queue 10 ESB packet to send then you set CONFIG_ESB_TX_FIFO_SIZE=10. 

    Peter Langer Keysoft said:

    What about the "PIPE" variable in the "esb_payload" structure? Should I, as a user, set it?

    You can read more about "pipe" here: https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/protocols/esb/index.html#pipes_and_addressing

    Basically it's the logical address of each node that's connected to the PRX/PTX. 

    Peter Langer Keysoft said:

    How to properly use "esb_flush_tx()" when I want to have minimal delay between ESB packets?

    I don't think using this can reduce the delay between ESB packet. 

    Please try the CONFIG_ESB_FAST_SWITCHING=y to see it reduce the time it take between packets. 



    Regarding the Kconfig never disable TX: 

    config ESB_NEVER_DISABLE_TX
        select EXPERIMENTAL
        bool "Never disable radio transmission stage"
        help
          This option changes the radio behavior so that the
          transmitter remains IDLE between transmissions instead of being disabled.
          This is applicable only when the packet is not acknowledged. Otherwise,
          the radio emitter needs to be turned off to enable the radio receiver.
          This reduces delay between consecutive transmissions but consumes more energy.

    From what written here it should be able to reduce the time between TX packets. Please try testing on the SDK's sample.
  • Thanks for your answer,

    Activating ESB_NEVER_DISABLE_TX is excluded from the activated ESB_FAST_SWITCHING.

    When I activated ESB_NEVER_DISABLE_TX  to YES ESB handler was not handled. Only FAST_SWITCHING is good solution, but he have data rate only 3.34Mbps (10 x 256B / 29ms).

    I want to know why data rate is not 4Mbps and why activating ESB_NEVER_DISABLE_TX stops the handler service.

    How do you calculate the baud rate 4Mbps? Is 1kb = 1,000 or 1,024 bits and similarly for bytes

    Here is oscillogpraph for one ESB packet and 50x ESB packets

    I want to ask if when setting CONFIG_ESB_TX_FIFO_SIZE=50 and sending 50 ESB packets in quick succession, do I have to wait for TX READY from the ESB handler.

Related