Hi!
Depending on what you are wanting to achieve, you might want to add an overlay file in your application with this extra information, instead of modifying the device-tree of the board directly.
You should be getting some errors in the log in SES as well as the error window. Could you show me what kind of errors you're getting?
HI,
where can i find an overlay example to change the function of a gpio?
Thank you
Hi, this overlay file added the node you wanted into the device tree.
/ {
res: res_ {
gpios = <&gpio0 17 GPIO_ACTIVE_LOW>;
label = "reset epaper";
};
};Hi,
where I put the overlay file? and how configure SES for use these file?
My file is SmartBug.overlay.
Thanks in avance
Put the overlay file in the same place as the Kconfig and CMakeLists.txt file and name it the same name as the board name you are building for and it will be included in the build (<board_name>.overlay).
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
Hi, was there a question in there?
Is the code not working? If so, what error are you getting?
Hi, was there a question in there?
Is the code not working? If so, what error are you getting?
Hi
when compile i get the error
#error "Unsupported board: ereset devicetree alias is not defined"
Best regards
Fausto
Hi, after looking more closely into this, every node in tree that represents a device is required to have the "compatible" property.
Here is an example defining the node with the "gpio-leds" binding.
/ {
eres_node {
compatible = "gpio-leds";
ereset: reset_ {
gpios = <&gpio0 17 GPIO_ACTIVE_LOW>;
label = "reset epaper";
status = "okay";
};
};
aliases {
ereset = &ereset;
};
};
You can obviously change this property, just make sure that you include all the required properties when you do. See the Bindings index for a full list of available devicetree bindings in Zephyr.
Best regards,
Heidi
HI Heidi,
OK ,i have made the overlay file for all gpio input and output that i use and is OK.
Thanks for your support.
Best Regards
Fausto