<?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 payload</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/83927/esb-payload</link><description>Hi, 
 What is the role of the NRF_ESB_CREATE_PAYLOAD() 
 static nrf_esb_payload_t tx_payload = NRF_ESB_CREATE_PAYLOAD(1,0,0,0,0,0,0,0,0,0,0); 
 how it works 
 if i create payload on 8 byte only i can send 8 bytes !! 
 How to increase this to 252 bytes</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 25 Jan 2022 10:56:22 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/83927/esb-payload" /><item><title>RE: ESB payload</title><link>https://devzone.nordicsemi.com/thread/349497?ContentTypeID=1</link><pubDate>Tue, 25 Jan 2022 10:56:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:102d7a47-7281-4ff6-9c2d-a0e762fd3b7d</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Looks like the&amp;nbsp;NUM_VA_ARGS() and&amp;nbsp;NUM_VA_ARGS_IMPL() only support up to 63bytes.&lt;/p&gt;
&lt;p&gt;In that case I suggest you don&amp;#39;t use the macro, but do it manually:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    static nrf_esb_payload_t tx_payload;

    tx_payload.pipe = 0;
    tx_payload.length = NRF_ESB_MAX_PAYLOAD_LENGTH;
    for(uint8_t i; i&amp;lt;NRF_ESB_MAX_PAYLOAD_LENGTH; i++)
      tx_payload.data[i] = i;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The above will just create a payload with 0, 1, 2, 3, ... 251.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ESB payload</title><link>https://devzone.nordicsemi.com/thread/349298?ContentTypeID=1</link><pubDate>Mon, 24 Jan 2022 14:21:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2726c1d5-a894-41ad-8ffa-a681391902f8</guid><dc:creator>Sunil vignesh</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have changed these things&lt;/p&gt;
