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

GPIOTE event for a PIN and also at already expected level

Hello,

for our device we have an input PIN defined with GPIOTE, we expect an event when this input PIN goes from High to Low (interrupt is set by another device on the board):

     nrf_gpio_cfg_sense_input(CHARGING_PIN, GPIO_PIN_CNF_PULL_Pullup, NRF_GPIO_PIN_SENSE_LOW);  //it's set to low when charging
        

     nrf_drv_gpiote_in_config_t in_config_CHARGING_PIN = GPIOTE_CONFIG_IN_SENSE_HITOLO(true);
      

     in_config_CHARGING_PIN.pull = GPIO_PIN_CNF_PULL_Pullup; //this pin is open drain so must be pulled up
     err_code = nrf_drv_gpiote_in_init(CHARGING_PIN, &in_config_CHARGING_PIN, in_pin_handler_CHARGING_PIN);
     APP_ERROR_CHECK(err_code);
        
     nrf_drv_gpiote_in_event_enable(CHARGING_PIN, true);   

This will fire an event when the PIN goes from High to Low (ok) but we also want the event to be fired when the PIN is already at level Low when the device boots, how can achieve it?

Also, I don't know much about GPIOTE but aren't  the 2 parameters in orange redundant?

Thanks,

J.

Parents
  • Hi,

    nrf_gpio_cfg_sense_input is for configuring the given GPIO pin number as input with a sense capability NRF_GPIO_PIN_SENSE_LOW.

    GPIOTE_CONFIG_IN_SENSE_HITOLO indicates that the input pin will generate an event when the input value is changed to low.

    I don't know if it is possible to trigger a GPIOTE event when the device boots. You can maybe just place a check to see if the pin is low at the start of main?

    Best Regards,

    Marjeris

Reply
  • Hi,

    nrf_gpio_cfg_sense_input is for configuring the given GPIO pin number as input with a sense capability NRF_GPIO_PIN_SENSE_LOW.

    GPIOTE_CONFIG_IN_SENSE_HITOLO indicates that the input pin will generate an event when the input value is changed to low.

    I don't know if it is possible to trigger a GPIOTE event when the device boots. You can maybe just place a check to see if the pin is low at the start of main?

    Best Regards,

    Marjeris

Children
Related