When switching to edge-aligned PWM, the ADC measurement was accidentally
triggered at the beginning of the switching cycle.
Fixing this using TIM1 OC6, triggering at falling edge.
This increases the resolution of the PWM duty cycle of the DC/DC converter by a
factor of 2, which helps to set the ratio between input and output voltage for
the MPPT algorithm more precisely.
Some restructuring of the half_bridge functions was necessary.
Removes some of the hard-coded configuration in half_bridge.cpp and moves it
to board configuration.
The previous manual pinmux for the PWM output pins is now completely replaced
with Zephyr pinmux.
For boards with STM32G431, the ADC2 is used for fast current measurement,
synchronized with the half bridge switching PWM.
With this change, the ADC2 is triggered in the center of high-side
MOSFET ON signal using a second PWM output of TIM1.
Indentations of class definitions and preprocessor statements were not
uniform throughout the code. This commit cleans up indentations as well
as the order of include statements.
Style conventions see: https://github.com/LibreSolar/coding-style
- Some flags changed to make the firmware compile for new STM32G431 MCU
- Zephyr board definition added
- Serial, OLED display and LED working
- ADC compiling, but not yet working
- DMA partly uses ST HAL API (to be improved in further versions)
- When using mbed ticker to trigger ADC, the program might stall --> use own timer instead
- C++ libraries changed to more simple C-style functions and files (better compatibility with plain C environments)