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

Board.dts file modification (nRF Connect SDK v1.6.0-rc2)

Hello.
I need to add an output gpio to the dts file, I modified the board.dts file, inserting these lines in the leds section
res: res_ {
gpios = <& gpio0 17 GPIO_ACTIVE_LOW>;
label = "reset epaper";
};
but when I try to compile the application I get the report that the file has been modified externally and after reloading the project, I have an error.
Is there an editor to correctly edit the dts file?
what is the correct procedure to add a gpio in output or in input?
Thank you
Parents Reply
  • Hello,

    I created the file nrf52dk_nrf52832.overlay inside I put the following code:

    / {

    ereset: reset_ {

     gpios = <& gpio0 17 GPIO_ACTIVE_LOW>;

      label = "reset epaper";

    };

    };

    the file is in the same directory as the Kconfig and CMakeList.txt files

    Now how do I access the pin defined ereset, without using the alias as I did before.

    with the following code:

    #define ERESET_NODE DT_ALIAS (ereset)

    #if DT_NODE_HAS_STATUS (ERESET_NODE, okay)

    #define ERESET DT_GPIO_LABEL (ERESET_NODE, gpios)

    #define ERESET_PIN DT_GPIO_PIN (ERESET_NODE, gpios)

    #define ERESET_FLAGS DT_GPIO_FLAGS (ERESET_NODE, gpios)

    #else / * A build error here means your board isn't set up to blink an LED. * /

    #error "Unsupported board: ereset devicetree alias is not defined"

    #endif

    const struct device *deReset;

    void Init_gpio () {

    deReset = device_get_binding (ERESET);

    ret = gpio_pin_configure (deReset, ERESET_PIN, GPIO_OUTPUT_ACTIVE | ERESET_FLAGS);

    }

    Thanks in avance

    Fausto

Children
Related