Martin Jäger
2875ea1519
Rename DC/DC control function responsible for MPPT
2020-06-05 16:18:20 +02:00
Martin Jäger
3eb70e9a01
Add test/zephyr.h to mock Zephyr functions/defines
2020-06-04 16:28:19 +02:00
Martin Jäger
dfde83d8be
Add CCR and ARR based functions to half_bridge
2020-06-04 11:51:42 +02:00
Martin Jäger
b288ffdf35
Cleanup of half_bridge driver
...
Variables are now named same as registers to avoid confusion between duty
cycle as a value between 0 and 1 or as the capture/compare register value.
2020-06-04 11:51:42 +02:00
Martin Jäger
a6c0eecf20
Small datatype updates to reduce RAM footprint
2020-06-04 11:51:42 +02:00
azeemshatp
cfed3ed6e9
Configure custom data nodes
2020-05-26 15:02:26 +02:00
Martin Jäger
81aefff168
Fix load overvoltage control for 24V systems ( #96 )
2020-05-21 10:09:54 +02:00
Martin Jäger
882f281333
Fix undervoltage error flag reporting
...
Load shedding should only trigger capacity calculation, but not set the
undervoltage flag. That flag is only set for voltage below absolute min.
2020-05-11 14:09:27 +02:00
Martin Jäger
1bd8734a2e
Use K_MSEC macro in k_sleep calls
...
This is required by Zephyr 2.3, otherwise getting compile error.
2020-05-11 12:26:41 +02:00
Martin Jäger
9a5004e81d
Fix DC/DC start check for 24V batteries ( #95 )
2020-05-11 11:01:47 +02:00
Martin Jäger
e1c7f97f63
Add support for devices without load output
2020-05-11 10:32:24 +02:00
Martin Jäger
d292ad425a
Add PWM switch off inhibit
2020-05-06 12:53:26 +02:00
Martin Jäger
3d4da66955
Generate DeviceID from hwinfo
2020-05-06 12:53:26 +02:00
Martin Jäger
efc0bc8fdc
Update to ThingSet library v0.3
2020-05-06 12:53:26 +02:00
Martin Jäger
7da96abbe4
Fix Solar_V enable and use float for gain calc
2020-05-06 12:53:26 +02:00
Martin Jäger
5e94d72117
Use LL for PWM switch driver to support STM32G4
...
This adds support for PWM solar input of MPPT 2420 HPX. Also adds new
PwmSwitch::test() function.
2020-05-06 12:53:26 +02:00
Martin Jäger
4011370646
MPPT-2420-HPX: Use TIM8 for charge pump
...
This commit implements the PWM driver manually using STM LL, as the Zephyr
driver doesn't work for "advanced" timers like TIM8.
2020-05-06 12:53:26 +02:00
Martin Jäger
e76709f2af
Enable load short circuit comparator
...
The load driver had to be moved to a .c file to allow attaching interrupt
in Zephyr.
2020-05-06 12:53:26 +02:00
Martin Jäger
9f258b6e69
Replace short STM32XXX defines with CONFIG_SOC_...
2020-05-06 12:53:26 +02:00
Martin Jäger
c856b28082
Cleanup of comments in bat_charger.h
2020-05-06 12:53:26 +02:00
Martin Jäger
6f490df537
Small fix of data object units
2020-05-06 12:53:26 +02:00
Martin Jäger
9787397708
Rename STM32L073 references to actually used STM32L072
2020-05-06 12:53:26 +02:00
Martin Jäger
8380b928df
Fix Solar_V data object for PWM CCs
2020-05-06 12:53:26 +02:00
Martin Jäger
a412117b5b
New adc-gain devicetree binding
2020-05-06 12:53:26 +02:00
Martin Jäger
4a70293375
Update peripheral pins in board.dts and pinmux.c
2020-05-06 12:53:26 +02:00
Martin Jäger
8dd576e40e
Configure PWM switch driver via DTS
...
Driver now moved to separate .c file to allow ISR handling in Zephyr.
2020-05-06 12:53:26 +02:00
Martin Jäger
ce7f63b888
Introduce generic "outputs" DTS binding
...
Replaces previous "switch" and "pwm-out" bindings and allows to reference
either gpio or pwm handle and specify maximum current.
Also replacing CONFIG_HAS_LOAD and CONFIG_HAS_USB_PWR with DT_ variants.
2020-05-06 12:53:26 +02:00
Martin Jäger
90c1e7fcf5
Replace Zephyr ADC driver with direct LL access
...
Fixes IRQ conflict with COMP peripheral (#93 )
2020-05-06 12:53:26 +02:00
Martin Jäger
2d3594d254
Add watchdog for each thread using Zephyr API
2020-05-06 12:53:26 +02:00
Martin Jäger
1252a1ffa1
Make default battery type configurable via Kconfig
2020-05-06 12:53:26 +02:00
Martin Jäger
d2dd50fe99
Add ThingSet passwords to Kconfig
2020-05-06 12:53:26 +02:00
Martin Jäger
affaa9d8e8
Move PCB type and version to DTS
2020-05-06 12:53:26 +02:00
Martin Jäger
4e6f6c7365
Move thermal model parameters to DTS
2020-05-06 12:53:26 +02:00
Martin Jäger
ab504e3dfa
DC/DC and PWM switch configuration via DTS
...
As these settings are clearly hardware-specific, configuration was
moved from Kconfig (hidden symbols) to DTS. New bindings added.
2020-05-06 12:53:26 +02:00
Martin Jäger
64b771cd42
daq: Separate current offset for DC/DC and PWM
2020-05-06 12:53:26 +02:00
Martin Jäger
c25640b987
Fix blocking if CAN not connected to bus
2020-05-06 12:53:26 +02:00
Martin Jäger
9efa2f8f77
Use Zephyr EEPROM driver
2020-05-06 12:53:18 +02:00
Martin Jäger
2a71d02aeb
Move PCB and user config to board Kconfig
...
Files in src/pcbs/xyz.h are moved to boards/xyz/board.h. User settings from
src/config.h are also configured via Kconfig, so the file is removed.
2020-04-30 10:53:58 +02:00
Martin Jäger
2d74a3a554
Mbed support removed
...
Rationale: The support for both Zephyr and Mbed made the code confusing,
especially because of many ifdefs.
Zephyr RTOS is the future!
2020-04-04 08:21:43 +02:00
Martin Jäger
2c2e59c072
Synchronize ADC2 with PWM signal
...
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.
2020-04-02 12:32:43 +02:00
Martin Jäger
91d4ec4424
Fix COMP and ADC interrupt conflict for STM32L0
...
The STM32L0 uses the same interrupt for ADC and COMP, which creates
interference with the Zephyr ADC driver. Proper fix needed!
2020-03-11 15:11:55 +01:00
Martin Jäger
84f7a4afdd
STM32G431: Add VREF+ pin and fix ADC calibration
...
- Output 2.048V to VREF+ pin is now used as reference for ADC and DAC.
- ADC calbration got stuck before. Explicitly disabling ADC fixed the issue.
2020-03-03 11:15:58 +01:00
Martin Jäger
daf43fb967
USB charging output control via LoadOutput class
...
- Introduce new CONFIG_HAS_USB_PWR_OUTPUT
- Improve charger.discharge_control function
- Add battery empty flag
2020-03-02 11:55:38 +01:00
Martin Jäger
1a9c290485
Charger.num_batteries moved to DcBus.series_multiplier
...
The reason is that the voltage disconnect thresholds used in the load outputs
need to be multiplied with number of batteries aswell. As the DcBus class
should contain all voltage-relevant information, it is the right place for the
multiplier.
2020-03-01 09:48:35 +01:00
Martin Jäger
651f66616b
Add load info variable (combines state and error_flags)
2020-02-29 13:39:34 +01:00
Martin Jäger
7722f12a0c
Add DAC current sensor ref for STM32G4 MCU
2020-02-26 19:36:27 +01:00
Martin Jäger
46630f88cb
Enable half bridge for STM32G4 MCU
2020-02-26 19:30:59 +01:00
Martin Jäger
2154a1cb72
Add charge-pump driver for HS load switch
2020-02-21 18:27:42 +01:00
Martin Jäger
fa9d15e796
Separate load and USB out, improve state handling
...
Identified issues:
- The load output and USB charging port shared the same state machine,
which did not allow to set different switch-off thresholds.
- Load error codes were global, so it was not possible to have multiple
load instances.
This commit introduces load-specific error_flags, makes the LoadOutput
class inherit from PowerPort (to improve code readability), separates
the load driver better from higher level implementation and adds a
second LoadOutput object for the USB charging port.
2020-02-21 18:27:36 +01:00
Martin Jäger
3c0bc41164
Add ADC2 channel configuration for STM32G4 board
...
Some changes regarding DMA setup and data alignment were necessary to
store all values from ADC1 and ADC2 in the same adc_readings array.
2020-02-20 11:07:02 +01:00