This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

FreeRTOS NRF_SDH_DISPATCH_MODEL

We are using SDK 15.0 and Softdevice 6.0, FreeRTOS 8.2.1

Is there a way to use softdevice and NRF_SDH_DISPATCH_MODEL_INTERRUPT?

If not, it means SDH task MUST be the highest priority task and other constrains, such as: user handling of BLE events must be forwarded to other task (with lower priority than SDH).

Parents
  • It is a good question and you might have found a bug in how we handled different dispatch models. Ideally it should have been just enough to change NRF_SDH_DISPATCH_MODEL  in sdk_config.h file, but now you need to do this below.

    You can use NRF_SDH_DISPATCH_MODEL_INTERRUPT by setting NRF_SDH_DISPATCH_MODEL to that value in sdk_config.h file.

    1) remove nrf_sdh_freertos.c file from your project as you do not need to have separate task to manage softdevice events if you are doing it directly from interrupts.

    2) change few lines in your main.c like below to start advertising manually and comment out sdh_init

        application_timers_start();
        advertising_start(&erase_bonds);
        
    //    // Create a FreeRTOS task for the BLE stack.
    //    // The task will run advertising_start() before entering its loop.
    //    nrf_sdh_freertos_init(advertising_start, &erase_bonds);
    
        NRF_LOG_INFO("HRS FreeRTOS example started.");
        // Start FreeRTOS scheduler
        vTaskStartScheduler();

Reply
  • It is a good question and you might have found a bug in how we handled different dispatch models. Ideally it should have been just enough to change NRF_SDH_DISPATCH_MODEL  in sdk_config.h file, but now you need to do this below.

    You can use NRF_SDH_DISPATCH_MODEL_INTERRUPT by setting NRF_SDH_DISPATCH_MODEL to that value in sdk_config.h file.

    1) remove nrf_sdh_freertos.c file from your project as you do not need to have separate task to manage softdevice events if you are doing it directly from interrupts.

    2) change few lines in your main.c like below to start advertising manually and comment out sdh_init

        application_timers_start();
        advertising_start(&erase_bonds);
        
    //    // Create a FreeRTOS task for the BLE stack.
    //    // The task will run advertising_start() before entering its loop.
    //    nrf_sdh_freertos_init(advertising_start, &erase_bonds);
    
        NRF_LOG_INFO("HRS FreeRTOS example started.");
        // Start FreeRTOS scheduler
        vTaskStartScheduler();

Children
No Data
Related