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 Reply Children
  • 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

Related