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

GPIO Digital Output Not Working

Why isn't this working?

static void gpio_init(void)
{
    ret_code_t err_code;

    //NB as #include "bsp_btn_ble.h" is already initiated within main.c we do not need to initiate GPIO here
    if (!nrfx_gpiote_is_init) {
        err_code = nrfx_gpiote_init();
        APP_ERROR_CHECK(err_code);
    }

    nrfx_gpiote_out_config_t out_config = GPIOTE_CONFIG_OUT_SIMPLE(true); //GPIOTE_CONFIG_OUT_TASK_TOGGLE(false);
    out_config.init_state   = NRF_GPIOTE_INITIAL_VALUE_HIGH;
    out_config.task_pin     = true;
    err_code = nrfx_gpiote_out_init(MPU_RESET_PIN, &out_config);
    APP_ERROR_CHECK(err_code);
    nrfx_gpiote_out_task_enable(MPU_RESET_PIN);

}

The MPU_RESET_PIN is set to : NRF_GPIO_PIN_MAP(0, 20)

I can not seem to be able to alter the state of the PIN. Whenever I read the PIN its always HIGH.

I have successfully managed to work with in inout on NRF_GPIO_PIN_MAP(0, 19) and I know pin 20 is available and not mapped elsewhere.

Parents Reply
  • Do you have a project file? Actually, the best would be if you zipped the project folder, such as e.g. SDK\examples\peripheral\pin_change_int

    if you zip pin_change_int, that would contain your main.c file, sdk_config.h (which you have there) and the project file. I don't know what you use to compile, but I am missing that file here.

    Have you tried to actually measure your pin? I see that you use nrf_gpio_pin_read(), which is an input register. Perhaps you can try nrf_gpio_pin_out_read()?

    Do you use your MPU_RESET_PIN for something else?

Children
Related