516 Commits
Author SHA1 Message Date
Martin Jäger 705abbed6b Remove broken ESP32 modem driver
This driver was only compatible with mbed and didn't work reliably. Zephyr
has an in-built ESP modem driver already.
2020-07-23 12:41:32 +02:00
Martin Jäger 2a3e50f6ca Add battery temp. sensor to MPPT 2420 RC 2020-07-23 12:41:32 +02:00
Martin Jäger a7f4ccaa91 Add CAN support for MPPT 2420 RC board
The CAN-FD driver is not yet in Zephyr master, so it is required to get
Zephyr PR 22832 to actually use CAN with this MCU.
2020-07-23 12:41:24 +02:00
Martin Jäger d283436747 Move ADC peripheral setup to devicetree
Remove the ADC channel configuration from the board.h files and use new
DT macros to configure the ADC peripheral based on board.dts only.
2020-07-20 09:07:31 +02:00
Martin Jäger 1b6c56d25b Replace adc-gain DT binding with adc-inputs
Preparation for cleanup of ADC driver.
2020-06-26 15:17:53 +02:00
Martin Jäger 3c9a6e49f1 Fix not enabled UART_1 for some boards 2020-06-26 14:36:36 +02:00
Rhushabh 1dc5cdd7ef Software watchdog for multiple threads 2020-06-23 15:59:31 +02:00
Martin Jäger 54bc5eaee8 Add MPPT 2420 RC board 2020-06-17 11:15:50 +02:00
Martin Jäger 3185ff32a1 Add support for Zephyr 2.3.0 (using west)
Enable CONFIG_LEGACY_DEVICETREE_MACROS and fix removed Kconfig values
like UART_1 to support v2.2 and v2.3.
2020-06-17 11:15:38 +02:00
Jordan Silverman a768f059a1 Stop energy counter when disabled 2020-06-16 21:23:07 +02:00
Martin Jäger 9f02287a03 Add custom unit-test option 2020-06-08 14:27:07 +02:00
Martin Jäger fb3251b88a Add HS MOSFET fail-safe protection Kconfig
The function already existed since a while, but was accidentally not activated.
This is fixed by this commit.
2020-06-05 17:24:16 +02:00
Martin Jäger fc0276e72c Allow custom DC/DC control functions
A Kconfig CUSTOM_DCDC_CONTROLLER is introduced to enable implementation of
more sophisticated control functions than the standard perturb and observe.

A function dcdc_low_level_controller() must be implemented and is called
from the DMA interrupt after each new current sensor reading.

The default Dcdc::control() function is defined __weak.
2020-06-05 16:22:41 +02:00
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
Martin Jäger 7769e4063c Allow more generic firmware customization
This commit adds a new Kconfig setting CONFIG_CUSTOMIZATION. If enabled, the
subdirectory src/custom is added to the build. It can contain an own
CMakeLists.txt file to add several different C/C++ files.

Readme has been updated to explain also DTS overlays and custom prj.conf files.
2020-06-04 11:50:09 +02:00
Martin Jäger 0e5e2f89b1 Remove outdated Kconfig options 2020-06-04 11:50:09 +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 faf19ee9e0 Fix wrong voltage divider in MPPT 2420 HPX 2020-05-11 10:32:49 +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 f2c063b291 Lock PlatformIO to Zephyr v2.2.0 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 5523f93544 Handle PCB versioning with DTS overlays
This commit completely removes versions like _0v4 in board names
and adds DTS overlays to zephyr/ directory. These can be used to
compile for older board versions.

Some additional configuration changes are handled in board.h file
using board version number from DT_CHARGE_CONTROLLER_PCB_VERSION_NUM.
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