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

Zephyr GPIO initialization before HW drivers

Hi 

I am working on a nRF52840 using Zephyr as OS.

I have setup some control GPIO pins in the device tree (se below). This works fine from the application. I can access the definitions and set GPIOs in the states I want.

My issue is that I need the control pins to be in a specific state before Zephyr initializes the HW drivers. 

Can you control the sequence of driver initialization in zephyr? 

Is there a way to initialize GPIO states in the device tree?

Or put some GPIO initialization in before HW drivers are initialized?

I have been searching but not found the correct rabbit hole yet, so any help/pointers are appreciated.

Morten Sabinsky

Device tree setup

++ Snip

gpio_list: node {
compatible = "gpio_defs";
gpios = <&gpio0 6 GPIO_ACTIVE_HIGH >, // 0: Control pin 0
<&gpio0 7 GPIO_ACTIVE_HIGH >, // 1: Control pin 1
<&gpio0 8 GPIO_ACTIVE_LOW >, // 2: Control pin 2
};

++ Snip

/* GPIO support */
&gpiote {
status = "okay";
};

&gpio0 {
status = "okay";
};

Parents Reply Children
Related