<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>ESB PRX problem with sending ACK payload</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/83179/esb-prx-problem-with-sending-ack-payload</link><description>Hello. I can&amp;#39;t normally use USB for two-way communication. 
 The problem is sending the PRX payload in ACK packets. 
 After conducting a simple test: PPTX sends a packet once a second and displays its serial number on the screen, then receives a packet</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 28 Jan 2022 14:57:33 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/83179/esb-prx-problem-with-sending-ack-payload" /><item><title>RE: ESB PRX problem with sending ACK payload</title><link>https://devzone.nordicsemi.com/thread/350251?ContentTypeID=1</link><pubDate>Fri, 28 Jan 2022 14:57:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f07a7e35-aa97-4150-95da-456e2e9340b2</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I agree it is a bit tricky to follow the flow of the protocol. One of the things that complicate the ACK payload procedure is that you are not allowed to remove an ACK payload from the FIFO or trigger the TX interrupt on the PRX side until you receive the next packet from the PTX (with different PID and CRC).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The reason for this is that&amp;nbsp;as long as you just receive the same packet from the PTX (same PID and CRC) you must assume that the PTX has not received any ACK&amp;#39;s, and you have to retransmit the same ACK over and over.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The code you altered should only run once the PRX receives the next packet from the PTX,&amp;nbsp;at which point it will decrement the tx_fifo counter and check if there is a second packet in the TX FIFO that needs to be included in the ACK packet.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you have any issues integrating the patched library just let me know. The API is the same, so integrating it should be relatively straight forward.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ESB PRX problem with sending ACK payload</title><link>https://devzone.nordicsemi.com/thread/349979?ContentTypeID=1</link><pubDate>Thu, 27 Jan 2022 12:54:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:48298acf-f696-4fdc-a94d-bce600260183</guid><dc:creator>Andrej102</dc:creator><description>&lt;p&gt;Thank you so much for your reply. The ESB library is not so easy to understand, especially in the issue of package maintenance with AK, so I could not formulate the problem very precisely. You have formulated it very precisely. As I already wrote, I seem to have managed to find workarounds for the problem under discussion in the NRF SDK library. I can&amp;#39;t immediately understand the code you offer and test it due to my heavy employment. As soon as I have time, I will definitely test your proposed ESB implementation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ESB PRX problem with sending ACK payload</title><link>https://devzone.nordicsemi.com/thread/348465?ContentTypeID=1</link><pubDate>Wed, 19 Jan 2022 11:01:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1332260c-181a-4da1-a0dd-df83cda42175</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For the longest time there was a problem with the ACK payload mechanism in the ESB library, which would cause issues when uploading ACK payloads for multiple pipes at once as you describe. Essentially the library would only check the oldest packet in the FIFO, regardless of which pipe it received a packet on.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I made a patch to the library to fix this which I shared &lt;a href="https://github.com/too1/nrf52-esb-buffer-improvements"&gt;here&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/index.html"&gt;nRF Connect SDK&lt;/a&gt; version of the ESB library this patch is applied, but it was never fixed in the nRF5 SDK implementation unfortunately.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you give the patched library a go and see if it works better, and if not which issues are still remaining?&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ESB PRX problem with sending ACK payload</title><link>https://devzone.nordicsemi.com/thread/348251?ContentTypeID=1</link><pubDate>Tue, 18 Jan 2022 11:14:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e61c1a8b-6fef-4d00-9027-22833a695f0b</guid><dc:creator>Andrej102</dc:creator><description>&lt;p&gt;Hello.&lt;/p&gt;
