<?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>Restricted Memory Range + BLE concerns</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/104368/restricted-memory-range-ble-concerns</link><description>So I have my application sitting on top of the ble_app_hrs_freertos app. In main, I explicitly call vTaskStartScheduler. 
 Couple observations: 
 
 Why is there a need to have advertising_start in its own task via nrf_sdh_freertos_init(advertising_start</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 10 Oct 2023 06:48:05 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/104368/restricted-memory-range-ble-concerns" /><item><title>RE: Restricted Memory Range + BLE concerns</title><link>https://devzone.nordicsemi.com/thread/449446?ContentTypeID=1</link><pubDate>Tue, 10 Oct 2023 06:48:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c2c6e6ee-dffb-41ea-985d-81260dbeb46d</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;sd_softdevice_enable() activates the Softdevice, which involves starting the LF clock. However, this has no direct relationship with the RTOS.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We are not creating a separate Freertos task for advertising_start(), but it is being called by the Softdevice task when it starts here:&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/pastedimage1696920359605v1.png" alt=" " /&gt;&lt;/p&gt;
[quote user="morpho"]Is the only reason to use&amp;nbsp;nrf_sdh_freertos_init with&amp;nbsp;&lt;span&gt;advertising_start to prevent it from running before the scheduler starts? Why is&amp;nbsp;advertising_start related to the scheduler in any way though?&lt;/span&gt;[/quote]
&lt;p&gt;Connectable advertising should not be&amp;nbsp;started&amp;nbsp;before the Softdevice task is running, since the Softdevice task is&amp;nbsp;required for retrieving connection and other Softdevice events.&lt;/p&gt;
[quote user="morpho"]I have a scheduler in my main application and that only runs after the BLE is initialized which involves setting up the advertisement so I don&amp;#39;t know if there really is a need to set up a task for&amp;nbsp;advertising_start in particular; we can just set up the LF clock and call it a day no?[/quote]
&lt;p&gt;Calling advertising_start() will make the device start advertising immediately.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restricted Memory Range + BLE concerns</title><link>https://devzone.nordicsemi.com/thread/449412?ContentTypeID=1</link><pubDate>Mon, 09 Oct 2023 18:48:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:196036df-de33-4d29-ab8d-d6d3cb5f384d</guid><dc:creator>morpho</dc:creator><description>&lt;p&gt;Setting optimization to 0 did it! That was a whacky experience.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/104368/restricted-memory-range-ble-concerns/449117"]The low-frequency (LF) clock is the 32 kHz clock used by the RTOS scheduler and the SoftDevice to keep track of time. The clock is started by&amp;nbsp;sd_softdevice_enable() in&amp;nbsp;nrf_sdh_enable_request().[/quote]
&lt;p&gt;I see, so in short, it 1) enables the LF clock 2) creates a task for&amp;nbsp;advertising_start&lt;/p&gt;
&lt;p&gt;Is the only reason to use&amp;nbsp;nrf_sdh_freertos_init with&amp;nbsp;&lt;span&gt;advertising_start to prevent it from running before the scheduler starts? Why is&amp;nbsp;advertising_start related to the scheduler in any way though?&lt;br /&gt;&lt;br /&gt;I have a scheduler in my main application and that only runs after the BLE is initialized which involves setting up the advertisement so I don&amp;#39;t know if there really is a need to set up a task for&amp;nbsp;advertising_start in particular; we can just set up the LF clock and call it a day no?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restricted Memory Range + BLE concerns</title><link>https://devzone.nordicsemi.com/thread/449117?ContentTypeID=1</link><pubDate>Fri, 06 Oct 2023 05:56:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c07f1e7-1052-4aed-b80b-dee54bd838aa</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Which compiler optimization level are you using when debugging the application? From your video, it appears the debugger might be displaying the r0 value, but it&amp;#39;s&amp;nbsp;hard to confirm without the project in front of me.&lt;/p&gt;
&lt;p&gt;Optimization should be disabled here when debugging:&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/pastedimage1696570778130v3.png" alt=" " /&gt;&lt;/p&gt;
[quote user="morpho"]Sorry, what&amp;#39;s LF clock? it&amp;#39;s not enabled by&amp;nbsp;&lt;span&gt;nrf_sdh_freertos_init()&amp;nbsp;I reckon? What function enables it?&lt;/span&gt;[/quote]
&lt;p&gt;The low-frequency (LF) clock is the 32 kHz clock used by the RTOS scheduler and the SoftDevice to keep track of time. The clock is started by&amp;nbsp;sd_softdevice_enable() in&amp;nbsp;nrf_sdh_enable_request().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restricted Memory Range + BLE concerns</title><link>https://devzone.nordicsemi.com/thread/448871?ContentTypeID=1</link><pubDate>Wed, 04 Oct 2023 15:31:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:817ee7d7-b844-4356-a221-924eb7f06049</guid><dc:creator>morpho</dc:creator><description>&lt;p&gt;2. How is a function parameter pointing to an area outside an application region? How&amp;#39;s it possible? Does it mean the memory is fully consumed?&lt;br /&gt;I already have the Restricted Memory Access enabled&lt;/p&gt;
&lt;p&gt;3. Sorry, what&amp;#39;s LF clock? it&amp;#39;s not enabled by&amp;nbsp;&lt;span&gt;nrf_sdh_freertos_init()&amp;nbsp;I reckon? What function enables it?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Related to the first point: in the same function GetMessage,&amp;nbsp;do you see why would val contain nothing and value gets set to 0 after the strcmp? Pls refer to the video&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/Screenshot-2023_2D00_10_2D00_04-at-8.43.56_2F20_PM.png" /&gt;&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/cast_5F00_strange_5F00_behavior.mov"&gt;devzone.nordicsemi.com/.../cast_5F00_strange_5F00_behavior.mov&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;DataUnit is an alias for uint8_t&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;br /&gt;Weirdly, it happens with char* but I need char* to use strcmp&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void UARTApp::UARTCallback(Fifo&amp;lt;DataUnit&amp;gt; fifoRx)        // within UART ISR
{
     char* ptr2 = reinterpret_cast&amp;lt;char*&amp;gt;(parsedInput); // Restricted Range
     unsigned char* ptr1 = reinterpret_cast&amp;lt;unsigned char*&amp;gt;(parsedInput); // OK
     uint8_t* ptr = reinterpret_cast&amp;lt; uint8_t*&amp;gt;(parsedInput); // OK
     
     // ...
 }&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restricted Memory Range + BLE concerns</title><link>https://devzone.nordicsemi.com/thread/448771?ContentTypeID=1</link><pubDate>Wed, 04 Oct 2023 09:24:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:00ed2949-ccf5-444e-a4ad-3f8f84481f48</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;1. Calling&amp;nbsp;&lt;span&gt;nrf_sdh_freertos_init() with&amp;nbsp;advertising_start() ensures the advertiser is not started before the scheduler is running. The connection event will not be processed if the connection is established before the scheduler is started.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2. Restricted memory range indicates that the pointer is pointing to an area outside of the application region. You can set&amp;nbsp;the setting shown below to &amp;#39;No&amp;#39; to find out what the address is.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&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/pastedimage1696411394816v1.png" alt=" " /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;3. The Softdevice is responsible for starting the LF clock and the scheduler will not run without it.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>