<?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>Strange Logging Behaviour when using bt_enable(NULL)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/107700/strange-logging-behaviour-when-using-bt_enable-null</link><description>I am trying to run the peripheral_uart example on a custom nrf52833 board and the RTT logs get interrupted with corrupted output unless a long sleep is placed after bt_enable(NULL). 
 This is the corrupted output: 
 
 The only place I could find a similar</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 31 Jan 2024 08:22:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/107700/strange-logging-behaviour-when-using-bt_enable-null" /><item><title>RE: Strange Logging Behaviour when using bt_enable(NULL)</title><link>https://devzone.nordicsemi.com/thread/466881?ContentTypeID=1</link><pubDate>Wed, 31 Jan 2024 08:22:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc097090-ed83-4fac-8de2-a2c80b2c519d</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I&amp;#39;m glad to hear it worked. Thank you for the update.&lt;/p&gt;
[quote user="GeorgePM"]Yes the device was always powered before I connected to the RTT viewer, How would I go about connecting to RTT before the device is powered up? Is it possible to send a reset just as RTT connects or would it just be a case of delaying the program until RTT is connected?[/quote]
&lt;p&gt;The RTT Viewer makes&amp;nbsp;the chip&amp;nbsp;enter&amp;nbsp;&lt;a title="Debug Interface mode" href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/dif.html?cp=5_0_0_3_7_3#debuginterfacemode"&gt;Debug Interface mode&lt;/a&gt;&amp;nbsp;when it connects in order to enable communication via the SWD bus. As a result, establishing a connection before powering on the chip is not possible. So, to enable RTT from the start of the boot sequence, you&amp;nbsp;would need to first establish the connection and then&amp;nbsp;do&amp;nbsp;a reset to reboot the device. The&amp;nbsp;challenge is to do a reset that does not break the debugger connection. nrfjprog&amp;#39; exits debug interface mode after reset sto prevent excessive current consumption after programming.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Since the DK has a reset button, I&amp;#39;m able to perform a pinreset without using nrfjprog.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Strange Logging Behaviour when using bt_enable(NULL)</title><link>https://devzone.nordicsemi.com/thread/466849?ContentTypeID=1</link><pubDate>Tue, 30 Jan 2024 22:51:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee654c4f-e42d-44c7-babd-158d4021c852</guid><dc:creator>GeorgePM</dc:creator><description>&lt;p&gt;That has fixed it thankyou for all your help!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/107700/strange-logging-behaviour-when-using-bt_enable-null/466727"]I can only reproduce this issue with the&amp;nbsp;&amp;nbsp;&amp;#39;peripheral_uart&amp;#39; sample if I connect to the RTTViewer after the application has booted up.[/quote]
&lt;p&gt;Yes the device was always powered before I connected to the RTT viewer, How would I go about connecting to RTT before the device is powered up? Is it possible to send a reset just as RTT connects or would it just be a case of delaying the program until RTT is connected?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Strange Logging Behaviour when using bt_enable(NULL)</title><link>https://devzone.nordicsemi.com/thread/466727?ContentTypeID=1</link><pubDate>Tue, 30 Jan 2024 11:19:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3372064-6f8a-4803-8ee1-951fdb73f814</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I can only reproduce this issue with the&amp;nbsp;&amp;nbsp;&amp;#39;peripheral_uart&amp;#39; sample if I connect to the RTTViewer after the application has booted up. This is because the RTT client does not connect until the buffer has been filled up.&amp;nbsp;&lt;/p&gt;
[quote user="vibe"]&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/index.html#CONFIG_LOG_BUFFER_SIZE"&gt;CONFIG_LOG_BUFFER_SIZE&lt;/a&gt;&amp;nbsp;- increase default buffer size when using deffered mode.[/quote]
&lt;p&gt;I should have suggested this symbol instead:&amp;nbsp;CONFIG_SEGGER_RTT_BUFFER_SIZE_UP. This is the symbol that controls the size of the RTT buffer in RAM.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Strange Logging Behaviour when using bt_enable(NULL)</title><link>https://devzone.nordicsemi.com/thread/466654?ContentTypeID=1</link><pubDate>Tue, 30 Jan 2024 04:59:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc38597b-5a55-4b1b-a582-e60c0efd42d4</guid><dc:creator>GeorgePM</dc:creator><description>&lt;p&gt;I soldered a board with nothing but a microcontroller and the crystal and it has the same issue so that means that its unlikely to be a hardware issue.&lt;/p&gt;
&lt;p&gt;This however leaves me stumped on&amp;nbsp;what could be the cause as I am currently using: nrf example code, the nrf dk board profile, and have the same error on two separate microcontrollers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Strange Logging Behaviour when using bt_enable(NULL)</title><link>https://devzone.nordicsemi.com/thread/466639?ContentTypeID=1</link><pubDate>Mon, 29 Jan 2024 23:49:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e8fbfaf5-e12f-4bad-9064-101c457cb5e8</guid><dc:creator>GeorgePM</dc:creator><description>&lt;p&gt;The &lt;a title="peripheral-uart example" href="https://github.com/nrfconnect/sdk-nrf/tree/main/samples/bluetooth/peripheral_uart"&gt;peripheral-uart example&lt;/a&gt; from the NRF SDK 2.5.0 is what I have been testing with and the behaviour doesn&amp;#39;t seem to change if I build with my custom board profile or if I use the nrf52833dk_nrf52833 board profile.&lt;/p&gt;
&lt;p&gt;I guess it could just be a hardware issue but the fact that I found &lt;a title="Different behavior with two different nrf52dk boards" href="https://devzone.nordicsemi.com/f/nordic-q-a/102835/different-behavior-with-two-different-nrf52dk-boards"&gt;the Devzone post&lt;/a&gt; earlier with identical output made me think it could be a configuration issue on my part or a known bug.&lt;/p&gt;
&lt;p&gt;Thank you for all your assistance, I will solder up another board to see if it is a hardware issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Strange Logging Behaviour when using bt_enable(NULL)</title><link>https://devzone.nordicsemi.com/thread/466388?ContentTypeID=1</link><pubDate>Mon, 29 Jan 2024 07:20:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:47feec5f-4704-4283-9e62-67258f6d3d28</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;No worries. Unfortunately, I don&amp;rsquo;t have a good explanation for the behavior you&amp;rsquo;re observing. I do experience dropped logs sometimes when the default log buffer is too small, but I don&amp;rsquo;t recall encountering this issue with &amp;#39;immediate&amp;#39; logging. If you can share a minimal version of your project here, or through a private support ticket, I will try to reproduce the issue on my end.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Strange Logging Behaviour when using bt_enable(NULL)</title><link>https://devzone.nordicsemi.com/thread/466368?ContentTypeID=1</link><pubDate>Sun, 28 Jan 2024 22:44:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3451ba03-74cb-423e-8258-3752609f46f0</guid><dc:creator>GeorgePM</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;My apologies for the delayed reply it was a long weekend for Australia Day.&lt;/p&gt;
&lt;p&gt;The output in RTT viewer output and Vscode&amp;nbsp;output appear to be the same heres the output in RTT viewer:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;00&amp;gt; [00:00:00.014,495] &amp;lt;inf&amp;gt; fs_nvs: 6 Sectors of 4096 bytes
00&amp;gt; [00:00:00.014,984] &amp;lt;inf&amp;gt; fs_nvs: alloc wra: 0, fd0
00&amp;gt; [00:00:00.015,411] &amp;lt;inf&amp;gt; fs_nvs: data wra: 0, 1c
00&amp;gt; [00:00:00.016,082] &amp;lt;inf&amp;gt; bt_sdc_hci_driver: SoftDevice Controller build revision: 
00&amp;gt;                                             c5 93 ba a9 14 4d 8d 05  30 4e 9b 92 d7 71 1e e8 |.....M.. 0N...q..
00&amp;gt;                                             aa 02 50 3c                                      |..P&amp;lt;             
00&amp;gt; [00:00:00.024,291] &amp;lt;inf&amp;gt; bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
00&amp;gt; [00:00:00.024,902] &amp;lt;inf&amp;gt; bt_hci_core: HW Variant: nRF52x (0x0002)
00&amp;gt; [00:00:00.025,482] &amp;lt;inf&amp;gt; bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 197.47763 Build 2370639017
00&amp;gt; [00:00:00.027,130] &amp;lt;inf&amp;gt; bt_hci_core: No ID address. App must call settings_load()
00&amp;gt; [00:00:00.027,740] &amp;lt;inf&amp;gt; peripheral_uart: Bluetooth initialized
00&amp;gt; [00:00:00.029,266] &amp;lt;inf&amp;gt; bt_hci_core: Identity: F8:53:36:C&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Strange Logging Behaviour when using bt_enable(NULL)</title><link>https://devzone.nordicsemi.com/thread/465921?ContentTypeID=1</link><pubDate>Thu, 25 Jan 2024 08:13:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a5208a1-954b-4b18-8473-1bd3fb10e581</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I&amp;#39;m surprised you&amp;nbsp;experience the same with&amp;nbsp;CONFIG_LOG_MODE_IMMEDIATE=y. Can you please try to view the logs with &lt;a href="https://www.segger.com/products/debug-probes/j-link/tools/rtt-viewer/"&gt;Jlink RTTViewer&lt;/a&gt;&amp;nbsp;and see if you get&amp;nbsp;the same results?&amp;nbsp;&lt;/p&gt;
[quote userid="131264" url="~/f/nordic-q-a/107700/strange-logging-behaviour-when-using-bt_enable-null/465893"]believe the identity line is printed inside the bt_enable(NULL) which is called before the&amp;nbsp;&lt;span&gt;LOG_INF&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;Bluetooth initialized&lt;/span&gt;&lt;span&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;) line, not sure why this is the case.&lt;/span&gt;[/quote]
&lt;p&gt;The identity is printed when you call settings_load() after bt_enable().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Strange Logging Behaviour when using bt_enable(NULL)</title><link>https://devzone.nordicsemi.com/thread/465893?ContentTypeID=1</link><pubDate>Thu, 25 Jan 2024 00:17:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af0c3c5f-6821-4bb6-8ed9-4f32c5014f10</guid><dc:creator>GeorgePM</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Thank you for the reply, this explanation made sense to me however neither proposed Kconfig settings had the intended behaviour.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Increasing the buffer size to 4096 or 8192 did not seem to affect the output and I got the same corrupted log from earlier:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:00.019,470] &amp;lt;inf&amp;gt; bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 197.47763 Build 2370639017
[00:00:00.020,385] &amp;lt;inf&amp;gt; bt_hci_core: No ID address. App must call settings_load()
[00:00:00.020,416] &amp;lt;inf&amp;gt; peripheral_uart: Bluetooth initialized
[00:00:00.021,423] &amp;lt;inf&amp;gt; bt_hci_core: Identi0m
[0m&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Using the immediate log mode did change the output however this is still not the correct output:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:00.024,932] &amp;lt;inf&amp;gt; bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 197.47763 Build 2370639017
[00:00:00.026,641] &amp;lt;inf&amp;gt; bt_hci_core: No ID address. App must call settings_load()
[00:00:00.027,221] &amp;lt;inf&amp;gt; peripheral_uart: Bluetooth initialized
[00:00:00.028,717] &amp;lt;inf&amp;gt; bt_hci_core: Identity: F8:53:36:C&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I still only see the intended output when adding the sleep:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:00.016,906] &amp;lt;inf&amp;gt; bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 197.47763 Build 2370639017
[00:00:00.017,791] &amp;lt;inf&amp;gt; bt_hci_core: No ID address. App must call settings_load()
[00:00:10.018,035] &amp;lt;inf&amp;gt; peripheral_uart: Bluetooth initialized
[00:00:10.019,134] &amp;lt;inf&amp;gt; bt_hci_core: Identity: F8:53:36:C3:DB:07 (random)
[00:00:10.019,165] &amp;lt;inf&amp;gt; bt_hci_core: HCI: version 5.4 (0x0d) revision 0x1102, manufacturer 0x0059
[00:00:10.019,256] &amp;lt;inf&amp;gt; bt_hci_core: LMP: version 5.4 (0x0d) subver 0x1102&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;One thing I did notice is in the output &amp;quot;Bluetooth initialized&amp;quot; is always printed before the identity line, however I believe the identity line is printed inside the bt_enable(NULL) which is called before the&amp;nbsp;&lt;span&gt;LOG_INF&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;Bluetooth initialized&lt;/span&gt;&lt;span&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;) line, not sure why this is the case.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Strange Logging Behaviour when using bt_enable(NULL)</title><link>https://devzone.nordicsemi.com/thread/465775?ContentTypeID=1</link><pubDate>Wed, 24 Jan 2024 11:42:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd7095a9-5ef7-40bb-897e-83f9b1e0f9d4</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;The &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.5.1/zephyr/services/logging/index.html"&gt;logger&lt;/a&gt; module, by default (CONFIG_LOG_MODE_DEFERRED=y), stores log messages in a buffer and processes them when the program enters the dedicated logger thread. Therefore, when you have a long-running thread, such as &amp;#39;main&amp;#39;, there&amp;#39;s a possibility that the log buffer might become full before the logger thread gets a chance to run. By using k_sleep(), you enable the logger thread to run before the initialization taking place in the main thread is complete.&lt;/p&gt;
&lt;p&gt;Kconfig settings you can experiement with:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;- &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/index.html#CONFIG_LOG_MODE_IMMEDIATE"&gt;CONFIG_LOG_MODE_IMMEDIATE&lt;/a&gt;=y - process logs immediatly&lt;/p&gt;
&lt;p&gt;-&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/index.html#CONFIG_LOG_BUFFER_SIZE"&gt;CONFIG_LOG_BUFFER_SIZE&lt;/a&gt;&amp;nbsp;- increase default buffer size when using deffered mode.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>