&lt;p&gt;in nrf_esb.h&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// Hardcoded parameters - change if necessary
#ifndef NRF_ESB_MAX_PAYLOAD_LENGTH
#define     NRF_ESB_MAX_PAYLOAD_LENGTH          252                  //!&amp;lt; The maximum size of the payload. Valid values are 1 to 252.
#endif
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;in nrf_esb.c&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void update_rf_payload_format_esb_dpl(uint32_t payload_length)
{
#if (NRF_ESB_MAX_PAYLOAD_LENGTH &amp;lt;= 32)
    // Using 6 bits for length
    NRF_RADIO-&amp;gt;PCNF0 = (0 &amp;lt;&amp;lt; RADIO_PCNF0_S0LEN_Pos) |
                       (6 &amp;lt;&amp;lt; RADIO_PCNF0_LFLEN_Pos) |
                       (3 &amp;lt;&amp;lt; RADIO_PCNF0_S1LEN_Pos) ;
#else
    // Using 8 bits for length
    NRF_RADIO-&amp;gt;PCNF0 = (0 &amp;lt;&amp;lt; RADIO_PCNF0_S0LEN_Pos) |
                       (8 &amp;lt;&amp;lt; RADIO_PCNF0_LFLEN_Pos) |
                       (3 &amp;lt;&amp;lt; RADIO_PCNF0_S1LEN_Pos) ;
#endif
    NRF_RADIO-&amp;gt;PCNF1 = (RADIO_PCNF1_WHITEEN_Disabled    &amp;lt;&amp;lt; RADIO_PCNF1_WHITEEN_Pos) |
                       (RADIO_PCNF1_ENDIAN_Big          &amp;lt;&amp;lt; RADIO_PCNF1_ENDIAN_Pos)  |
                       ((m_esb_addr.addr_length - 1)    &amp;lt;&amp;lt; RADIO_PCNF1_BALEN_Pos)   |
                       (0                               &amp;lt;&amp;lt; RADIO_PCNF1_STATLEN_Pos) |
                       (NRF_ESB_MAX_PAYLOAD_LENGTH      &amp;lt;&amp;lt; RADIO_PCNF1_MAXLEN_Pos);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define NRF_ESB_CREATE_PAYLOAD(_pipe, ...)                                                  \
        {.pipe = _pipe, .length = NUM_VA_ARGS(__VA_ARGS__), .data = {__VA_ARGS__}};         \
        STATIC_ASSERT(NUM_VA_ARGS(__VA_ARGS__) &amp;gt; 0 &amp;amp;&amp;amp; NUM_VA_ARGS(__VA_ARGS__) &amp;lt;= 252)

&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static nrf_esb_payload_t        tx_payload = NRF_ESB_CREATE_PAYLOAD(0, 0,0,0,0,0,0,0,0,0,0,0,0, \
                                                                       0,0,0,0,0,0,0,0,0,0,0,0, \
                                                                       0,0,0,0,0,0,0,0,0,0,0,0, \
                                                                       0,0,0,0,0,0,0,0,0,0,0,0, \
                                                                       0,0,0,0,0,0,0,0,0,0,0,0, \
                                                                       0,0,0,0,0,0,0,0,0,0,0,0, \
                                                                       0,0,0,0,0,0,0,0,0,0,0,0, \
                                                                       0,0,0,0,0,0,0,0,0,0,0,0, \
                                                                       0,0,0,0,0,0,0,0,0,0,0,0, \
                                                                       0,0,0,0,0,0,0,0,0,0,0,0, \
                                                                       0,0,0,0,0,0,0,0,0,0,0,0, \
                                                                       0,0,0,0,0,0,0,0,0,0,0,0, \
                                                                       0,0,0,0,0,0,0,0,0,0,0,0, \
                                                                       0,0,0,0,0,0,0,0,0,0,0,0, \
                                                                       0,0,0,0,0,0,0,0,0,0,0,0, \
                                                                       0,0,0,0,0,0,0,0,0,0,0,0, \
                                                                       0,0,0,0,0,0,0,0,0,0,0,0, \
                                                                       0,0,0,0,0,0,0,0,0,0,0,0, \
                                                                       0,0,0,0,0,0,0,0,0,0,0,0, \
                                                                       0,0,0,0,0,0,0,0,0,0,0,0, \
                                                                       0,0,0,0,0,0,0,0,0,0,0);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;for this i got error&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;Building ‘esb_ptx_pca10056’ from solution ‘esb_ptx_pca10056’ in configuration ‘Release’
  Compiling ‘main.c’
    sdk_common.h
    main.c
    static assertion failed: &amp;quot;unspecified message&amp;quot;
    in definition of macro &amp;#39;_SELECT_ASSERT_FUNC&amp;#39;
    in expansion of macro &amp;#39;STATIC_ASSERT_SIMPLE&amp;#39;
    in expansion of macro &amp;#39;STATIC_ASSERT&amp;#39;
    in expansion of macro &amp;#39;NRF_ESB_CREATE_PAYLOAD&amp;#39;
Build failed&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ESB payload</title><link>https://devzone.nordicsemi.com/thread/349189?ContentTypeID=1</link><pubDate>Mon, 24 Jan 2022 10:23:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64d2974c-08d9-4a62-a547-daed09797970</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;The ESB protocol can support up to 252bytes payload, this is done by setting&amp;nbsp;NRF_ESB_MAX_PAYLOAD_LENGTH 252 in nrf_esb.h. You can find in&amp;nbsp;update_rf_payload_format_esb_dpl() that when max payload length is set higher than 32byte, then the length field in the payload is increased from 6 to 8bit (thereby supporting longer than 32byte payload, up to 252bytes in this case).&lt;/p&gt;
&lt;p&gt;I can find from the description of&amp;nbsp;NRF_ESB_CREATE_PAYLOAD() in nrf_esb.h.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/** @brief Macro to create an initializer for a TX data packet.
 *
 * @details This macro generates an initializer. Using the initializer is more efficient
 *          than setting the individual parameters dynamically.
 *
 * @param[in]   _pipe   The pipe to use for the data packet.
 * @param[in]   ...     Comma separated list of character data to put in the TX buffer.
 *                      Supported values consist of 1 to 63 characters.
 *
 * @return  Initializer that sets up the pipe, length, and byte array for content of the TX data.
 */
#define NRF_ESB_CREATE_PAYLOAD(_pipe, ...)                                                  \
        {.pipe = _pipe, .length = NUM_VA_ARGS(__VA_ARGS__), .data = {__VA_ARGS__}};         \
        STATIC_ASSERT(NUM_VA_ARGS(__VA_ARGS__) &amp;gt; 0 &amp;amp;&amp;amp; NUM_VA_ARGS(__VA_ARGS__) &amp;lt;= 63)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I can find this macro was only made for 6bit field length, since it check if the payload is shorter than 63bytes. If you set max payload to 252bytes I suggest to change it to the following:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/** @brief Macro to create an initializer for a TX data packet.
 *
 * @details This macro generates an initializer. Using the initializer is more efficient
 *          than setting the individual parameters dynamically.
 *
 * @param[in]   _pipe   The pipe to use for the data packet.
 * @param[in]   ...     Comma separated list of character data to put in the TX buffer.
 *                      Supported values consist of 1 to 63 characters.
 *
 * @return  Initializer that sets up the pipe, length, and byte array for content of the TX data.
 */
#define NRF_ESB_CREATE_PAYLOAD(_pipe, ...)                                                  \
        {.pipe = _pipe, .length = NUM_VA_ARGS(__VA_ARGS__), .data = {__VA_ARGS__}};         \
        STATIC_ASSERT(NUM_VA_ARGS(__VA_ARGS__) &amp;gt; 0 &amp;amp;&amp;amp; NUM_VA_ARGS(__VA_ARGS__) &amp;lt;= 252)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Then for instance you can use&amp;nbsp;&lt;span&gt;NRF_ESB_MAX_PAYLOAD_LENGTH(0, your_payload_up_to_252bytes);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Kenneth&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>