<?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>Enable SoftDevice s140 without enabling BLE</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/94540/enable-softdevice-s140-without-enabling-ble</link><description>Hi DevZone, 
 I am working on an application using: 
 
 nRF52840 
 FreeRTOS v10.0.0.0 
 nRF SDK v17.1.0 
 S140 v7.2.0 
 
 My question is if it is possible to enable the S140 without enabling any BLE functionality. BLE will be enabled later in project</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 08 Dec 2022 09:40:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/94540/enable-softdevice-s140-without-enabling-ble" /><item><title>RE: Enable SoftDevice s140 without enabling BLE</title><link>https://devzone.nordicsemi.com/thread/399594?ContentTypeID=1</link><pubDate>Thu, 08 Dec 2022 09:40:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d5a9793c-8cf9-4763-95ab-84d276786540</guid><dc:creator>Casper Kronborg Pedersen</dc:creator><description>&lt;p&gt;Hi Torbj&amp;oslash;rn,&lt;/p&gt;
[quote userid="2116" url="~/f/nordic-q-a/94540/enable-softdevice-s140-without-enabling-ble/399581"]&lt;p&gt;In principle, yes, but we don&amp;#39;t have any examples enabling SoftDevice without enabling BLE, and as such we haven&amp;#39;t tested this use case either.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It is possible that some of the SDK modules don&amp;#39;t work so well when you enable the SoftDevice without the BLE configuration in place, since we always assume that you enable both.&lt;/p&gt;[/quote]
&lt;p&gt;This probably explains what I am seeing then.&lt;/p&gt;
[quote userid="2116" url="~/f/nordic-q-a/94540/enable-softdevice-s140-without-enabling-ble/399581"]The SoftDevice will never enable&amp;nbsp;the radio on its own. The only way to initiate any radio activity is to&amp;nbsp;go into the advertising or scanning state.&amp;nbsp;[/quote]
&lt;p&gt;Thank you for clearing that up. This answers my question.&lt;/p&gt;
&lt;p&gt;Br. Casper&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enable SoftDevice s140 without enabling BLE</title><link>https://devzone.nordicsemi.com/thread/399581?ContentTypeID=1</link><pubDate>Thu, 08 Dec 2022 08:54:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f948bb34-3d45-45cd-aa54-bb4d8d0c0e50</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Casper&lt;/p&gt;
[quote user="Casper Kronborg Pedersen"]Is code snippet 2 how you would expect one to only enable the SoftDevice without BLE?[/quote]
&lt;p&gt;In principle, yes, but we don&amp;#39;t have any examples enabling SoftDevice without enabling BLE, and as such we haven&amp;#39;t tested this use case either.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It is possible that some of the SDK modules don&amp;#39;t work so well when you enable the SoftDevice without the BLE configuration in place, since we always assume that you enable both.&amp;nbsp;&lt;/p&gt;
[quote user="Casper Kronborg Pedersen"]Will code snippet 1 activate the RF antenna, or will it be OFF until any additional BLE function calls, like &amp;quot;start advertising&amp;quot;, is called? As I mentioned in my original post,&lt;span style="text-decoration:underline;"&gt; the goal is I have to make sure the RF-antenna is inactive&lt;/span&gt;.[/quote]
&lt;p&gt;The SoftDevice will never enable&amp;nbsp;the radio on its own. The only way to initiate any radio activity is to&amp;nbsp;go into the advertising or scanning state.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In other words I recommend going for snippet 1, since this is the normal configuration of the SoftDevice.&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: Enable SoftDevice s140 without enabling BLE</title><link>https://devzone.nordicsemi.com/thread/399569?ContentTypeID=1</link><pubDate>Thu, 08 Dec 2022 07:38:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17f8fb7d-952e-4de0-b08e-38eb7dd5e65d</guid><dc:creator>Casper Kronborg Pedersen</dc:creator><description>&lt;p&gt;Hi Torbj&amp;oslash;rn,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="2116" url="~/f/nordic-q-a/94540/enable-softdevice-s140-without-enabling-ble/399564"]Thanks for the clarification. Do you also have nrf_sdh_freertos_init() in place in this case? If so it makes sense that it wouldn&amp;#39;t work.&amp;nbsp;[/quote]
&lt;p&gt;Below are two code snippets that show what I am trying.&lt;/p&gt;
&lt;p&gt;1. This is the sequence of function calls I am using when the project is stable:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define BLE_CONN_CFG_TAG 1

