<?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 event_handler is called only once</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/43456/esb-event_handler-is-called-only-once</link><description>NRF52 
 I have a Transmitter and Receiver. The Receiver starts and listens to the ESB. 
 The Transmitter starts, sends a message on the ESB and restarts. The message is static. Triggered nrf_esb_event_handler with the message: &amp;quot;TX SUCCESS EVENT&amp;quot;. 
 The</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 07 Feb 2019 18:11:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/43456/esb-event_handler-is-called-only-once" /><item><title>RE: ESB event_handler is called only once</title><link>https://devzone.nordicsemi.com/thread/170010?ContentTypeID=1</link><pubDate>Thu, 07 Feb 2019 18:11:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:402367ae-af2d-4f35-bf67-01ce37859af5</guid><dc:creator>Daniel Veilleux</dc:creator><description>&lt;p&gt;If the payload isn&amp;#39;t going to change &lt;strong&gt;and&lt;/strong&gt; you need to reset the PTX after each message then you&amp;#39;ll need to manually ensure that the PID is changing. I&amp;#39;ve modified the nrf_esb module in a couple of my projects for this purpose in the past. This is from a project I did with SDK14:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/**@brief Function for setting a new packet ID for a specific pipe.
 *
 * The ESB protocol uses a 2-bit sequence number (packet ID) to identify
 * retransmitted packets. By default, the packet ID is incremented for every
 * uploaded packet. If the nrf_esb library is disabled in between sending two
 * payloads to a particular device then the PID will be zero for each
 * transmission and the device could get confused. This function allows the
 * PID to be set manually in this situation.
 *
 * @param[in]   pipe                            Pipe.
 * @param[in]   pid                             New PID value.
 *
 * @retval  NRF_SUCCESS                         If the operation completed successfully.
 * @retval  NRF_ERROR_BUSY                      If the function failed because the radio is busy.
 */
uint32_t nrf_esb_set_pid(uint8_t pipe, uint8_t pid);


uint32_t nrf_esb_set_pid(uint8_t pipe, uint8_t pid)
{
    VERIFY_TRUE(m_nrf_esb_mainstate == NRF_ESB_STATE_IDLE, NRF_ERROR_BUSY);
    VERIFY_TRUE(pipe &amp;lt; 8, NRF_ERROR_INVALID_PARAM);

    m_pids[pipe] = (pid % (NRF_ESB_PID_MAX + 1));
    return NRF_SUCCESS;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Then I keep track of the last PID I used so I can increment it and then call this function the next time I re-enable the PTX.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ESB event_handler is called only once</title><link>https://devzone.nordicsemi.com/thread/170000?ContentTypeID=1</link><pubDate>Thu, 07 Feb 2019 17:46:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:660586f0-1677-4bb7-8d9e-fa1dafcba4ff</guid><dc:creator>zeleboba</dc:creator><description>&lt;p&gt;What should I do to get the same payload multiple times?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ESB event_handler is called only once</title><link>https://devzone.nordicsemi.com/thread/169999?ContentTypeID=1</link><pubDate>Thu, 07 Feb 2019 17:22:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3692f33-f3cd-4a9d-b62c-0420a5ebe68c</guid><dc:creator>Daniel Veilleux</dc:creator><description>&lt;p&gt;ESB packets have a PID counter value in them. If two consecutive packets with identical payloads and PIDs are received by the PRX then it will assume the second packet is a retransmission and ignore it. If I had to guess I&amp;#39;d say that when you restart the PTX the counter value also gets reset and is never allowed to increment. You&amp;#39;ll need to allow the PID to increment and/or make the sure you aren&amp;#39;t sending the same payload multiple times.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>