Hi,
Greetings
I am stuck in an issue where I want to use the Arduino Header of the STM32 E407 using the Zephyr RTOS.
#define PORT "GPIOA"
#define PIN_A 11
dev = device_get_binding(PORT);
gpio_pin_configure(dev, PIN_A, GPIO_OUTPUT);
gpio_pin_set(dev, PIN_A, 1);
But it is not giving any output. I also tried with reading the input, but still it also does not work. Can you please guide me and correct me what am doing wrong.
Thanks
Can someone please help me with this?
Not sure if anyone around here is familiar with Zephyr RTOS... Maybe also post in the Zephyr forums, if you haven't already.
You'll need to create a devicetree overlay (https://docs.zephyrproject.org/latest/build/dts/howtos.html#set-devicetree-overlays) with the GPIO pins you want to use for your board, and reference that devicetree node when configuring the GPIO pin.
The button (https://docs.zephyrproject.org/latest/samples/basic/button/README.html) sample (https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/basic/button) is a good example of both input and output GPIO usage.
Since the STM32 GPIO banks are labeled with letters instead of numbers, your devicetree overlay GPIO node configuration would have to look something like the following example for driving an LED:
/ {
leds {
compatible = "gpio-leds";
green_led_1: led_0 {
gpios = <&gpioa 11 GPIO_ACTIVE_HIGH>;
label = "User LED1";
};
};
};