Syntax in dts file for defining a GPIO output based on nxp,kinetis-gpio.yaml #defines


Bo.Kragelund@...
 

Hello developers!

I have difficulties finding any documentation/examples of how to define a simple GPIO as an e.g. output in the frdm_k64f.dts file for the frdm_k64f board.

As long as we talk about defining the outputs for LEDS on the board, this is done very nice based on the gpio-keys.yaml specific for this purpose.
As seen below, which is copied from the frdm_k64f.dts file, you simply define the port, pin number, and flags in one line like this: gpios = <&gpiob 22 0>, which means port b, pin 22, and no flags.
leds {
compatible = "gpio-leds";
red_led: led_0 {
gpios = <&gpiob 22 0>;
label = "User LD1";
};
};
 
But in general, I believe the idea is to define GPIO in the dts file based on the nxp,kinetis-gpio.yaml file created for this purpose, instead of the gpio-keys.yaml file.
But this file has a completely different way/syntax for defining a GPIO compared to the gpio-keys.yaml file.
It doesn't have the gpios property, but reg and interrupt instead. It also includes the below lines, which I guess I should use in some way:

"#cells":
  - pin
  - flags
 
Since I am rather new in dts and yaml syntax, I hope someone can help me with the syntax for setting port b, pin 22, and no flags, based on the nxp,kinetis-gpio.yaml file...

As written before, I haven't been able to find any examples so far in either the zephyr repository or zephyr documentation.

Thank you for your help.

Best regards,
Bo Kragelund

I hope someone can help me,

Join devel@lists.zephyrproject.org to automatically receive all group messages.