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

2 GPIOTE interrupt on 2 PIN, but only one work

Dear Sir,
I need 2 interrupt handle on 2 PIN, I have set 2 GPIOTE event:

#define PIN_INT1_ACC     4      // INPUT      Interrupt INT1 from ACC
#define PIN_INTB_ECG     8      // INPUT      Interrupt INTB from ECG

//set interrupt 1

nrf_drv_gpiote_in_config_t in_config = NRFX_GPIOTE_CONFIG_IN_SENSE_LOTOHI(false);//TOHI(true);//NRFX_GPIOTE_CONFIG_IN_SENSE_HITOLO(true);//GPIOTE_CONFIG_IN_SENSE_TOGGLE(true);
in_config.pull = NRF_GPIO_PIN_PULLUP;
err_code = nrf_drv_gpiote_in_init(PIN_INT1_ACC, &in_config, LIS_in_pin_handler);
APP_ERROR_CHECK(err_code);
nrf_drv_gpiote_in_event_enable(PIN_INT1_ACC, true);


//set interrupt 2

nrf_drv_gpiote_in_config_t in_config_MAX = NRFX_GPIOTE_CONFIG_IN_SENSE_HITOLO(false);//TOHI(true);//NRFX_GPIOTE_CONFIG_IN_SENSE_HITOLO(true);//GPIOTE_CONFIG_IN_SENSE_TOGGLE(true);
err_code = nrf_drv_gpiote_in_init(PIN_INTB_ECG, &in_config_MAX, MAX_in_pin_handler);
APP_ERROR_CHECK(err_code);
nrf_drv_gpiote_in_event_enable(PIN_INTB_ECG, true);


void MAX_in_pin_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
   gECGSampleReady = true;
   gECGIntCount++;
}

void LIS_in_pin_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
   gLISIntCount++;
}


IF I ENABLE ONE OF THIS ABOVE THE HANDLER WORK PROPERLY (interrupt 1 or interrupt 2)

IF I enable both when the LIS_in_pin_handler is served the first time ,  none of the two handler work any more.
With the oscilloscope the signal on both PIN are OK, go up and down on both pins


I have tryed with SD on or off
If have put the gpiote_config_priority level at 0
If have put the gpiote_config_num_of_low_power_event at 2

But seem not work. Have an idea ?

Parents Reply
  • Ciao Kenneth,

    the solution was very simple.

    nrf_drv_gpiote_in_config_t in_config_LIS = NRFX_GPIOTE_CONFIG_IN_SENSE_LOTOHI(true);

    nrf_drv_gpiote_in_config_t in_config_MAX = NRFX_GPIOTE_CONFIG_IN_SENSE_HITOLO(true);

    nrf_drv_gpiote_in_config_t in_config_BUT = NRFX_GPIOTE_CONFIG_IN_SENSE_HITOLO(true);

    I need to use "true" (IN EVENT mode) instead "false" (PORT mode) in the nrf_drv_gpiote_in_config_t 

    Thanks for your time

    Marco

Children
No Data
Related