Esb Packet gap issue and packet “mtu”

Hi,

  I developed with ncs 2.1 samples esb ptx and prx using nrf52840 make a low latency application,There are two problems

①On the ptx side, packets are sent twice in a row;At the receiving end, the packet gap is about 8 milliseconds。How much milliseconds the esb minimum packet gap ?How to reduce packet gap?

②Use the maximum 252 packets to send it return “Payload write failed, err -122”,esb_start_tx() it retun -61,It took many days to debug there is no progress,The attachments are code and configuration

esb.zip

  • Hi,

     

    ①On the ptx side, packets are sent twice in a row;At the receiving end, the packet gap is about 8 milliseconds。How much milliseconds the esb minimum packet gap ?How to reduce packet gap?

     The time for one transaction depends on the packet length. If your overall on-air payload is 250 bytes, the calculation is:

    Tramp-up + Tpayload = 130 us + 250 bytes * 8 bit * 1/2Mbit = 1130 us.

     

    You'll also have to account for the ACK from the PRX.

    ②Use the maximum 252 packets to send it return “Payload write failed, err -122”,esb_start_tx() it retun -61,It took many days to debug there is no progress,The attachments are code and configuration

    ptx/src/main.c::154 sets the payload length to 126. Try setting this to 252.

     

    Also, you should set the .protocol to "ESB_PROTOCOL_ESB_DPL" and consider using 2 byte CRC. This change must be applied to both PRX and PTX.

     

    Kind regards,

    Håkon

  • Hi,

      According to your modification, 252 bytes work fine。On the tx side, I'm sending data in the send success callback, which is a huge gap every 252 bytes,About 6.7 ms,How to reduce every 252 bytes gap?As shown in the picture below

  • Hi,

     

    1. Don't print in the event_handler. This applies to both PRX and PTX project.

    This is because the default setting is that you log in-place.

    You can override this by setting:

    "CONFIG_LOG_MODE_DEFERRED=y" 

     

    2. Your PTX seems to send only when flag "ready" is set. However, the main loop also includes a k_sleep():

    if (ready) {
    	/* Send logic here */
    }
    k_sleep(K_MSEC(1000));

    Try changing the k_sleep(..) to a k_cpu_idle() call instead.

    Kind regards,

    Håkon

Related