516 Commits
Author SHA1 Message Date
Martin Jäger db9c9c5b1c Rename DC/DC operation mode and control names
New control states allow to specify the reason for derating more detailed,
also considering the input side.

The operation mode is now also used as a return value for
check_start_conditions function to get rid of magic numbers.
2020-10-14 10:03:34 +02:00
Martin Jäger c38f1c8348 Cleanup of DC/DC control function
The check for high-side MOSFET shorts and startup inhibit are moved to
separate functions to keep the general control function more clean.

Also declared check_start_conditions weak to allow custom overriding.
2020-10-14 09:53:39 +02:00
Martin Jäger a65bcfe3c2 DAQ: Fix VREF calculation for 16-bit left-aligned readings
Calculation was still for previous 12-bit right-aligned ADC readings
and resulted in wrong calculation of MCU internal temperature.
2020-10-14 09:52:20 +02:00
Martin Jäger 06499a2409 PWM solar input: Fix voltage calculation offset in dts
This offset had to be left-shifted by 4 since the DAQ calculations switched
to 16-bit resolution.
2020-10-14 09:51:52 +02:00
Jordan Silverman bb39ff6236 Update data nodes 2020-10-14 09:48:20 +02:00
Jordan Silverman 9d09f1431b Add grid energy counters 2020-10-14 09:45:45 +02:00
Martin Jäger ef9c8571cc ADC filter time constant configurable per channel
Add a filter-const prop to the adc_inputs devicetree binding and use it instead
of the global ADC_FILTER_CONST in daq.cpp.
2020-09-21 13:29:31 +02:00
Martin Jäger 4008a09f3b ADC: Use 16-bit raw values for calculations
Using 16-bit for calculation allows to increase resolution by oversampling.
The ADC was already configured to use left-aligned 12-bit readings, which can
be treated the same as 16-bit native readings.
2020-09-21 13:29:31 +02:00
Martin Jäger 3bb4a86b5c DAQ: Calculate current offset using raw reading
Makes the calculation more efficient compared to floating point math
2020-09-21 13:29:31 +02:00
Martin Jäger 16c629ed86 DC/DC: Use edge-aligned PWM mode with TIM1
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.
2020-09-21 12:45:22 +02:00
Martin Jäger 1356de230f Configure half_bridge PWM via board.dts and pinmux.c
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.
2020-09-21 12:45:22 +02:00
Martin Jäger 716fb367a8 Update development model in Readme 2020-09-16 15:47:30 +02:00
Martin Jäger 073c04967a Restructure ADC filtering and improve explanations 2020-08-31 13:53:35 +02:00
Martin Jäger f55b236a56 Update MCU-specific defines and includes
Distinguish properly between MCU series and actual MCUs. Constants in mcu.h
had to be changed to #defines to be useable from C code (not only C++).
2020-08-25 17:46:48 +02:00
Martin Jäger d274ca6980 Update PlatformIO ststm32 to 8.0.0
Fixes Zephyr compile issues https://github.com/platformio/zephyr/issues/5
2020-08-25 17:46:48 +02:00
Martin Jäger 314075545a Fix whitespace-check in Travis for PRs not to master 2020-08-19 15:55:15 +02:00
Martin Jäger 6be4e20f04 Make load OC and LVD recovery delay configurable 2020-08-19 15:55:15 +02:00
Martin Jäger ab63204adb Make battery configurable via Kconfig (fix #94)
Also adds crazy IS_ENABLED macro to unit tests.
2020-08-19 15:55:15 +02:00
Martin Jäger 5b024dcd60 Increase stack space for ts.process in serial.cpp
Depending on the amount of data nodes, calling ?rec caused a stack overflow.
Larger stack memory solves the issue, for further improvement see also #103.
2020-08-18 19:29:43 +02:00
Martin Jäger b110918797 Select serial port for ThingSet via Kconfig 2020-08-18 19:29:23 +02:00
Martin Jäger 5e5f2c6680 mppt_1210_rc: Use USART1 as debug serial 2020-08-18 12:14:59 +02:00
Martin Jäger c78c5431a4 Enable load short circuit comp for PWM 2420 LUS 2020-08-18 12:14:59 +02:00
azeemshatp 3aada5dbcc Fix trailing whitespace check in Windows and Linux
Previous check in check.bat considered only uncommitted changes.
2020-08-18 12:14:01 +02:00
Martin Jäger d2e833716a Add Grid_A to ThingSet data nodes 2020-08-17 19:59:58 +02:00
Daniel Fanache c8fa15a860 Remove executable bit for board definition files. 2020-08-17 19:59:58 +02:00
Daniel Fanache e427b45352 Use DT macros instead of Kconfig for board pinmux
Stops using CONFIG_device_x style configuration items and checks the
devicetree to determine if the nodes are enabled.

Fixes UEXT serial port not working.
2020-08-17 19:59:58 +02:00
Martin Jäger ee5846323f Fix STM32G4 ADC settings to improve accuracy
- Wait for the reference voltage to stabilize (thanks to yasen)
- Increase internal regulator stabilization period prior to calibration
2020-08-17 19:59:58 +02:00
Martin Jäger 176af4188f Increase serial watchdog timeout
This prevents the watchdog from kicking in while configuration is stored to
slow EEPROM integrated in STM32L072 MCUs.
2020-08-17 19:58:51 +02:00
Martin Jäger 445359c3b5 Make CAN publication frequency more accurate
Using K_TIMEOUT_ABS_MS for k_sleep calculate exact 1s interval.
2020-08-03 14:52:20 +02:00
Martin Jäger 8f96343cf1 Add support for Kconfig in src/custom
Also fixes data_nodes_custom.cpp inclusion based on Kconfig.
2020-07-27 17:53:31 +02:00
Martin Jäger bbd1312fe5 Relocate and clean up application Kconfig structure 2020-07-24 08:49:47 +02:00
Martin Jäger dc85b46477 Remove unused ExtInterface and ExtMgr 2020-07-23 19:27:45 +02:00
Martin Jäger 01650917fd Move ThingSet serial to dedicated thread 2020-07-23 19:18:24 +02:00
Martin Jäger 79ba9006e7 Move OLED display to dedicated thread 2020-07-23 18:31:52 +02:00
Martin Jäger 5e213fdfb1 Generate COMMIT_HASH define via CMake
Previously the commit hash was generated with a python script which was only
called by PlatformIO and caused issues when using Zephyr SDK directly.
2020-07-23 17:34:41 +02:00
Martin Jäger c2ef955a63 Replace custom print_* with Zephyr LOG_* 2020-07-23 17:34:41 +02:00
Martin Jäger 8e06357a7d Make CAN node ID configurable 2020-07-23 17:34:41 +02:00
Martin Jäger 70baedf95d CAN: Separate thread for pub messages 2020-07-23 17:34:41 +02:00
Martin Jäger 3b486f3193 Restructure SW watchdog and fix bug for >3 channels
The feed function considered max. number of channels and not actual number
of registered channels, which resulted in undefined behavior if not all
channels were used.

Also introducing more simple API to hide the software implementation.
2020-07-23 17:34:41 +02:00
Martin Jäger ed374e8e99 Remove CAN msg queue and update ThingSet lib 2020-07-23 17:34:41 +02:00
Martin Jäger dc4576c8b4 Remove all board.h files
Final updates to devicetree files (adding temperature sensor information) make
board.h files obsolete.
2020-07-23 17:34:41 +02:00
Martin Jäger 27cdcb3bf6 LED setup via devicetree
- New charlieplexing-leds binding
- board.dts files updated
- Pin and LED setup removed from pinmux.c and board.h files
2020-07-23 17:34:41 +02:00
Martin Jäger a584904470 Switch to new DT_ macros 2020-07-23 17:34:39 +02:00
Martin Jäger b8fe6d7023 Fix some static code analysis warnings 2020-07-23 12:55:38 +02:00
Martin Jäger 3012501358 Switch to Zephyr 2.3 and update pio check 2020-07-23 12:55:38 +02:00
Martin Jäger 6316dcd57f Add DC/DC HV side output enable switch 2020-07-23 12:55:38 +02:00
Martin Jäger 7dfcac4037 Add ADC reading to/from voltage conversions 2020-07-23 12:55:38 +02:00
Martin Jäger 7af7d1c4ee Add CAN ISO-TP support 2020-07-23 12:55:37 +02:00
Martin Jäger 3fcd27cdba Use separate CMakeLists.txt per directory 2020-07-23 12:41:32 +02:00
Martin Jäger 8a28d8bc22 Remove unused bootloader support 2020-07-23 12:41:32 +02:00