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

What is error_code 4097 in sd_softdevice_enable?

Hello,
I updated a working project based on nRF52832_xxAA 32Mhz crystal, from SoftDevice S132 5.0.0 to 7.0.1,
(set preprocessor NRF_SD_BLE_API_VERSION=7)

now the sd_softdevice_enable returns error_code 4097

  0> -CLOCK_LF_SRC 1
  0> -CLOCK_LF_RC_CTIV 0
  0> -CLOCK_LF_RC_TEMP_CTIV 0
  0> -CLOCK_LF_ACCURACY 1
  0> ret_code 4097
  0> <error> app: Fatal error

I have already tried to change CLOCK_LF_ACCURACY but the error remains
Parents Reply Children
  • 6 is correct, but there must be an IRQ that's being enabled without being applied with the priority setting from sdk_config.h.

    The interrupt has to be enabled before ble_stack_init() for this error to be triggered. So I suggest you go over initialization before ble_stack_init() and make sure you are configuring the correct priority for all interrupts that you have enabled up until this point.

  • I removed the boot to avoid that different interrupts were initialized but the problem remained, what can I do?
  • Are you referring to the bootloader? That should not be necessary as the bootloader disables all interrupts before booting the main app. Are you initializing any peripherals before calling ble_stack_init() in your code?

  •  If I comment "TIMER_Init" all works, why?

    int main(void)
    {	
    	//Initialize the clock
        main_clock_init();
    	//Initialize the gpio
    	main_gpio_init();
    
        TIMER_Init();       //if I comment this all works, why?
    
    	//Initialize the nrf log module
        main_log_init();
    
        {
            ret_code_t err_code;
            err_code = nrf_sdh_enable_request();
            if(err_code)
                SEGGER_RTT_printf(0,"err_code 0x%X",err_code);
            else    
                SEGGER_RTT_printf(0,"OK");
        }
        while(1);
    } 
    
    
    void TIMER_Init(void)
    {
        uint32_t time_ticks;
        uint32_t err_code = NRF_SUCCESS;
    
        //Configure TIMER for 10ms interval
        nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
        timer_cfg.interrupt_priority = NRFX_TIMER_DEFAULT_CONFIG_IRQ_PRIORITY;
        err_code = nrf_drv_timer_init(&TIMER_SYS, &timer_cfg, timer_sys_event_handler);
        APP_ERROR_CHECK(err_code);
        time_ticks = nrf_drv_timer_ms_to_ticks(&TIMER_SYS, TIMER_PERIOD);
        nrf_drv_timer_extended_compare(
             &TIMER_SYS, NRF_TIMER_CC_CHANNEL0, time_ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);
    	nrf_drv_timer_enable(&TIMER_SYS);
    }



Related