The STM32 bootloader entry function as well as the flash size and page
size variables were only used by ThingSet items of the DFU group, which
were removed with the switch to the ThingSet SDK. The unused code is
removed together with mcu.h and the obsolete HW_LOG_LEVEL option.
The USB-C dead battery pull-downs of the STM32G4 are already disabled by
the Zephyr SoC initialization if USB device support is not enabled, so
the register access in setup() is not necessary anymore.
The DC/DC duty cycle step size depending on the SoC series is moved from
the code to the new Kconfig option DCDC_DUTY_STEP_SIZE with the same
defaults.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fuse destruction set a duty cycle of 0 and started the half bridge.
For the STM32 TIM drivers, this did not switch on the low-side MOSFET,
as starting is refused with a compare value of 0. Use the new function
half_bridge_force_low_side() instead.
In addition, the control loop running at 10 Hz could override the
forced state, because it saw an enabled half bridge and continued with
MPPT control. Now the control function returns early as soon as the HS
MOSFET short error is set.
The low-side switch is forced on again with each call in case the half
bridge was stopped in the meantime, e.g. by an ADC alert. The data is
only stored once to avoid unnecessary flash writes if the fuse does not
blow.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the register-level half_bridge.c module by the new half-bridge
drivers. The Dcdc class gets the half-bridge device injected via its
constructor, so that the emulated driver can be used in unit tests.
Board devicetrees are migrated to the new compatibles:
- TIM1 boards use libresolar,stm32-half-bridge with complementary
outputs on channel 1. The ADC trigger via OC6/TRGO2 is enabled for
the STM32G4 boards as before.
- MPPT 1210 HUS uses libresolar,stm32-half-bridge with TIM3 channel 3
(high side) and channel 4 (low side).
- Nucleo G474RE uses libresolar,stm32-hrtim-half-bridge. The HRTIM
node gets the timer clock source as second clock.
Instead of the half-bridge compatible, the halfbridge node label is now
used to detect if the board has a DC/DC converter.
The half-bridge unit tests are removed, as they are superseded by the
driver test suite in tests/drivers/half_bridge.
Note for out-of-tree boards: Nodes with "half-bridge" compatible must be
migrated to one of the new compatibles, and the deadtime property was
renamed to deadtime-ns.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Also use new Zephyr CI environment and compile all boards.
Board migration script example:
python ../zephyr/scripts/utils/board_v1_to_v2.py --board-root . \
-v libresolar -g libresolar -b pwm_2420_lus -s stm32l072xx
The format tries to maintain the previously used Libre Solar firmware coding
style as much as possible.
Applying the format fixed some issues and re-ordered some parts of the code.
https://docs.zephyrproject.org/latest/guides/west/workspaces.html
Previously, west manifest and CMake entry point were in zephyr subfolder
as required for PlatformIO. As PlatformIO support was dropped, we can
follow the default Zephyr folder structure more closely.
The application is built and flashed from app subfolder, where as unit
tests are run from tests subfolder.