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
  • Hello, 

    If this is not the right SoftDevice version, what is?

    Yes, you are using correct SoftDevice for the nRF52832: s132 v6.1.1

    I found that ERROR 4097 corresponds to NRF_ERROR_SVC_HANDLER_MISSING from some other posts.

     No, the error corresponds to:

    #define NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION (NRF_ERROR_SDM_BASE_NUM + 1)  ///< Incorrect interrupt configuration (can be caused by using illegal priority levels, or having enabled SoftDevice interrupts).

    Your error 4097 = 0x1001 where NRF_ERROR_SDM_BASE_NUM  = 0x1000.

     From components\softdevice\s132\headers\nrf_sdm.h:

    /** @addtogroup NRF_SDM_FUNCTIONS Functions
     * @{ */
    
    /**@brief Enables the SoftDevice and by extension the protocol stack.
     *
     * @note Some care must be taken if a low frequency clock source is already running when calling this function:
     *       If the LF clock has a different source then the one currently running, it will be stopped. Then, the new
     *       clock source will be started.
     *
     * @note This function has no effect when returning with an error.
     *
     * @post If return code is ::NRF_SUCCESS
     *       - SoC library and protocol stack APIs are made available.
     *       - A portion of RAM will be unavailable (see relevant SDS documentation).
     *       - Some peripherals will be unavailable or available only through the SoC API (see relevant SDS documentation).
     *       - Interrupts will not arrive from protected peripherals or interrupts.
     *       - nrf_nvic_ functions must be used instead of CMSIS NVIC_ functions for reliable usage of the SoftDevice.
     *       - Interrupt latency may be affected by the SoftDevice  (see relevant SDS documentation).
     *       - Chosen low frequency clock source will be running.
     *
     * @param p_clock_lf_cfg Low frequency clock source and accuracy.
                             If NULL the clock will be configured as an RC source with rc_ctiv = 16 and .rc_temp_ctiv = 2
                             In the case of XTAL source, the PPM accuracy of the chosen clock source must be greater than or equal to the actual characteristics of your XTAL clock.
     * @param fault_handler Callback to be invoked in case of fault, cannot be NULL.
     *
     * @retval ::NRF_SUCCESS
     * @retval ::NRF_ERROR_INVALID_ADDR  Invalid or NULL pointer supplied.
     * @retval ::NRF_ERROR_INVALID_STATE SoftDevice is already enabled, and the clock source and fault handler cannot be updated.
     * @retval ::NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION SoftDevice interrupt is already enabled, or an enabled interrupt has an illegal priority level.
     * @retval ::NRF_ERROR_SDM_LFCLK_SOURCE_UNKNOWN Unknown low frequency clock source selected.
     * @retval ::NRF_ERROR_INVALID_PARAM Invalid clock source configuration supplied in p_clock_lf_cfg.
     */
    SVCALL(SD_SOFTDEVICE_ENABLE, uint32_t, sd_softdevice_enable(nrf_clock_lf_cfg_t const * p_clock_lf_cfg, nrf_fault_handler_t fault_handler));
    

    Meaning:

    * @retval ::NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION SoftDevice interrupt is already enabled, or an enabled interrupt has an illegal priority level.


    Why is it returning "ERROR 4097 [Unknown error code]" instead?

     The reason for it returning an Unknown Error Code is due to the "Error code to string converter" not being optimal, where the retval above is not a part of the nrf_strerror_array[]. See components\libraries\strerror\nrf_strerror.c

    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

     Can you provide some more information about your project? 

    Kind regards,
    Øyvind

Reply
  • Hello, 

    If this is not the right SoftDevice version, what is?

    Yes, you are using correct SoftDevice for the nRF52832: s132 v6.1.1

    I found that ERROR 4097 corresponds to NRF_ERROR_SVC_HANDLER_MISSING from some other posts.

     No, the error corresponds to:

    #define NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION (NRF_ERROR_SDM_BASE_NUM + 1)  ///< Incorrect interrupt configuration (can be caused by using illegal priority levels, or having enabled SoftDevice interrupts).

    Your error 4097 = 0x1001 where NRF_ERROR_SDM_BASE_NUM  = 0x1000.

     From components\softdevice\s132\headers\nrf_sdm.h:

    /** @addtogroup NRF_SDM_FUNCTIONS Functions
     * @{ */
    
    /**@brief Enables the SoftDevice and by extension the protocol stack.
     *
     * @note Some care must be taken if a low frequency clock source is already running when calling this function:
     *       If the LF clock has a different source then the one currently running, it will be stopped. Then, the new
     *       clock source will be started.
     *
     * @note This function has no effect when returning with an error.
     *
     * @post If return code is ::NRF_SUCCESS
     *       - SoC library and protocol stack APIs are made available.
     *       - A portion of RAM will be unavailable (see relevant SDS documentation).
     *       - Some peripherals will be unavailable or available only through the SoC API (see relevant SDS documentation).
     *       - Interrupts will not arrive from protected peripherals or interrupts.
     *       - nrf_nvic_ functions must be used instead of CMSIS NVIC_ functions for reliable usage of the SoftDevice.
     *       - Interrupt latency may be affected by the SoftDevice  (see relevant SDS documentation).
     *       - Chosen low frequency clock source will be running.
     *
     * @param p_clock_lf_cfg Low frequency clock source and accuracy.
                             If NULL the clock will be configured as an RC source with rc_ctiv = 16 and .rc_temp_ctiv = 2
                             In the case of XTAL source, the PPM accuracy of the chosen clock source must be greater than or equal to the actual characteristics of your XTAL clock.
     * @param fault_handler Callback to be invoked in case of fault, cannot be NULL.
     *
     * @retval ::NRF_SUCCESS
     * @retval ::NRF_ERROR_INVALID_ADDR  Invalid or NULL pointer supplied.
     * @retval ::NRF_ERROR_INVALID_STATE SoftDevice is already enabled, and the clock source and fault handler cannot be updated.
     * @retval ::NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION SoftDevice interrupt is already enabled, or an enabled interrupt has an illegal priority level.
     * @retval ::NRF_ERROR_SDM_LFCLK_SOURCE_UNKNOWN Unknown low frequency clock source selected.
     * @retval ::NRF_ERROR_INVALID_PARAM Invalid clock source configuration supplied in p_clock_lf_cfg.
     */
    SVCALL(SD_SOFTDEVICE_ENABLE, uint32_t, sd_softdevice_enable(nrf_clock_lf_cfg_t const * p_clock_lf_cfg, nrf_fault_handler_t fault_handler));
    

    Meaning:

    * @retval ::NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION SoftDevice interrupt is already enabled, or an enabled interrupt has an illegal priority level.


    Why is it returning "ERROR 4097 [Unknown error code]" instead?

     The reason for it returning an Unknown Error Code is due to the "Error code to string converter" not being optimal, where the retval above is not a part of the nrf_strerror_array[]. See components\libraries\strerror\nrf_strerror.c

    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

     Can you provide some more information about your project? 

    Kind regards,
    Øyvind

Children
No Data
Related