Help with Configuring Custom GPIO Pins #35932
Replies: 11 comments 10 replies
-
@erwango can you take a look at this question. |
Beta Was this translation helpful? Give feedback.
-
@manuaatitya To help further, can you provide the build errors ? |
Beta Was this translation helpful? Give feedback.
-
hi @erwango, thank you for the reply, This is the error output I get, Configuring firmware for zephyr platform nucleo_h743zi nucleo_h743zi.dts.pre.tmp:2746.17-2756.7: ERROR (phandle_references): /zephyr,user: Reference to non-existent node or label "gpio0" nucleo_h743zi.dts.pre.tmp:2746.17-2756.7: ERROR (phandle_references): /zephyr,user: Reference to non-existent node or label "gpio1" nucleo_h743zi.dts.pre.tmp:2746.17-2756.7: ERROR (phandle_references): /zephyr,user: Reference to non-existent node or label "gpio0" ERROR: Input tree has errors, aborting (use -f to force output) -- Configuring incomplete, errors occurred! |
Beta Was this translation helpful? Give feedback.
-
For some reason, I'm not able to open nucleo_h743zi.dts file, but I'd assume it differs from upstream (https://github.com/zephyrproject-rtos/zephyr/blob/main/boards/arm/nucleo_h743zi/nucleo_h743zi.dts). Though, reading the reported errors:
Please note that there is no |
Beta Was this translation helpful? Give feedback.
-
Hi @erwango, I need to access say pin 4, port a i.e. gpioa of the board (just as an example), and it has no special nodes like green led or buttons ... So if I have to use gpio_pin_configure() to set the pin 4, gpioa as output, how do I get the device struct since I don't have any device binding so I won't be to configure the pin without the device, i.e I wont be able to get the device like this
So, basically my doubt is what should I do in place of
Thanks in advance If my method is wrong, please guide me as to how i can achieve the above. |
Beta Was this translation helpful? Give feedback.
-
In that case, you need to add your own node for this pin, cf what is proposed below. Please note that you should use real references, such as (sticking to your example):
Then for configuring as OUTPUT, you can do:
|
Beta Was this translation helpful? Give feedback.
-
@manuaatitya
It's possible, but you need to use a different name (than |
Beta Was this translation helpful? Give feedback.
-
Have a try to move these lines inside the main functions:
|
Beta Was this translation helpful? Give feedback.
-
ok, you miss a: This was not documented, I'll take care to get it added. |
Beta Was this translation helpful? Give feedback.
-
This is some snippet from my dts, under the root node:
As you can see, I created a node called "mypins", under which I used the binding "gpio-keys". In your dts. you'll need to change Then in the app code I call the alias
And finally
|
Beta Was this translation helpful? Give feedback.
-
Hi, I tried the gpio-nexus for adding J721E gpio in the device tree. The device tree gets compiled. But the build fails while building blinky example. For neorv32 blinky example, The devicetree_generated.h has these definitions: But for J721e (Which I am adding support) does not have these definitions in the devicetree_generated.h. I have attached board dts (bbai_64.dts) and soc dts (tda4vm.dtsi). (edited) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm trying to write an app to control different motor attached to the STM_Nucleo H743zi board for which I've to set some GPIO Pins as output so that that I run them (by setting the GPIO pins as high) as per requirement.
I would like to configure multiple pins from the board for the motor input and output purpose but I'm having trouble configuring a single custom pin from the board which doesn't have any predefined aliases like the pwm_led0 in the zephyr samples.
I would like some help to find out the port number and pin number of the pins so that I can use gpio_pin_configure() to set the corresponding pin (for e.g. PB_8 as an output pin)
For e.g. I would like to configure the PB_8 pin as per the pinout diagram attached in the figure below as an output pin.

The dts file provided by the vendor for the board is attached in this folder and the generated header file from the device tree build is attached here.
This is the code snippet I've used so far and I've created an overlay file for the same. There are some build errors I get if I use the files attached here.
I'm new to zephyr so my approach may be wrong. Since there are not may tutorials available, I've written this code based on the examples from the samples folder.
Any help to resolve my question is appreciated.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions