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

Hard Fault Handler Issue

I have app_error_handler and HardFault_Handler defined - I have the WDT enabled.  My issue is if I trigger a hard fault:

// Enable divide by zero interrupt
//
SCB->CCR |= 0x10;

int HwTest = 10;
int HwDivisor = 0;
int HwTrigger = HwTest / HwDivisor;

I don't hit any break points in my code, the code stops at 0x000008c8 - the Softdevice handler.  My WDT does not fire. 

I'm trying to create a test case to catch and handle a hard fault in my code.  Any Ideas what I'm missing?  Thanks

Parents Reply Children
  • I missed that last part of my WDT code:

    nrf_drv_wdt_config_t config = {0};

    config.behaviour = NRF_WDT_BEHAVIOUR_RUN_SLEEP;
    config.interrupt_priority = WDT_CONFIG_IRQ_PRIORITY;
    config.reload_value = SOFTWARE_WATCHDOG_TIMEOUT;

    err_code = nrf_drv_wdt_init(&config, wdt_event_handler);
    ISP_STARTUP_ERROR_CHECK(err_code, ISP_STARTUP_LOG_ID_WDT_INIT);

    err_code = nrf_drv_wdt_channel_alloc(&s_wdt_channel_id);
    ISP_STARTUP_ERROR_CHECK(err_code, ISP_STARTUP_LOG_ID_WDT_CHANNEL);
    nrf_drv_wdt_enable();

Related