<?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>Running a uart bluetooth example on nRF52833 DK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/101283/running-a-uart-bluetooth-example-on-nrf52833-dk</link><description>Hello! 
 
 I am trying to run the bluetooth peripheral_uart example on the nRF52833 Development Kit, but when I run the debugger, the program keeps reseting when calling 
 
 bt_enable(NULL). I tracked the problem to the following call, when trying to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 04 Jul 2023 07:54:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/101283/running-a-uart-bluetooth-example-on-nrf52833-dk" /><item><title>RE: Running a uart bluetooth example on nRF52833 DK</title><link>https://devzone.nordicsemi.com/thread/434364?ContentTypeID=1</link><pubDate>Tue, 04 Jul 2023 07:54:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b50402d0-b13d-4695-9437-888556e27b4a</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Renato&lt;/p&gt;
&lt;p&gt;That is excellent news, thanks for sharing your findings&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;A good old stack overflow then. I should have been suspicious when you shared the call stack earlier, it was pretty deep after all.&lt;/p&gt;
&lt;p&gt;Also, this issue is probably present in any board using internal flash and the settings library. I will request if this can be increased in the sample.&amp;nbsp;&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: Running a uart bluetooth example on nRF52833 DK</title><link>https://devzone.nordicsemi.com/thread/434289?ContentTypeID=1</link><pubDate>Mon, 03 Jul 2023 17:21:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:282d7ecf-f16e-400c-a63b-df92722f2ccf</guid><dc:creator>renato_lynx</dc:creator><description>&lt;p&gt;Hello,&amp;nbsp;&lt;span&gt;Torbj&amp;oslash;rn&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Commenting uart_init() did not change the problem.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The debug message is&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;br /&gt;*** Booting Zephyr OS build v3.3.99-ncs1 ***&lt;br /&gt;Starting Nordic UART service example&lt;br /&gt;[00:00:00.004,943] &amp;lt;dbg&amp;gt; fs_nvs: nvs_recover_last_ate: Recovering last ate from sector 0&lt;br /&gt;[00:00:00.017,120] &amp;lt;dbg&amp;gt; fs_nvs: nvs_add_gc_done_ate: Adding gc done ate at ff0&lt;br /&gt;[00:00:00.017,181] &amp;lt;err&amp;gt; os: ***** HARD FAULT *****&lt;br /&gt;[00:00:00.017,211] &amp;lt;err&amp;gt; os: Fault escalation (see below)&lt;br /&gt;[00:00:00.017,211] &amp;lt;err&amp;gt; os: ***** MPU FAULT *****&lt;br /&gt;[00:00:00.017,242] &amp;lt;err&amp;gt; os: Data Access Violation&lt;br /&gt;[00:00:00.017,242] &amp;lt;err&amp;gt; os: MMFAR Address: 0x20006f22&lt;br /&gt;[00:00:00.017,272] &amp;lt;err&amp;gt; os: r0/a1: 0x00000000 r1/a2: 0x4001e700 r2/a3: 0x00000002&lt;br /&gt;[00:00:00.017,303] &amp;lt;err&amp;gt; os: r3/a4: 0x00000000 r12/ip: 0x00000000 r14/lr: 0x000092d1&lt;br /&gt;[00:00:00.017,303] &amp;lt;err&amp;gt; os: xpsr: 0x61000000&lt;br /&gt;[00:00:00.017,333] &amp;lt;err&amp;gt; os: Faulting instruction address (r15/pc): 0x000092f6&lt;br /&gt;[00:00:00.017,364] &amp;lt;err&amp;gt; os: &amp;gt;&amp;gt;&amp;gt; ZEPHYR FATAL ERROR 19: Unknown error on CPU 0&lt;br /&gt;[00:00:00.017,395] &amp;lt;err&amp;gt; os: Current thread: 0x20002e48 (main)&lt;br /&gt;[00:00:00.106,048] &amp;lt;err&amp;gt; os: Halting system&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;But the good news is: I managed to make it work! Because the problem is a Data Access Violation, I was thinking that the call stack was very deep and maybe the stack size was not enough... so &lt;strong&gt;I increased the main stack size from 1024 (the default value) to 2048 and it worked&lt;/strong&gt;!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Then, returning the stack size to 1024, it still works because the program doesn&amp;#39;t call&amp;nbsp;nvs_add_gc_done_ate(..)&amp;nbsp;anymore. However, if I erase the flash with the command &amp;quot;nrfjprog -e&amp;quot;, then it fails again because it tries to run&amp;nbsp;nvs_add_gc_done_ate().&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;So basically, when the program executes&amp;nbsp;nvs_add_gc_done_ate() with a main stack size of 1024, a Data Access Violation occurs. Increasing the stack size to 2048, the program works.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you for the help,&amp;nbsp;Torbj&amp;oslash;rn!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best Regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Renato&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Running a uart bluetooth example on nRF52833 DK</title><link>https://devzone.nordicsemi.com/thread/434235?ContentTypeID=1</link><pubDate>Mon, 03 Jul 2023 13:08:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bb131669-dc7e-46cf-9db1-6f7650dc23fb</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Renato&lt;/p&gt;
&lt;p&gt;Both the NVS sample and peripheral_lbs works?&amp;nbsp;&lt;br /&gt;This issue keeps getting weirder....&lt;/p&gt;
&lt;p&gt;What if you comment out uart_init() at the start of main.c, does this make a difference?&amp;nbsp;&lt;br /&gt;I can&amp;#39;t really spot any other major differences between the peripheral_uart and peripheral_lbs samples until after bt_enable(..) is called, but when I run the peripheral_lbs sample myself I notice that the nvs_add_gc_done_ate(..) function does not seem to get called.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Exactly what triggers the calling of this function I am not sure, but since it is a part of your call stack it appears to be related to this issue.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you try to run the peripheral_uart sample with logging enabled in the NVS module and see if you get some more information?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I tested the code with the following log configuration:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;# Config logger
CONFIG_LOG=y
CONFIG_LOG_BACKEND_RTT=n
CONFIG_LOG_BACKEND_UART=y
CONFIG_LOG_PRINTK=n
CONFIG_NVS_LOG_LEVEL_DBG=y
CONFIG_LOG_MODE_DEFERRED=n&lt;/pre&gt;&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: Running a uart bluetooth example on nRF52833 DK</title><link>https://devzone.nordicsemi.com/thread/434003?ContentTypeID=1</link><pubDate>Fri, 30 Jun 2023 16:25:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6eb9de2-5858-4ed0-bbe2-69bbf76dd9d4</guid><dc:creator>renato_lynx</dc:creator><description>&lt;p&gt;Hello&amp;nbsp;&lt;span&gt;Torbj&amp;oslash;rn!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Tried the erase all, but it did not solve the problem.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Then, I tried the NSV sample, and it works fine!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I also tried the peripheral_lbs sample, and it also works correctly.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Just the peripheral_uart doesn&amp;#39;t work...&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I only have this board. I am not sure which number is the version and date code, so I am sending a picure&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img style="max-height:1600px;max-width:1040px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/2080x3200/__key/communityserver-discussions-components-files/4/nrf52833.jpeg" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Renato&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Running a uart bluetooth example on nRF52833 DK</title><link>https://devzone.nordicsemi.com/thread/433913?ContentTypeID=1</link><pubDate>Fri, 30 Jun 2023 11:15:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:22f5f038-465a-404c-913a-fe1d21fcf99c</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Renato&lt;/p&gt;
&lt;p&gt;That sounds strange, the example should run normally.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Did you try to do an erase all before flashing the code?&amp;nbsp;&lt;br /&gt;You can do this from the command line using nrfjprog:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfjprog -e&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I assume you don&amp;#39;t have more than one board to test with?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you let me know what the version and date code on your DK is, printed on the white label?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you try the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/samples/subsys/nvs/README.html"&gt;NVS sample&lt;/a&gt; on your board and see if this works?&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: Running a uart bluetooth example on nRF52833 DK</title><link>https://devzone.nordicsemi.com/thread/433745?ContentTypeID=1</link><pubDate>Thu, 29 Jun 2023 15:07:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da9ac9d0-ed21-41ed-a586-ed3c8287f0f7</guid><dc:creator>renato_lynx</dc:creator><description>&lt;p&gt;Hello&amp;nbsp;&lt;span&gt;Torbj&amp;oslash;rn&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Even when I just flash the board, it still doesn&amp;#39;t work. The LED1 does not blink and the bluetooth radio doesn&amp;#39;t show up, so the program never finished the initialization.&lt;/p&gt;
&lt;p&gt;I tried to enable&amp;nbsp;&lt;span&gt;CONFIG_DEBUG=y but still no success.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;But it works when I skip (when I comment) this part of the code:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;settings_backend_init();&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;(This line is part of the call stack I sent before)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In this case, the program finishes the initialization, starts the bluetooth radio, and the serial example works fine (transmitting data through the radio/uart).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I don&amp;#39;t know if there is a problem in the example or on my board, or if I am doing something wrong.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I think I will try another example and check if the same problem shows up.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best Regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Renato&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Running a uart bluetooth example on nRF52833 DK</title><link>https://devzone.nordicsemi.com/thread/433634?ContentTypeID=1</link><pubDate>Thu, 29 Jun 2023 09:42:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:807b3fad-4d71-4431-99b6-416c288712ef</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Renato&lt;/p&gt;
&lt;p&gt;My bad, I forgot that MPSL will be used by the internal flash libraries.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I assume the code runs fine if you just flash the board and reset it without entering debug mode?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What if you enable CONFIG_DEBUG=y in the prj.conf file, does this make any difference?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Will the code crash if you simply reset the board and press Continue (F5), or do you need to put breakpoints in the code to make it crash?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Debugging when running the Bluetooth stack and the MPSL module can be problematic once you put breakpoints in the code. The timer used by the stack/MPSL scheduler will keep running in the background, and if you try to continue execution after a breakpoint it will often crash, since the internal timing breaks while the code is halted.&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: Running a uart bluetooth example on nRF52833 DK</title><link>https://devzone.nordicsemi.com/thread/433514?ContentTypeID=1</link><pubDate>Wed, 28 Jun 2023 16:02:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b5d0c84-df56-406c-956d-61fce07bfc0b</guid><dc:creator>renato_lynx</dc:creator><description>&lt;p&gt;Hello&amp;nbsp;&lt;span&gt;Torbj&amp;oslash;rn!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Thank you for the help.&lt;/p&gt;
&lt;p&gt;But I didn&amp;#39;t modify the example. All I did was:&lt;br /&gt;On the nRF Connect for VS Code welcome page, I selected &amp;quot;Create a new application&amp;quot;&lt;br /&gt;I selected Freestanding, SDK and Toolchain version 2.4.0, and the Application Template &amp;quot;nrf/samples/bluetooth/peripheral_uart&amp;quot;&lt;br /&gt;Then, in the applications, I clicked on &amp;quot;Add Build Configuration&amp;quot;, selected the board &amp;quot;nrf52833dk_nrf52833&amp;quot;, Configuration &amp;quot;Use build system default&amp;quot; and then enabled the debug options&lt;br /&gt;After that, I clicked in the Action &amp;quot;Debug&amp;quot;.&lt;/p&gt;
&lt;p&gt;The program downloads and runs in the board, but it&amp;nbsp;resets after reaching the line&lt;/p&gt;
&lt;p&gt;ret = mpsl_timeslot_request(_context.session_id, req);&lt;/p&gt;
&lt;p&gt;The call stack is this:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1687961916700v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you again&lt;/p&gt;
&lt;p&gt;Renato&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Running a uart bluetooth example on nRF52833 DK</title><link>https://devzone.nordicsemi.com/thread/433450?ContentTypeID=1</link><pubDate>Wed, 28 Jun 2023 11:55:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a99770ba-2615-4eea-89f2-7e3b06456ae3</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Renato&lt;/p&gt;
&lt;p&gt;The peripheral_uart sample doesn&amp;#39;t use MPSL, so I assume you made some changes to it?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Also, what is the link between the call to mpsl_timeslot_request(..) and flash memory access?&lt;/p&gt;
&lt;p&gt;Would you be able to share your modified sample with me so I can have a look at it?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you don&amp;#39;t want to share your code in a public ticket just let me know, and I can make it private.&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></channel></rss>