Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Enable SoftDevice s140 without enabling BLE

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 development, but for now I have to make sure that the RF-antenna is inactive.

I still need access to microcontroller temperature and non-volatile memory controller (nrf_fstorage.h) which are accessed through s140 when the stack is present on the microcontroller, hence it cannot be completely disabled.

Br. Casper

  • Hi Torbjørn,

    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't work. 

    Below are two code snippets that show what I am trying.

    1. This is the sequence of function calls I am using when the project is stable:

    #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, &ramStart);
        if(errCode != NRF_SUCCESS)
            return false;    
        
        errCode = nrf_sdh_ble_enable(&ramStart);
        if(errCode != NRF_SUCCESS)
            return false;
    
        bool erase_bonds;
        nrf_sdh_freertos_init(NULL, &erase_bonds);    
        
        return true;
    }

    2. This is the sequence I assume is correct for initializing the SoftDevice without BLE:

    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, &erase_bonds);    
    
        return true;
    }

    Is code snippet 2 how you would expect one to only enable the SoftDevice without BLE?

    Will code snippet 1 activate the RF antenna, or will it be OFF until any additional BLE function calls, like "start advertising", is called? As I mentioned in my original post, the goal is I have to make sure the RF-antenna is inactive.

    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?

    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.

    Br. Casper

  • Hi Casper

    Casper Kronborg Pedersen said:
    Is code snippet 2 how you would expect one to only enable the SoftDevice without BLE?

    In principle, yes, but we don't have any examples enabling SoftDevice without enabling BLE, and as such we haven't tested this use case either. 

    It is possible that some of the SDK modules don't work so well when you enable the SoftDevice without the BLE configuration in place, since we always assume that you enable both. 

    Casper Kronborg Pedersen said:
    Will code snippet 1 activate the RF antenna, or will it be OFF until any additional BLE function calls, like "start advertising", is called? As I mentioned in my original post, the goal is I have to make sure the RF-antenna is inactive.

    The SoftDevice will never enable the radio on its own. The only way to initiate any radio activity is to go into the advertising or scanning state. 

    In other words I recommend going for snippet 1, since this is the normal configuration of the SoftDevice. 

    Best regards
    Torbjørn

  • Hi Torbjørn,

    In principle, yes, but we don't have any examples enabling SoftDevice without enabling BLE, and as such we haven't tested this use case either. 

    It is possible that some of the SDK modules don't work so well when you enable the SoftDevice without the BLE configuration in place, since we always assume that you enable both.

    This probably explains what I am seeing then.

    The SoftDevice will never enable the radio on its own. The only way to initiate any radio activity is to go into the advertising or scanning state. 

    Thank you for clearing that up. This answers my question.

    Br. Casper

Related