bool S140_Initialize()
{
    uint32_t ramStart = 0;
    ret_code_t errCode;
    
    errCode = nrf_sdh_enable_request();
    if(errCode != NRF_SUCCESS)
        return false;
        
    errCode = nrf_sdh_ble_default_cfg_set(BLE_CONN_CFG_TAG, &amp;amp;ramStart);
    if(errCode != NRF_SUCCESS)
        return false;    
    
    errCode = nrf_sdh_ble_enable(&amp;amp;ramStart);
    if(errCode != NRF_SUCCESS)
        return false;

    bool erase_bonds;
    nrf_sdh_freertos_init(NULL, &amp;amp;erase_bonds);    
    
    return true;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;2. This is the sequence I assume is correct for initializing the SoftDevice without BLE:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;bool S140_Initialize()
{
    uint32_t ramStart = 0;
    ret_code_t errCode;

    errCode = nrf_sdh_enable_request();
    if(errCode != NRF_SUCCESS)
        return false;    

    bool erase_bonds;
    nrf_sdh_freertos_init(NULL, &amp;amp;erase_bonds);    

    return true;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Is code snippet 2 how you would expect one to only enable the SoftDevice without BLE?&lt;/p&gt;
&lt;p&gt;Will code snippet 1 activate the RF antenna, or will it be OFF until any additional BLE function calls, like &amp;quot;start advertising&amp;quot;, is called? As I mentioned in my original post,&lt;span style="text-decoration:underline;"&gt; the goal is I have to make sure the RF-antenna is inactive&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="2116" url="~/f/nordic-q-a/94540/enable-softdevice-s140-without-enabling-ble/399564"]As for the SD-card libraries I could not find any dependence on the SoftDevice in any of them. I assume you use app_sdcard.c, diskio_blkdev.c and the standard SPI drivers?[/quote]
&lt;p&gt;Not entirely. I am using code that closely resembles the app_sdcard.c and diskio_blkdev.c, but I am not using any SoftDevice related functionality in this code. Nor am I accessing any protected peripherals. The SPI driver is standard nrf_drv_spi.h and nrfx_spim.h.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Br. Casper&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enable SoftDevice s140 without enabling BLE</title><link>https://devzone.nordicsemi.com/thread/399564?ContentTypeID=1</link><pubDate>Thu, 08 Dec 2022 07:10:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fabef8a0-9f1e-4b94-9a15-2d57ba75dd07</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Casper&lt;/p&gt;
[quote user="Casper Kronborg Pedersen"]Just to be clear, the &amp;quot;stack init function&amp;quot; you are mentioning here is the code below like in the usbd_ble_uart_freertos_pca10056_s140 example?:[/quote]
&lt;p&gt;That&amp;#39;s the one, yes.&amp;nbsp;&lt;/p&gt;
[quote user="Casper Kronborg Pedersen"]It looks like the&amp;nbsp;nrf_sdh_ble_default_cfg_set() function of the code above is setting configurations for the BLE stack as well as the&amp;nbsp;nrf_sdh_ble_enable() function actually enabling the BLE stack. It is when I remove these two function calls from my own project, but keep the&amp;nbsp;nrf_sdh_enable_request() call, that I experience issues.[/quote]
&lt;p&gt;Thanks for the clarification. Do you also have nrf_sdh_freertos_init() in place in this case? If so it makes sense that it wouldn&amp;#39;t work.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I would expect you to be able to enable the SoftDevice without configuring the BLE parameters as long as you don&amp;#39;t try to use any BLE functions later on (such as starting advertising).&amp;nbsp;&lt;/p&gt;
[quote user="Casper Kronborg Pedersen"]I think I also need to call&amp;nbsp;nrf_sdh_freertos_init(advertising_start, NULL) to handle any events from the SoftDevice when running FreeRTOS?[/quote]
&lt;p&gt;I don&amp;#39;t have a lot of experience with FreeRTOS, but looking at the implementation of this function I agree with your assessment.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In normal applications SoftDevice events will be polled by a dedicated software interrupt, but when using FreeRTOS this will be handled by a task instead. It makes sense that you would get issues if you don&amp;#39;t run this function,&amp;nbsp;at least if the SoftDevice is doing something that would end up generating events.&amp;nbsp;&lt;/p&gt;
[quote user="Casper Kronborg Pedersen"]But this is also starting advertising on BLE which I need to avoid at the moment. This makes me wonder if what I am trying to do is possible while running FreeRTOS?[/quote]
&lt;p&gt;You should be able to provide NULL in the call to nrf_sdh_freertos_init(..) rather than a pointer to the advertising_start function, then this argument will be ignored:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;nrf_sdh_freertos_init(NULL, &amp;amp;erase_bonds);&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;As for the SD-card libraries I could not find any dependence on the SoftDevice in any of them. I assume you use app_sdcard.c, diskio_blkdev.c and the standard SPI drivers?&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: Enable SoftDevice s140 without enabling BLE</title><link>https://devzone.nordicsemi.com/thread/399359?ContentTypeID=1</link><pubDate>Wed, 07 Dec 2022 09:45:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ec233dc-b2fe-4e5c-9662-fa407785fbbd</guid><dc:creator>Casper Kronborg Pedersen</dc:creator><description>&lt;p&gt;Hi Torbj&amp;oslash;rn,&lt;/p&gt;
[quote userid="2116" url="~/f/nordic-q-a/94540/enable-softdevice-s140-without-enabling-ble/399345"]The peripheral protection mechanism is not tied in any way to the Bluetooth functionality, it will be enabled as soon as the SoftDevice is enabled.&amp;nbsp;[/quote]
&lt;p&gt;Thank you for clearing that up. Then it seems what I am trying to achieve is definitely possible.&lt;/p&gt;
[quote userid="2116" url="~/f/nordic-q-a/94540/enable-softdevice-s140-without-enabling-ble/399345"]The only way to access blocked peripherals when the SoftDevice is enabled is to request a timeslot. In timeslots you can do more or less whatever you like, as long as you make sure to end the timeslot in time.&amp;nbsp;[/quote]
&lt;p&gt;I checked out the list of restricted and blocked peripherals, and I don&amp;#39;t see any conflicts with what I am doing. I am also making sure to use the SD API when accessing any functionality from restricted peripherals (TEMP, NVMC, CLOCK and POWER in my case).&lt;/p&gt;
[quote userid="2116" url="~/f/nordic-q-a/94540/enable-softdevice-s140-without-enabling-ble/399345"]&lt;p&gt;I don&amp;#39;t think we have an example specifically for this, but you could just take any BLE example and remove the&amp;nbsp;BLE related init functions, such as the GAP initialization and the service initialization.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;All you want to remain is the stack init function, which is typically one of the first setup functions in the examples.&amp;nbsp;&lt;/p&gt;[/quote]
&lt;p&gt;Just to be clear, the &amp;quot;stack init function&amp;quot; you are mentioning here is the code below like in the usbd_ble_uart_freertos_pca10056_s140 example?:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void ble_stack_init(void)
{
    ret_code_t err_code;

    err_code = nrf_sdh_enable_request();
    APP_ERROR_CHECK(err_code);

    // Configure the BLE stack using the default settings.
    // Fetch the start address of the application RAM.
    uint32_t ram_start = 0;
    err_code = nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &amp;amp;ram_start);
    APP_ERROR_CHECK(err_code);

    // Enable BLE stack.
    err_code = nrf_sdh_ble_enable(&amp;amp;ram_start);
    APP_ERROR_CHECK(err_code);

    // Register a handler for BLE events.
    NRF_SDH_BLE_OBSERVER(m_ble_observer, APP_BLE_OBSERVER_PRIO, ble_evt_handler, NULL);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;It looks like the&amp;nbsp;nrf_sdh_ble_default_cfg_set() function of the code above is setting configurations for the BLE stack as well as the&amp;nbsp;nrf_sdh_ble_enable() function actually enabling the BLE stack. It is when I remove these two function calls from my own project, but keep the&amp;nbsp;nrf_sdh_enable_request() call, that I experience issues.&lt;/p&gt;
&lt;p&gt;I think I also need to call&amp;nbsp;nrf_sdh_freertos_init(advertising_start, NULL) to handle any events from the SoftDevice when running FreeRTOS?&lt;br /&gt;But this is also starting advertising on BLE which I need to avoid at the moment. This makes me wonder if what I am trying to do is possible while running FreeRTOS?&lt;/p&gt;
[quote userid="2116" url="~/f/nordic-q-a/94540/enable-softdevice-s140-without-enabling-ble/399345"]I am not sure why the SD card driver would have to do this. I am currently out of office, but can take a look at the driver when I am back.&amp;nbsp;[/quote]
&lt;p&gt;That sounds good, thank you!&lt;/p&gt;
&lt;p&gt;Br. Casper&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enable SoftDevice s140 without enabling BLE</title><link>https://devzone.nordicsemi.com/thread/399345?ContentTypeID=1</link><pubDate>Wed, 07 Dec 2022 08:51:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0db6f20b-c7fd-4e0d-be0e-16036c6c5ed9</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Casper&lt;/p&gt;
[quote user="Casper Kronborg Pedersen"]Does a complete list of peripherals that are protected by the SoftDevice exist, perhaps even with more examples of what not to access?[/quote]
&lt;p&gt;Yes, this is a part of the S140 SoftDevice Specification document, in the Hardware peripherals chapter.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Go &lt;a href="https://infocenter.nordicsemi.com/topic/sds_s140/SDS/s1xx/sd_resource_reqs/hw_block_interrupt_vector.html"&gt;here&lt;/a&gt; for the S140 v7.2.0 version.&amp;nbsp;&lt;/p&gt;
[quote user="Casper Kronborg Pedersen"]Is it true that even though the SoftDevice is enabled with&amp;nbsp;nrf_sdh_enable_request() that I cannot access any of the protected peripherals as long as the BLE part of the SoftDevice is disabled?[/quote]
&lt;p&gt;The peripheral protection mechanism is not tied in any way to the Bluetooth functionality, it will be enabled as soon as the SoftDevice is enabled.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The peripherals listed as &amp;quot;Restricted&amp;quot; in the SoftDevice specification can still be accessed indirectly, but using the corresponding SD API (such as the TEMP and RNG peripherals).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The only way to access blocked peripherals when the SoftDevice is enabled is to request a timeslot. In timeslots you can do more or less whatever you like, as long as you make sure to end the timeslot in time.&amp;nbsp;&lt;/p&gt;
[quote user="Casper Kronborg Pedersen"]Does an example exist of how to configure the SoftDevice without configuring the Bluetooth stack?[/quote]
&lt;p&gt;I don&amp;#39;t think we have an example specifically for this, but you could just take any BLE example and remove the&amp;nbsp;BLE related init functions, such as the GAP initialization and the service initialization.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;All you want to remain is the stack init function, which is typically one of the first setup functions in the examples.&amp;nbsp;&lt;/p&gt;
[quote user="Casper Kronborg Pedersen"]As soon as the BLE stack is enabled with&amp;nbsp;nrf_sdh_ble_default_cfg_set() and&amp;nbsp;nrf_sdh_ble_enable(), it works.[/quote]
&lt;p&gt;You mean to say that just enabling the SoftDevice is enough, or you need to enable BLE as well?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When you build a project with a SoftDevice then some drivers might switch to using SoftDevice API&amp;#39;s to access certain hardware resources, since they are then managed by the SoftDevice, but I am not sure why the SD card driver would have to do this. I am currently out of office, but can take a look at the driver when I am back.&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: Enable SoftDevice s140 without enabling BLE</title><link>https://devzone.nordicsemi.com/thread/399195?ContentTypeID=1</link><pubDate>Tue, 06 Dec 2022 13:03:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e3981af-d951-450c-9637-f6125f6b1f5a</guid><dc:creator>Casper Kronborg Pedersen</dc:creator><description>&lt;p&gt;Hi Torbj&amp;oslash;rn,&lt;/p&gt;
&lt;p&gt;Thank you for getting back to me.&lt;/p&gt;
&lt;p&gt;I have some more questions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Does a complete list of peripherals that are protected by the SoftDevice exist, perhaps even with more examples of what not to access?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Is it true that even though the SoftDevice is enabled with&amp;nbsp;nrf_sdh_enable_request() that I cannot access any of the protected peripherals as long as the BLE part of the SoftDevice is disabled?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Does an example exist of how to configure the SoftDevice without configuring the Bluetooth stack?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I am currently having an unstable build after disabling my Bluetooth stack.&amp;nbsp;Symptoms of instability that I am seeing is a sudden fail of all writes to my SD-card which is connected to SPIM3. As soon as the BLE stack is enabled with&amp;nbsp;nrf_sdh_ble_default_cfg_set() and&amp;nbsp;nrf_sdh_ble_enable(), it works. I am suspecting that I am either accessing a resource that is SoftDevice protected, or that I am &amp;quot;initializing the SoftDevice without BLE stack&amp;quot; incorrectly.&lt;/p&gt;
&lt;p&gt;Br. Casper&lt;/p&gt;
&lt;p&gt;Edit: Clarification.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enable SoftDevice s140 without enabling BLE</title><link>https://devzone.nordicsemi.com/thread/399152?ContentTypeID=1</link><pubDate>Tue, 06 Dec 2022 11:09:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af6f4b41-dd08-47b5-90e4-fe0e1290edd5</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Casper&lt;/p&gt;
&lt;p&gt;Yes, enabling the SoftDevice without configuring or running the Bluetooth stack is OK.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Just make sure to avoid accessing peripherals that are protected by the SoftDevice, such as the radio, TIMER0 or RTC0.&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>