I can't get/set gpio value.

Hi Nordic.

I am developing with nRF52832DK and SDK 17.1.0

And it's connected with my Qualcomm board.

I want check GPIO input interrupt and output settings.

But I can't read the signal from the outside into the input properly.

Also, even if the setting to output to high, it is not measured by the multimeter.

This is my codes.

#define ADC_INT_PIN 3
#define BLE_INT_OUT_PIN 10

static void gpios_init(void)
{
    ret_code_t err_code = 0;

    err_code = nrf_drv_gpiote_init();
    APP_ERROR_CHECK(err_code);
    
    nrf_gpio_cfg_output(BLE_INT_OUT_PIN);
    nrf_gpio_pin_set(BLE_INT_OUT_PIN);

    nrf_gpio_cfg_input(ADC_INT_PIN, NRF_GPIO_PIN_PULLUP);
    m_backup_battery_mode = nrf_gpio_pin_input_get(ADC_INT_PIN);

    NRF_LOG_INFO("adc interrupt pin is %d", m_backup_battery_mode);

    nrf_drv_gpiote_in_config_t in_config = {
        .sense = NRF_GPIOTE_POLARITY_TOGGLE,
        .pull = NRF_GPIO_PIN_PULLUP,
        .is_watcher = false,
        .hi_accuracy = true,
        .skip_gpio_setup = false
    };

    err_code = nrf_drv_gpiote_in_init(ADC_INT_PIN, &in_config, adc_interrupt_handler);
    APP_ERROR_CHECK(err_code);
}

I'm setting output high BLE_INT_OUT_PIN gpio by using nrf_gpio_cfg_output and nrf_gpio_pin_set.

But multimeter is not detect voltage.

And I'm setting input and get value ADC_INT_PIN gpio by using nrf_gpio_cfg_input and nrf_gpio_pin_input_get.

But this value always low (0).

Please advise me.  

Thanks.

Parents Reply
  • Hi,

    You're mixing the usage between the GPIOTE and the GPIO driver which is not the same peripheral. Can you test this simple fw on your code and see if you're able to see LED1 blinking? If you are, can you change PIN 17 to 10 with CONFIG_NFCT_PINS_AS_GPIOS added to the preprocessor settings and see if you're also able to see PIN 10 toggling?

    regards

    Jared

    #include <stdbool.h>
    #include <stdint.h>
    #include "nrf_delay.h"
    #include "boards.h"
    #include "nrf_gpio.h"
    
    
    
    #define PIN 17
    
    
    int main(void)
    {
    
    nrf_gpio_cfg_output(PIN);
    
    
    while(1)
    {
    
        nrf_gpio_pin_toggle(PIN);
        nrf_delay_ms(500);
    }
    
    }

Children
No Data
Related