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

err_code 8 on nrfx_gpiote_in_init(19, &in_config, in_pin_handler);

Hello all,

I am using sdk 16, trying to make a simple interrupt from pin 19.. I keep getting error code :- on this line nrfx_gpiote_in_init(19, &in_config, in_pin_handler);

While searching online people said that I may be initializing gpiote somewhere else, but it not possible as i commented out all my code except nrf log init and gpio init. Please can some one help.. I basicaly used the Ble App_blinky example , took out all the Button and led stuff and added the below code to it.. Without below code it works as expected. 

my main code:

int main(void)
{
// Initialize.
log_init();
// timer_init();
gpio_init();
// power_management_init();
// ble_stack_init();
//scan_init();
//gatt_init();
//db_discovery_init();
// nrf_gpio_cfg_input(19,NRF_GPIO_PIN_PULLDOWN);
// Start execution.
NRF_LOG_INFO("Blinky CENTRAL example started.");

//scan_start();

// Enter main loop.
for (;;)
{

// idle_state_handle();

}
}

void in_pin_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
NRF_LOG_INFO("Input pin Interrupt");
}

static void gpio_init(void)
{
ret_code_t err_code;
nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_HITOLO(true);
in_config.pull = NRF_GPIO_PIN_PULLUP;
nrfx_gpiote_in_uninit(19);
err_code = nrfx_gpiote_in_init(19, &in_config, in_pin_handler);
NRF_LOG_INFO("Input errort %d",err_code);
APP_ERROR_CHECK(err_code);

nrf_drv_gpiote_in_event_enable(19, true);
}

Parents Reply Children
  • I will check it tommorow morning, but lets assume if there was .. i also tried using to uninitialize.. the error stopped coming.. but the interrupt does not trigger.

  • I tried PIN_CNF(19);  I get error undefined reference to `PIN_CNF'.

    Do i need to add another library?

    I am using a soft device? is this a issue?

    the include files are as folows:

    #include <stdint.h>
    #include <stdio.h>
    #include <string.h>
    #include "nrf_sdh.h"
    #include "nrf_sdh_ble.h"
    #include "nrf_sdh_soc.h"
    #include "nrf_pwr_mgmt.h"
    #include "app_timer.h"
    #include "boards.h"
    #include "ble.h"
    #include "ble_hci.h"
    #include "ble_advertising.h"
    #include "ble_conn_params.h"
    #include "ble_db_discovery.h"
    //#include "ble_lbs_c.h"
    #include "nrf_ble_gatt.h"
    #include "nrf_ble_scan.h"
    #include "app_uart.h"
    #include "nrf_log.h"
    #include "nrf_log_ctrl.h"
    #include "nrf_log_default_backends.h"
    #include "nrf_drv_gpiote.h"
    #include "nrf_uart.h"
    #include "nrf_gpiote.h"
    #include "nrf_gpio.h"
    #include "nrf_uarte.h"

    I practically removed everything except gpio_init and Nrf log.. but still crashes

  • You can access the register with NRF_P0->PIN_CNF[19], or you can set a breakpoint and read out the register value via the debugger. 

Related