2024-06-14 05:34 AM
Hello,
I have created my own board in zephyr (using STM32U575).
Now I would like to configure the power mode pins (CSLEEP, CDSTOP, SRDSTOP ) in the devicetree of the board.
I have therefore implemented the configuration for the pins in the .dts file:
&pinctrl {
csleep: csleep {
pinmux = <STM32_PINMUX('A', 5, AF0)>;
};
cdstop: cdstop {
pinmux = <STM32_PINMUX('A', 6, AF0)>;
};
srdstop: srdstop {
pinmux = <STM32_PINMUX('A', 7, AF0)>;
};
};
However, the pins are not set correctly with this setting alone.
Normally, the pins should now be assigned to a periphery.
If I now assign these pins to any periphery, it works:
&lpuart1 {
pinctrl-0 = <&lpuart1_tx_pa2 &lpuart1_rx_pa3 &csleep &cdstop &srdstop>;
pinctrl-names = "default";
current-speed = <115200>;
status = "okay";
};
But these pins have nothing to do with any peripheral.
How else could I solve this if I don't want to make any settings in the application code?
Thank you for the answers.
Solved! Go to Solution.
2024-06-25 03:10 AM - edited 2024-06-25 03:11 AM
Hello @JoachimO,
The problem here is that the device tree is primarily used to describe hardware configurations, and it's not typically used to control the power modes directly
you might need to create and implement a custom power management driver in the device tree, something like this:
custom_power: custom_power {
compatible = "xx,custom-power";
csleep-gpios = <&gpioa 5 GPIO_ACTIVE_HIGH>;
cdstop-gpios = <&gpioa 6 GPIO_ACTIVE_HIGH>;
srdstop-gpios = <&gpioa 7 GPIO_ACTIVE_HIGH>;
status = "okay";
};
and of course, add the necessary Kconfig options to enable your custom power management driver:
CONFIG_CUSTOM_POWER_MANAGEMENT=y
Hope that helps!
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-06-14 11:49 AM - edited 2024-06-14 11:50 AM
The declaration of pinctrl by itself does not do anything. Notice the status = "okay" in the uart node, this is what causes activation of this node and pinctrl as its dependency. It looks like you need some fake device node with status = okay.
2024-06-17 12:51 AM
How can I do this?
Are any changes necessary in the soc driver?
2024-06-25 03:10 AM - edited 2024-06-25 03:11 AM
Hello @JoachimO,
The problem here is that the device tree is primarily used to describe hardware configurations, and it's not typically used to control the power modes directly
you might need to create and implement a custom power management driver in the device tree, something like this:
custom_power: custom_power {
compatible = "xx,custom-power";
csleep-gpios = <&gpioa 5 GPIO_ACTIVE_HIGH>;
cdstop-gpios = <&gpioa 6 GPIO_ACTIVE_HIGH>;
srdstop-gpios = <&gpioa 7 GPIO_ACTIVE_HIGH>;
status = "okay";
};
and of course, add the necessary Kconfig options to enable your custom power management driver:
CONFIG_CUSTOM_POWER_MANAGEMENT=y
Hope that helps!
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.