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

ERROR 4097 [Unknown error code] at nrf_sdh_enable_request

I am receiving "ERROR 4097 [Unknown error code]" returned upon calling nrf_sdh_enable_request. I found that ERROR 4097 corresponds to NRF_ERROR_SVC_HANDLER_MISSING from some other posts. I also found that this means that I'm using the wrong SoftDevice version. I'm using SDK v15.3.0 which has s132 6.1.1 to program an nRF521832. If this is not the right SoftDevice version, what is?

Also, why is my error handling not returning NRF_ERROR_SVC_HANDLER_MISSING directly? Why is it returning "ERROR 4097 [Unknown error code]" instead?

Some clarification: BLE was working well and this error was not showing until I integrated the GPIOTE example to my code to toggle a gpio at 2 MHz.

Thanks

Parents
  • In the NVIC API, you'll find the function sd_nvic_SetPriority.

    /**@brief Set Interrupt Priority.
     * @note Corresponds to NVIC_SetPriority in CMSIS.
     *
     * @pre IRQn is valid and not reserved by the stack.
     * @pre Priority is valid and not reserved by the stack.
     *
     * @param[in] IRQn      See the NVIC_SetPriority documentation in CMSIS.
     * @param[in] priority  A valid IRQ priority for use by the application.
     *
     * @retval ::NRF_SUCCESS The interrupt and priority level is available for the application.
     * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE IRQn is not available for the application.
     * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED The interrupt priority is not available for the application.
     */
    __STATIC_INLINE uint32_t sd_nvic_SetPriority(IRQn_Type IRQn, uint32_t priority);


    The relevant IRQ can be found in modules\nrfx\mdk\nrf52840.h.

    When initializing the Timer, call the SetPriority function with correct IRQ and priority level. There is no example of this in our SDK, but a similar basic example is available in CMSIS.

    As stated in the documentation, see NVIC_SetPriority in the ARM CMSIS Documentation for more information.

    Kind regards,
    Øyvind

Reply
  • In the NVIC API, you'll find the function sd_nvic_SetPriority.

    /**@brief Set Interrupt Priority.
     * @note Corresponds to NVIC_SetPriority in CMSIS.
     *
     * @pre IRQn is valid and not reserved by the stack.
     * @pre Priority is valid and not reserved by the stack.
     *
     * @param[in] IRQn      See the NVIC_SetPriority documentation in CMSIS.
     * @param[in] priority  A valid IRQ priority for use by the application.
     *
     * @retval ::NRF_SUCCESS The interrupt and priority level is available for the application.
     * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE IRQn is not available for the application.
     * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED The interrupt priority is not available for the application.
     */
    __STATIC_INLINE uint32_t sd_nvic_SetPriority(IRQn_Type IRQn, uint32_t priority);


    The relevant IRQ can be found in modules\nrfx\mdk\nrf52840.h.

    When initializing the Timer, call the SetPriority function with correct IRQ and priority level. There is no example of this in our SDK, but a similar basic example is available in CMSIS.

    As stated in the documentation, see NVIC_SetPriority in the ARM CMSIS Documentation for more information.

    Kind regards,
    Øyvind

Children
  •     //initialize TIMER module
        afe_clk_timer = NRF_DRV_TIMER_INSTANCE(0);
        nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
        timer_cfg.frequency = NRF_TIMER_FREQ_2MHz;
        sd_nvic_SetPriority(GPIOTE_IRQn, 2);
        timer_cfg.interrupt_priority = 2;
        err_code = nrf_drv_timer_init(&afe_clk_timer, &timer_cfg, timer_dummy_handler);
        APP_ERROR_CHECK(err_code);
    


    This is where I initialize the timer of the GPIOTE feature. I tried to use sd_nvic_SetPriority to set the priority of GPIOTE interrupts to 2 (tried other levels such as 7 as well), but this doesn't solve the problem. I also tried setting the .interrupt_priority variable but that didn't work either. 

    Do you know what could be the problem? In the BLE examples, app_timer_init has to be called for the device to advertise properly; could the problem be related to this initialization?  

Related