&lt;p&gt;SDK version:&amp;nbsp;nRF5_SDK_17.0.2_d674dde. Device NRF52840.&lt;/p&gt;
&lt;p&gt;I have a slightly non-standard complex scenario of working on ESB.&lt;/p&gt;
&lt;p&gt;If in short: 1 receiver and many transmitters. Data is exchanged between the receiver and one transmitter on channel 1, receiving connection requests and sending responses to them on channel 0.&lt;/p&gt;
&lt;p&gt;The transmitter on pipe 0 requests permission to connect to the receiver. If the transmitter accepts the permission confirmation, it switches to pipe&amp;nbsp;1 and further data exchange between the connected receiver and the transmitter is carried out on pipe 1 (the address of pipe 1 is unique for each transmitter).&amp;nbsp;The transmitter is switched off either by command or by timeout.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The data length is up to 252 bytes, the speed is 2 Mbit, the ACK timeout is 2 ms, the resend is 2. If the transfer is not successful, the PTX TX FIFO is collected.&lt;/p&gt;
&lt;p&gt;The receiver, when accepting a connection request and deciding to connect, sets the unique address of the transmitter on its pipe 1 and is thus able to exchange data with it. In addition, the receiver also remains capable of receiving and responding on pipe 0. When the receiver is disconnected, it stops receiving data on pipe 1 and reconfigures the address on it, and also resets the PRX TX FIFO using its own function.&lt;/p&gt;
&lt;p&gt;Of course, the whole mechanism of interaction is more complicated, but the main point is exactly this.&lt;/p&gt;
&lt;p&gt;I can personally give you the code of the corrected ESB library, the code of all functions related to working with ESB.&lt;/p&gt;
&lt;p&gt;In fact, the problem in question does not depend on the implementation of the ESB algorithm, I see that there is a problem with resetting PRX TX FOFO. More precisely, one of the obvious problems is that when switching from work on one pipe to another, and always with a different address, there is a need to reset the PRX TX FIFO, otherwise if we started working on another pipe and there will be no more calls from the transmitter on the previous pipe, then the PRX TX FIFO remains filled forever, which ultimately leads to the inability of the receiver to send anything to the transmitter - two-way communication is broken.it just does not always affect the work, but in my scenario it turned out to be critical. I am also interested in your opinion about the change in the ESB library code that I took above, after this change everything seems to have worked stably for me.&lt;/p&gt;
&lt;p&gt;Maybe my description is a little confusing, but I hope the meaning will be clear.&lt;/p&gt;
&lt;p&gt;Since you asked about the settings:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;uint8_t base_addr_0[4] = {0xE7, 0xE7, 0xE7, 0xE7};
uint8_t base_addr_1[4] = {0xC2, 0xC2, 0xC2, 0xC2};
uint8_t addr_prefix[8] = {0xE7, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8};

uint32_t esb_init (void)
{
    uint32_t err_code;

    nrf_esb_set_rf_channel(device.settings.rf_frequency);

    nrf_esb_config_t nrf_esb_config         = NRF_ESB_DEFAULT_CONFIG;

    nrf_esb_config.retransmit_count         = 2;
    nrf_esb_config.tx_output_power          = NRF_ESB_TX_POWER_8DBM;
    nrf_esb_config.selective_auto_ack       = true;
    nrf_esb_config.protocol                 = NRF_ESB_PROTOCOL_ESB_DPL;
    nrf_esb_config.bitrate                  = NRF_ESB_BITRATE_2MBPS;
    nrf_esb_config.payload_length           = NRF_ESB_MAX_PAYLOAD_LENGTH;
    nrf_esb_config.event_handler            = nrf_esb_event_handler;
    nrf_esb_config.retransmit_delay         = 2000;
    
#ifdef MODE_PRX 
    nrf_esb_config.mode = NRF_ESB_MODE_PRX;
#else
    nrf_esb_config.mode = NRF_ESB_MODE_PTX;
#endif

    nrf_esb_init(&amp;amp;nrf_esb_config);

    nrf_esb_set_base_address_0(base_addr_0);

    nrf_esb_set_base_address_1(base_addr_1);

    nrf_esb_set_prefixes(addr_prefix, 8);

    NRF_RADIO-&amp;gt;MODECNF0 = (NRF_RADIO-&amp;gt;MODECNF0 &amp;amp; ~RADIO_MODECNF0_RU_Msk) | (RADIO_MODECNF0_RU_Fast &amp;lt;&amp;lt; RADIO_MODECNF0_RU_Pos);

#ifdef MODE_PRX 
    nrf_esb_start_rx();
#endif

    return NRF_SUCCESS;
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ESB PRX problem with sending ACK payload</title><link>https://devzone.nordicsemi.com/thread/348215?ContentTypeID=1</link><pubDate>Tue, 18 Jan 2022 09:42:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0c9d799a-92ae-4e65-97a3-2a57aa5cfd9d</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I will help you out with this case, since I have worked a lot with the ESB library.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Can you first let me know which SDK type and version you are using?&lt;/p&gt;
&lt;p&gt;What is your retransmit_count configuration set to?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;By default it is only set to 3, which means you only have 3 attempts at retransmitting the payload in case of packet loss. Could you try to increase this to a larger value and see if the problem persists?&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ESB PRX problem with sending ACK payload</title><link>https://devzone.nordicsemi.com/thread/348035?ContentTypeID=1</link><pubDate>Mon, 17 Jan 2022 12:44:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:45676335-761b-4344-a2ac-7ef77b9babf3</guid><dc:creator>Andrej102</dc:creator><description>&lt;p&gt;Hello.&amp;nbsp;Did the nordic engineers manage to see my message? Most interestingly, did I make the changes in the ESB library code correctly?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ESB PRX problem with sending ACK payload</title><link>https://devzone.nordicsemi.com/thread/345394?ContentTypeID=1</link><pubDate>Wed, 29 Dec 2021 15:51:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0860dc2d-64b3-4fc6-a3da-b1c3e9f7c135</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Andrej,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Currently our experts in ESB protocol are on vacation. We will have an engineer coming back on 17th Jan. I&amp;#39;m sorry for the delay and wish you a happy holidays.&amp;nbsp;&lt;br /&gt;Best Regards,&amp;nbsp;&lt;br /&gt;Hung&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>