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

err_code 8 meaning in nrf_drv_gpiote_init()

Hello, I am trying to configure gpiote to give an interrupt for wake on motion functionality in MPU9250 I am configuring the MPU for that by calling separate wake_on_motion() and then I am calling the gpiote_config(). Below given is my function:

static void gpio_config(void) { ret_code_t err_code;

err_code = nrf_drv_gpiote_init();
APP_ERROR_CHECK(err_code);

nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_LOTOHI(true);
in_config.pull = NRF_GPIO_PIN_NOPULL;

err_code = nrf_drv_gpiote_in_init(MPU9250_INT_PIN, &in_config, int_pin_handler);
APP_ERROR_CHECK(err_code);

nrf_drv_gpiote_in_event_enable(MPU9250_INT_PIN, true);

}

but i am getting err_code 8 after calling this function.

What is its meaning ?

  • Hi,

    Error code 0x08 means NRF_ERROR_INVALID_STATE. This typically indicates that GPIOTE module is already initialized. Are you sure you are not using GPIOTE somewhere else in your application (app_button does for instance use the GPIOTE module ).

    Best regards,

    Jørgen

  • Thanks Jorgen for your reply, i am initializing uart function where I am calling APP_UART_FIFO_INIT().

    where it is mentioned in its description that "@note Since this macro allocates a buffer and registers the module as a GPIOTE user when flow control is enabled, it must only be called once."

    So I think because of this I am getting this error.

    Is there any other way where I can use uart functionality and gpio interrupt simultaneously ?

  • I'm not getting any errors when initializing GPIOTE after having initialized UART with flow control (using APP_UART_FIFO_INIT). Could you search your project for other modules calling nrf_drv_gpiote_init()?

  • This error is not there now, I just shifted my mpu interrupt from gpio 38 to 21. But thanks for the help