When I use nrf_drv_gpiote driver by sdk8.1.0. with softDevice 8. I got HardFault_Handler when run in
handler(pin,polarity); in the GPIOTE_IRQHandler
How to deal with it?
below is the init code:
nrf_drv_gpiote_in_uninit(INFRAD_RECEIVE_PIN);
nrf_drv_gpiote_in_config_t receive_gpiote_config=GPIOTE_CONFIG_IN_SENSE_TOGGLE(true);
err_code=nrf_drv_gpiote_in_init(INFRAD_RECEIVE_PIN,&receive_gpiote_config,receive_gpiote_handler);
APP_ERROR_CHECK(err_code);
nrf_drv_gpiote_in_event_enable(INFRAD_RECEIVE_PIN,true);
below is the gpiote handler:
static void receive_gpiote_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action){
static uint32_t prev_cc1 = 0;
int64_t curr_wave;
uint32_t active_time;
if(m_receive_halt>0)
return;
if( irparams.receive_begin==0)
{
irparams.receive_begin=1;
irparams.rawlen=0;
}
if(irparams.rawlen>296)
irparams.rawlen=0;
if(irparams.receive_begin>0){
irparams.timer=0;
}
irparams.rawbuf[irparams.rawlen]=NRF_TIMER1->CC[g_channel_id];
irparams.rawlen++;
NRF_GPIOTE->EVENTS_IN[g_channel_id] = 0;
}