drivers: half_bridge: add STM32 HRTIM driver

Port the HRTIM implementation from the application to a half-bridge
driver. As before, only timer A with outputs TA1/TA2 is supported and
the higher resolution of the HRTIM is not used yet.

In contrast to the previous implementation, the timer clock source must
be specified as the second clock of the HRTIM node (e.g. TIMPCLK2), the
DLL calibration is aborted with a timeout and the ADC trigger via timer
A compare 3 must be enabled explicitly with the adc-trigger property.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Martin Jäger
2026-10-20 20:51:27 +02:00
co-authored by Claude Opus 5.5
parent 8570d9d274
commit fd67d021a8
4 changed files with 312 additions and 0 deletions
@@ -0,0 +1,41 @@
# Copyright (c) The Libre Solar Project Contributors
# SPDX-License-Identifier: Apache-2.0
description: |
Half bridge using the STM32 high-resolution timer (HRTIM)
The node must be a child of the HRTIM node, which provides the register address, the clocks
and (optionally) the reset line. The first clock is used to enable the peripheral, the second
clock must specify the timer clock source (e.g. STM32_SRC_TIMPCLK2).
Only timer A with outputs TA1 (high-side) and TA2 (low-side) is supported at the moment.
Example:
&hrtim1 {
status = "okay";
halfbridge: half-bridge {
compatible = "libresolar,stm32-hrtim-half-bridge";
pinctrl-0 = <&hrtim1_cha1_pa8 &hrtim1_cha2_pa9>;
pinctrl-names = "default";
frequency = <70000>;
deadtime-ns = <300>;
};
};
compatible: "libresolar,stm32-hrtim-half-bridge"
include: [base.yaml, pinctrl-device.yaml, half-bridge-common.yaml]
properties:
pinctrl-0:
required: true
pinctrl-names:
required: true
adc-trigger:
type: boolean
description: |
Trigger ADC1 conversions in the middle of the on-time using timer A compare 3