<?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>An issue related to the 31-byte limit of sent data in BLE</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/90583/an-issue-related-to-the-31-byte-limit-of-sent-data-in-ble</link><description>Hey Nordic, 
 Currently, I am doing an internship about the applications of nRF52833 with SDK 17.1.0, and I am using this project file right now. 
 When I do &amp;quot;make -j all&amp;quot; and &amp;quot;make flash&amp;quot;, I can see my device on nRF Connect app. 
 But when I also uncomment</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 02 Aug 2022 16:25:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/90583/an-issue-related-to-the-31-byte-limit-of-sent-data-in-ble" /><item><title>RE: An issue related to the 31-byte limit of sent data in BLE</title><link>https://devzone.nordicsemi.com/thread/379764?ContentTypeID=1</link><pubDate>Tue, 02 Aug 2022 16:25:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e3ad6dc-8a29-4072-a36e-4802cda0d263</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Omer,&lt;/p&gt;
&lt;p&gt;Debugging is&amp;nbsp;certainly possible and is essential in all embedded development. As you are using GCC via VS Code setting up debugging&amp;nbsp;requires&amp;nbsp;a bit of work and is a bit more complex, so I would suggest using SES when debugging if you want something working out of the box. You are using an example application, and the SES project files are also part of the zip file you uploaded, and it builds out of the box. That is just a suggestion though, but as SES is free for use with Nordic ICs and time is money, that is what I would do. &lt;a href="https://infocenter.nordicsemi.com/topic/ug_gsg_ses/UG/gsg/intro.html"&gt;See&amp;nbsp;&lt;/a&gt;&lt;br /&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/ug_gsg_ses/UG/gsg/intro.html"&gt;Getting started with nRF5 SDK and SES (nRF51 &amp;amp; nRF52 Series)&lt;/a&gt; for a basic intro.&lt;/p&gt;
[quote user="Omer Kati"]adding NRF_LOG_INFO() functions even to the &amp;quot;init&amp;quot; functions but I couldn&amp;#39;t see any log message in PuTTY (in the case of included tx power).[/quote]
&lt;p&gt;It could be that the log is not output in time if using a release build and using deferred logging (which is enabled by default). So you could modify the logging, make sure you define DEBUG and DEBUG_NRF in your Makefile or select Debug from the build configuration dropdown if migrating to SES (to make a debug build), and that way you should see the log.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: An issue related to the 31-byte limit of sent data in BLE</title><link>https://devzone.nordicsemi.com/thread/379748?ContentTypeID=1</link><pubDate>Tue, 02 Aug 2022 14:14:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:15f34575-cedb-44f8-aa40-8f578e5eda5e</guid><dc:creator>&amp;#214;mer</dc:creator><description>&lt;p&gt;How do you do this debugging? I was told that debugging is not possible in the hardware level (I am compiling using vscode), and I only tried to use adding NRF_LOG_INFO() functions even to the &amp;quot;init&amp;quot; functions but I couldn&amp;#39;t see any log message in PuTTY (in the case of included tx power).&lt;/p&gt;
&lt;p&gt;Thanks for your detailed answer,&lt;/p&gt;
&lt;p&gt;Omer&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: An issue related to the 31-byte limit of sent data in BLE</title><link>https://devzone.nordicsemi.com/thread/379711?ContentTypeID=1</link><pubDate>Tue, 02 Aug 2022 12:12:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad6d7f49-b4da-4be3-9f1c-0dddad3fede5</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Omer,&lt;/p&gt;
[quote user="Omer Kati"]I mean, when the advertising packet becomes too large, does the antenna still do propagation?[/quote]
&lt;p&gt;No, things stop a long time for that.&lt;/p&gt;
[quote user="Omer Kati"]Or since the advertising packet is not well prepared, is there a mechanism to terminate the process?[/quote]
&lt;p&gt;Yes. If you try to debug the application or simply enable debug logging and observe the log (and not just observe that &amp;quot;it does not work&amp;quot;) you will see that generating the advertising packet will fail with the error code&amp;nbsp;NRF_ERROR_DATA_SIZE returned from&amp;nbsp;ble_advdata_encode(), and this is because the packet is too large. When I test a debug build with your firmware unmodified (except for uncommenting), I get this log, which is expected:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;info&amp;gt; app_timer: RTC: initialized.
&amp;lt;error&amp;gt; app: ERROR 12 [NRF_ERROR_DATA_SIZE] at C:\Users\eith\SDK\nRF5_SDK_17.1.0_ddde560\examples\other_projects\myproject_293207\main.c:276
PC at: 0x0002B655
&amp;lt;error&amp;gt; app: End of error report&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;When this happens, the error handler will either reset (so your device ends up in a reset loop) or enter an eternal loop to conserve the system state dependin on if you are testing a release build or a debug build (see &lt;a href="https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/an-introduction-to-error-handling-in-nrf5-projects"&gt;An introduction to error handling in nRF5 projects&lt;/a&gt;&amp;nbsp;for an intro to this).&lt;/p&gt;
[quote user="Omer Kati"]And most probably, I guess the antenna is not being excited.[/quote]
&lt;p&gt;That is correct.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: An issue related to the 31-byte limit of sent data in BLE</title><link>https://devzone.nordicsemi.com/thread/379706?ContentTypeID=1</link><pubDate>Tue, 02 Aug 2022 12:00:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a02eebbf-7a99-43f4-aa95-f090f14c8557</guid><dc:creator>&amp;#214;mer</dc:creator><description>&lt;p&gt;Hey Einar,&lt;/p&gt;
&lt;p&gt;Actually, your answer was quite explanatory but I am also wondering how the propagation happens.&lt;/p&gt;
&lt;p&gt;I mean, when the advertising packet becomes too large, does the antenna still do propagation? Or since the advertising packet is not well prepared, is there a mechanism to terminate the process?&lt;/p&gt;
&lt;p&gt;I tried to use NRF_LOG_INFO() function for debugging in PuTTY, and I even don&amp;#39;t see my log message of log_init() function -very first function to be executed in main.c- in the terminal of PuTTY. I don&amp;#39;t see any errors while flashing but probably not seeing any messages means that actually my code doesn&amp;#39;t work. And most probably, I guess the antenna is not being excited.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Omer&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: An issue related to the 31-byte limit of sent data in BLE</title><link>https://devzone.nordicsemi.com/thread/379640?ContentTypeID=1</link><pubDate>Tue, 02 Aug 2022 08:06:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c18544c5-285d-49ca-a527-de67a08d0d0f</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Omer,&lt;/p&gt;
&lt;p&gt;There is no minimal packet length in BLE, but a normal advertising packet is maximum 31 bytes. This includes headers, so in practice you can use up to 27 bytes of manufacturer specific data.&amp;nbsp;If you add Tx power, you will use&amp;nbsp;3 byte more (1 for type, one for length and 1 for the actual value). See &lt;a href="https://novelbits.io/maximum-data-bluetooth-advertising-packet-ble/"&gt;What’s the Maximum Data Size you can send in a Bluetooth Advertising Packet?&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you uncomment the code snippet with your tx_power and&amp;nbsp;where&amp;nbsp;advdata.p_tx_power_level is set, the latter will no longer be NULL (as you memset advdata to 0),&amp;nbsp;so the Tx power will also be included, and then the advertising packet becomes too large. Have you done any debugging to see if everything looks good on the nRF side?&amp;nbsp;If so you should see that you got an error because of that.&lt;/p&gt;
&lt;p&gt;As you are also using a scan response packet and that is not full, you could consider including the Tx power there instead, by moving the code block down a few lines and modifying it like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    int8_t tx_power                   = -4;// Set Power Level
    srdata.p_tx_power_level = &amp;amp;tx_power;&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>