NRF52 on custom hardware
SDK 17.0.1
SoftDevice 7.2
I have a timer running, one shot or repeated, that blinks an LED.
It works just fine when run from the debugger but if I hit stop, or try to run disconnected from the Segger it hard faults. The LED may blink 1-3 times then stops.
If I attach the debugger and pause it is in the hard fault handler.
If I run the ble beacon app, modified for my hardware, it runs just fine.
Why am I getting a hard fault?!?
Thanks
Keith Vasilakes
int main(void)
{
// Initialize.
log_init();
timer_init();
power_management_init();
MainStart();
ButtonsLedsInit();
ble_stack_init();
for (;;)
{
idle_state_handle();
}
void ButtonsLedsInit(void)
{
APP_ERROR_CHECK(nrf_drv_gpiote_init());
LEDState = LEDStMtbNormal;
nrf_gpio_cfg_output(SysLED);
nrf_gpio_cfg_output(LoRaLED);
nrf_gpio_cfg_output(BLELED);
nrf_gpio_cfg_output(BattLED);
nrf_gpio_cfg_input(BUTTON,GPIO_PIN_CNF_PULL_Disabled);
nrf_gpio_pin_set(SysLED);
nrf_gpio_pin_set(LoRaLED);
nrf_gpio_pin_set(BLELED);
nrf_gpio_pin_set(BattLED);
ButtonPressed = ButtonPressedNot;
//Enable button event
nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(true);
in_config.pull = NRF_GPIO_PIN_NOPULL;
APP_ERROR_CHECK( nrfx_gpiote_in_init(BUTTON, &in_config, ButtonsLedsButtonEvent));
nrf_drv_gpiote_in_event_enable(BUTTON, true);
APP_ERROR_CHECK(app_timer_create(&SysLEDTimerID, APP_TIMER_MODE_REPEATED, SysLEDTimeOutHandler));
APP_ERROR_CHECK(app_timer_start(SysLEDTimerID, 1000/*GetFlashLEDOnTime(LED_SYSTEM_SLOW)*/, NULL));
nrf_gpio_pin_clear(SysLED); //LED ON
}
static void SysLEDTimeOutHandler(void * p_context)
{
UNUSED_PARAMETER(p_context);
if(SysLEDOn)
nrf_gpio_pin_set(SysLED);
else
nrf_gpio_pin_clear(SysLED);
SysLEDOn = !SysLEDOn;
}