Watch Dog timer with Template/ble_app_uart example

Hello, 

in my project i want to use watch dog timer in ble_app_uart_pca10040_s132   but  am getting error as shown in image1, even after including driver files and paths

actually in second image u can observe the condition  #ifndef SOFTDEVICE_PRESENT    

so plz solve this issue

Parents
  • Hello,

    You need remove the nrf_soc.c and nrf_nvic.c file from the project. These files are only meant to be used in projects which don't include the Softdevice.

  • Hello Vidar,

    Thanks for your reply

    Now WDT is running properly...!!

    i am trying to add WDT to ble_app_uart  example here is my main function code

    int main(void)
    {
            //==================================================================================
        
        uint32_t err_code = NRF_SUCCESS;
    
        //BSP configuration for button support: button pushing will feed the dog.
        err_code = nrf_drv_clock_init();
        APP_ERROR_CHECK(err_code);
        nrf_drv_clock_lfclk_request(NULL);
    
        err_code = app_timer_init();
        APP_ERROR_CHECK(err_code);
    
        err_code = bsp_init(BSP_INIT_BUTTONS, bsp_event_callback);
        APP_ERROR_CHECK(err_code);
    
        //Configure all LEDs on board.
        bsp_board_init(BSP_INIT_LEDS);
    
        //Configure WDT.
        nrf_drv_wdt_config_t config = NRF_DRV_WDT_DEAFULT_CONFIG;
        err_code = nrf_drv_wdt_init(&config, wdt_event_handler);
        APP_ERROR_CHECK(err_code);
        err_code = nrf_drv_wdt_channel_alloc(&m_channel_id);
        APP_ERROR_CHECK(err_code);
        nrf_drv_wdt_enable();
    
        //Indicate program start on LEDs.
        for (uint32_t i = 0; i < LEDS_NUMBER; i++)
        {   
            nrf_delay_ms(200);
            bsp_board_led_on(i);
        }
         err_code = bsp_buttons_enable();
         APP_ERROR_CHECK(err_code);
        
        nrf_drv_wdt_enable();
        
        //==================================================================================
    
        bool erase_bonds;
    
        // Initialize.
        uart_init();
        log_init();
        timers_init();
        buttons_leds_init(&erase_bonds);
        power_management_init();
        ble_stack_init();
        gap_params_init();
        gatt_init();
        services_init();
        advertising_init();
        conn_params_init();
    
        // Start execution.
        printf("\r\nUART started.\r\n");
        NRF_LOG_INFO("Debug logging for UART over RTT started.");
        advertising_start();
    
        // Enter main loop.
        for (;;)
        {
            //idle_state_handle();
        }
    }

    now i am facing the issue that, the device (nRF52832 DK) is not advertising (Nordic_UART)   so plz let me know the proper position to add the WDT code in main function.

    the WDT delay i have changed from 2sec to 10sec.

    So my requirement is i want to reset device for every 10sec.....

    (now reset is happening but not advertising)

    Regards,

    Nagendra AK

  • Hello,

    I have already offered to debug your project. Just zip the project folder and upload it here if you can.

  • Hello,

    thank you in advance

    pca10040-->s132-->ses

  • Hello Vidar,

    Plz let me know if u want any thing else

  • Hello,

    Here's an updated version of your project:

    I re-enabled logging over RTT. You can view the logs in the Debug terminal if you start a debug session in SES.

  • Hello Vidar,

    Thank you so much... its working i assigned 15 pin for led but its 18..so i thought its not running...sorry...

    now if i  use sd_power_system_off(); will WDT works after turn off device..??

    turn off means just running sd_power_system_off(); 

    my requirement is i want to turn off the device after my operation. and i should turn on using WDT. so how can we do  that

Reply
  • Hello Vidar,

    Thank you so much... its working i assigned 15 pin for led but its 18..so i thought its not running...sorry...

    now if i  use sd_power_system_off(); will WDT works after turn off device..??

    turn off means just running sd_power_system_off(); 

    my requirement is i want to turn off the device after my operation. and i should turn on using WDT. so how can we do  that

Children
Related