Verify the timing of the half-bridge outputs at the pins without requiring a charge controller, where a wrong timer configuration could destroy the power stage. The outputs of the half bridge are wired to two input capture channels of a 32-bit timer (TIM2 or TIM5) on a Nucleo-G474RE board. As both channels share the same counter, the edges of the high-side and low-side signals can be put into chronological order to measure: - frequency and duty cycle (incl. duty cycle limits) - dead time at both switching transitions of each period - overlap of high-side and low-side on-time (shoot-through) - output states when stopped and with forced low-side switch The test covers the advtim (TIM1), gptim (TIM3) and HRTIM drivers with separate overlays. It requires the half_bridge_loopback fixture, so it is only built in CI and run with a twister hardware map on a board with the loop-back wiring. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
45 lines
1.2 KiB
Plaintext
45 lines
1.2 KiB
Plaintext
/*
|
|
* Copyright (c) The Libre Solar Project Contributors
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/ {
|
|
soc {
|
|
/* HRTIM node is not yet defined in Zephyr's STM32G4 devicetree */
|
|
hrtim1: timers@40016800 {
|
|
compatible = "st,stm32-timers";
|
|
reg = <0x40016800 0x400>;
|
|
clocks = <&rcc STM32_CLOCK(APB2, 26)>,
|
|
<&rcc STM32_SRC_TIMPCLK2 NO_SEL>;
|
|
resets = <&rctl STM32_RESET(APB2, 26)>;
|
|
interrupts = <67 0>, <68 0>, <69 0>, <70 0>,
|
|
<71 0>, <72 0>, <73 0>, <74 0>;
|
|
interrupt-names = "master", "tima", "timb", "timc",
|
|
"timd", "time", "flt", "timf";
|
|
st,prescaler = <0>;
|
|
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>;
|
|
};
|
|
};
|
|
};
|
|
|
|
loopback {
|
|
compatible = "test-half-bridge-loopback";
|
|
half-bridge = <&halfbridge>;
|
|
capture-timer = <&timers2>;
|
|
high-side-channel = <1>;
|
|
low-side-channel = <3>;
|
|
high-side-gpios = <&gpioa 0 GPIO_ACTIVE_HIGH>;
|
|
low-side-gpios = <&gpiob 10 GPIO_ACTIVE_HIGH>;
|
|
pinctrl-0 = <&tim2_ch1_pa0 &tim2_ch3_pb10>;
|
|
pinctrl-names = "default";
|
|
};
|
|
};
|