GPIO configuration for nrf52840 and nrf52832

Hello team,

Description of product:

We have 2 products. One using nrf52840 and another is using nrf52832. In both the products, we are using GPIO output lines for a specific purpose.

We configure GPIO line in device tree with the below code:

```

outputs {

    compatible = "gpio-leds";
    dalitx: dali_tx {
        gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>;
        label = "Dali transmit";
    };
};
```

We configure the GPIO in our init function as below:

```

static nrfx_gpiote_task_config_t dali_tx_task_config = {
.polarity = NRF_GPIOTE_POLARITY_TOGGLE,
.init_val = NRF_GPIOTE_INITIAL_VALUE_HIGH,
};
static nrfx_gpiote_output_config_t dali_tx_output_config = {
    .drive = NRF_GPIO_PIN_S0S1,
    .input_connect = NRF_GPIO_PIN_INPUT_DISCONNECT,
    .pull = NRF_GPIO_PIN_NOPULL,
};

err = nrfx_gpiote_channel_alloc(&dali_tx_gpiote_channel);
if (err != NRFX_SUCCESS) {
    LOG_ERR("Failed to allocate dali tx gpiote channel: %08x", err);
    return err;
}
dali_tx_task_config.task_ch = dali_tx_gpiote_channel;
err = nrfx_gpiote_output_configure(DALI_TX_PIN, &dali_tx_output_config, &dali_tx_task_config);
if (err != NRFX_SUCCESS) {
    LOG_ERR("nrfx_gpiote_output_configure error: %08x", err);
    return err;
}
nrfx_gpiote_out_task_enable(DALI_TX_PIN);

``` 

As you can see from the code that, the pin initial state is HIGH. It is also hardware pulled high and we can see that on the scope as well.

 

Problem Statement:

We observed that the nrf_gpio_reconfigure function, which is called in nrfx_gpiote_output_configure, generates a pulse of around 20microseconds to 50microseconds as shown in the image below.

nrf_gpio_reconfigure function just configures PIN_CNF register for the pin. Why does writing to the register makes the pin to low and change it back to HIGH (which is init val of the pin)?

We observe the same behavior with the product using nrf52840 and also nrf52832.

Parents Reply Children
No Data
Related