<?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>Using extended advertising data with nRF52833</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/98664/using-extended-advertising-data-with-nrf52833</link><description>Good day 
 I am trying to use a beacon to transmit extended advertising data and multiple central devices/scanners to detect the advertising data. This is supposed to act as a bridge for UART data. The end goal is: UART-&amp;gt;beacon-&amp;gt;adv data-&amp;gt;scanner-&amp;gt;UART</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 19 Apr 2023 11:59:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/98664/using-extended-advertising-data-with-nrf52833" /><item><title>RE: Using extended advertising data with nRF52833</title><link>https://devzone.nordicsemi.com/thread/421251?ContentTypeID=1</link><pubDate>Wed, 19 Apr 2023 11:59:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19a6a568-2ec7-4b34-a878-295a15e5ba3c</guid><dc:creator>Einar Thorsrud</dc:creator><description>[quote user="BBI"]If it&amp;#39;s that simple[/quote]
&lt;p&gt;I think debugging what you have is faster than starting from scratch (and being able to debug is anyway essential). (And when you have an issue you see/reproduce consistently, finding out what you can from debugging is normally more efficient than staring at the code.)&lt;/p&gt;
[quote user="BBI"]Using a J-Link debugger, I stepped through the code and found that the last line before it resets is line 663 in ble_advertising.c.[/quote]
&lt;p&gt;I see. But it does not &amp;quot;just&amp;quot; reset. What kind of reset is it? What causes the reset? You can for instance start with checking the RESETREAS when the device comes back up to see what type of reset it was.&lt;/p&gt;
&lt;p&gt;Regarding logs, it is expected you don&amp;#39;t get logs at you use deferred logging and the reset happens before logs are processed. If you disable deferred logging (set&amp;nbsp;NRF_LOG_DEFERRED to 0 in your sdk_config.h), you will see the logs.&lt;/p&gt;
&lt;p&gt;So, I did a quick debug session with your application now, and then I see that the RESETREAS is&amp;nbsp;0x00010000. That was a bit suprising to me as it means wakeup from system off mode, but that is what is says. So I put a break point in the call to&amp;nbsp;sleep_mode_enter(), and that is why the device enters system off mode, after&amp;nbsp;BLE_ADV_EVT_IDLE. Commenting out that sleep prevents the reset.&lt;/p&gt;
&lt;p&gt;Edit: Looking a bit further, it times out immediately as you start fast advertising:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;err_code = ble_advertising_start(&amp;amp;m_advertising, BLE_ADV_MODE_FAST);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;but you have disabled fast advertising in your advertising_init() function:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    init.config.ble_adv_fast_enabled     = false;//true;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And the way the advertising module state machine works is that it will start at the top, and skip any non-enabled modes. As you have no modes that are enabled, it will time out immediately.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using extended advertising data with nRF52833</title><link>https://devzone.nordicsemi.com/thread/421234?ContentTypeID=1</link><pubDate>Wed, 19 Apr 2023 11:07:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0332c94d-66cc-4152-af3a-94b3a31e3175</guid><dc:creator>BBI</dc:creator><description>&lt;p&gt;Using a J-Link debugger, I stepped through the code and found that the last line before it resets is line 663 in ble_advertising.c. &lt;br /&gt;&lt;br /&gt;I have attached my original code for the beacon, from before any extended advertising was added. If it&amp;#39;s that simple, could you please change the configs and inits so that extended advertising can be used? The code is very lightly modified, just a merge of the beacon and UART peripherall examples.&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Beacon.7z"&gt;devzone.nordicsemi.com/.../Beacon.7z&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using extended advertising data with nRF52833</title><link>https://devzone.nordicsemi.com/thread/421165?ContentTypeID=1</link><pubDate>Wed, 19 Apr 2023 07:38:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8ea57c3-d87d-49ff-9b0f-4484fa892939</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;I have had a look but did not spot anything obvious. It is easy to miss things though, so debugging and logging would make sense to learn more first. A reset does not happen by itself, so getting logging to work and debugging. The first question is what exactly causes the reset? With that information, we know much more on where to look.&lt;/p&gt;
&lt;p&gt;Regarding line 663 in&amp;nbsp;ble_advertising.c, that calls the callback you have registered, which is the&amp;nbsp;on_adv_evt() function in your main(). I do not see any obvious issues there, neither with this function itself or how&amp;nbsp; you pass the pointer to it. How did you conclude that this is the last thing that happens before the reset?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using extended advertising data with nRF52833</title><link>https://devzone.nordicsemi.com/thread/421072?ContentTypeID=1</link><pubDate>Tue, 18 Apr 2023 14:09:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ad6b06e-9aed-4781-8411-def5bc115744</guid><dc:creator>BBI</dc:creator><description>&lt;p&gt;The RTT logger has stopped working since I made the last set of changes to the beacon, so I can&amp;#39;t see if any errors are being returned. What I mean when I say the code &amp;quot;breaks&amp;quot; at line 663: &lt;code&gt;p_advertising-&amp;gt;evt_handler(p_advertising-&amp;gt;adv_evt);&lt;/code&gt; in &lt;code&gt;ble_advertising.c&lt;/code&gt; is that the device resets and starts running from &lt;code&gt;main()&lt;/code&gt; again as soon as it executes this line. I&amp;#39;m unsure if this is where the issue lies or if it is due to the code in &lt;code&gt;advertising_init()&lt;/code&gt; or &lt;code&gt;advertising_start()&lt;/code&gt;. Could you please at least take a look at the &lt;code&gt;advertising_init()&lt;/code&gt; or &lt;code&gt;advertising_start()&lt;/code&gt; functions?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using extended advertising data with nRF52833</title><link>https://devzone.nordicsemi.com/thread/421042?ContentTypeID=1</link><pubDate>Tue, 18 Apr 2023 12:57:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee5ec424-861d-4a48-8736-7e22f4e2dff9</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Can you elaborate more about what you mean by &amp;quot;code breaks&amp;quot;? Do you get an error returned from somewhere? Or what else do you find when debugging?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using extended advertising data with nRF52833</title><link>https://devzone.nordicsemi.com/thread/420827?ContentTypeID=1</link><pubDate>Mon, 17 Apr 2023 14:35:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de98b099-f3c0-4e29-a4fb-eaccbb1ab225</guid><dc:creator>BBI</dc:creator><description>&lt;p&gt;Thank you; the Scanner appears to be working now. However, I&amp;#39;m still struggling to get the Beacon to work. The code breaks at the &lt;strong&gt;&lt;code&gt;ble_advertising_start(&amp;amp;m_advertising, BLE_ADV_MODE_FAST);&lt;/code&gt; &lt;/strong&gt;function, which leads to &lt;strong&gt;&lt;code&gt;ble_advertising.c&lt;/code&gt;&lt;/strong&gt;. I think the problem occurs at line 663: &lt;strong&gt;&lt;code&gt;p_advertising-&amp;gt;evt_handler(p_advertising-&amp;gt;adv_evt);&lt;/code&gt;&lt;/strong&gt;. The issue could also lie in the &lt;strong&gt;&lt;code&gt;advertising_init()&lt;/code&gt; &lt;/strong&gt;or &lt;strong&gt;&lt;code&gt;advertising_start()&lt;/code&gt; &lt;/strong&gt;functions, or within the &lt;strong&gt;&lt;code&gt;sdk_config&lt;/code&gt;. &lt;/strong&gt;Could you please have another look at the code.&lt;strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Extended_5F00_Advertising_5F00_Tests_5F00_3.7z"&gt;devzone.nordicsemi.com/.../Extended_5F00_Advertising_5F00_Tests_5F00_3.7z&lt;/a&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using extended advertising data with nRF52833</title><link>https://devzone.nordicsemi.com/thread/420731?ContentTypeID=1</link><pubDate>Mon, 17 Apr 2023 10:56:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4890860-f99c-414e-8a90-1dd9370d3b03</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;sd_ble_gap_scan_start() will return NRF_ERROR_INVALID_LENGTH if the provided buffer&amp;nbsp;length is invalid. This is set by&amp;nbsp;NRF_BLE_SCAN_BUFFER in your sdk_config.h. And for extended this needs to be larger than 31 which you have set. See this snippet from ble_gap.h:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@defgroup BLE_GAP_SCAN_BUFFER_SIZE GAP Minimum scanner buffer size
 *
 * Scan buffers are used for storing advertising data received from an advertiser.
 * If ble_gap_scan_params_t::extended is set to 0, @ref BLE_GAP_SCAN_BUFFER_MIN is the minimum scan buffer length.
 * else the minimum scan buffer size is @ref BLE_GAP_SCAN_BUFFER_EXTENDED_MIN.
 * @{ */
#define BLE_GAP_SCAN_BUFFER_MIN                    (31)                             /**&amp;lt; Minimum data length for an
                                                                                         advertising set. */
#define BLE_GAP_SCAN_BUFFER_MAX                    (31)                             /**&amp;lt; Maximum data length for an
                                                                                         advertising set. */
#define BLE_GAP_SCAN_BUFFER_EXTENDED_MIN           (255)                            /**&amp;lt; Minimum data length for an
                                                                                         extended advertising set. */
#define BLE_GAP_SCAN_BUFFER_EXTENDED_MAX           (1650)                           /**&amp;lt; Maximum data length for an
                                                                                         extended advertising set. */
#define BLE_GAP_SCAN_BUFFER_EXTENDED_MAX_SUPPORTED (255)                            /**&amp;lt; Maximum supported data length for
                 &lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using extended advertising data with nRF52833</title><link>https://devzone.nordicsemi.com/thread/420724?ContentTypeID=1</link><pubDate>Mon, 17 Apr 2023 10:42:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb4c8951-62b9-4193-bf9f-f07e78f4dc44</guid><dc:creator>BBI</dc:creator><description>&lt;p&gt;I&amp;#39;ve managed to fix the code so that it doesn&amp;#39;t hardfault. It seems there was an error in porting the code. I&amp;#39;m still getting some errors, though. On the Scanner/Central side, I get an error code 0x9, which is NRF_ERROR_INVALID_LENGTH. This occurs in the scan_start function, which goes to line 1122 in nrf_ble_scan.c. sd_ble_gap_scan_start(&amp;amp;p_scan_ctx-&amp;gt;scan_params, &amp;amp;p_scan_ctx-&amp;gt;scan_buffer); is what gives me the error code. To which length is this referring, and where can I fix it?&lt;br /&gt;&lt;br /&gt;These are my scan parameters. When I change .extended to 0, the code works as expected.&lt;br /&gt;static ble_gap_scan_params_t m_scan_param = /**&amp;lt; Scan parameters requested for scanning and connection. */&lt;br /&gt;{&lt;br /&gt;.active = 0x01,&lt;br /&gt;.interval = NRF_BLE_SCAN_SCAN_INTERVAL,&lt;br /&gt;.window = NRF_BLE_SCAN_SCAN_WINDOW,&lt;br /&gt;.filter_policy = 0, // BLE_GAP_SCAN_FP_WHITELIST,&lt;br /&gt;.timeout = 0,&lt;br /&gt;.scan_phys = BLE_GAP_PHY_1MBPS,&lt;br /&gt;.extended = 1,&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;On the Beacon/Peripheral side, the code runs for a while, but then gives me a fatal error. I&amp;#39;m not sure what&amp;#39;s causing the error. I also can&amp;#39;t detect the Beacon using the nRF app on my phone. I&amp;#39;ve tested it with another app that scans for BLE devices as well.&lt;br /&gt;&lt;br /&gt;Could you please have a look at my code and suggest any fixes? I&amp;#39;m using pca10100 and soft device s140.&lt;br /&gt;Kind regards&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Extended_5F00_Advertising_5F00_Tests_5F00_2.7z"&gt;devzone.nordicsemi.com/.../Extended_5F00_Advertising_5F00_Tests_5F00_2.7z&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using extended advertising data with nRF52833</title><link>https://devzone.nordicsemi.com/thread/420254?ContentTypeID=1</link><pubDate>Thu, 13 Apr 2023 12:59:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05799fa4-ff51-454e-a137-46b1ef61bc8c</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;There is no fundamental reason this should not work on the nRF52833. Have you done any debugging to understand what happens before / why you get the hardfault? And is it really a hardfault and not another error? If it is a hardfault, then make sure you have&amp;nbsp;HARDFAULT_HANDLER_ENABLED set to 1 in sdk_config.h. If you den test a debug build with DEBUG defined, you should end up in a breakpoint in&amp;nbsp;components/libraries/hardfault/hardfault_implementation.c. If you have logging enabled you also get this information in the log.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>