Commit graph

29 commits

Author SHA1 Message Date
Thomas Kolb d239a947cd Zero meas_data on startup for consistent behaviour 2021-07-01 21:15:13 +02:00
Thomas Kolb 79fe1113de charge_control: implement voltage transition 2021-07-01 21:10:13 +02:00
Thomas Kolb 49bd9247e0 Average the measurements
The measurement module now provides averaged measurements. These are
used in some places where accuracy is more important than latency (for
example for the temperature limit, where noise triggered the limit too
early).
2021-06-18 23:37:16 +02:00
Thomas Kolb 7ca6104e80 charge_control: refactoring, bug fixes
- Moved shared state transition checks to separate function
- Improved behaviour when the battery is full
2021-06-18 20:25:53 +02:00
Thomas Kolb d9bc181973 Fixed a typo 2021-06-13 14:55:43 +02:00
Thomas Kolb d94b376f00 Update fxplib (only license and documentation changed) 2021-06-13 14:45:34 +02:00
Thomas Kolb 1ad2456c8b Added pinout.txt 2021-06-12 18:45:42 +02:00
Thomas Kolb 7bdb5338a4 Added README and LICENSE documents 2021-06-12 18:40:36 +02:00
Thomas Kolb 62b63efba3 charge_control: first state transition wins 2021-06-12 17:07:16 +02:00
Thomas Kolb add925bba0 Fixed temperature measurement 2021-06-12 16:49:05 +02:00
Thomas Kolb df3211333e Properly shut down peripherals before entering deep sleep
This is most important for the LEDs and the RS485 interface. If any LED
is on when deep sleep is entered, it will stay on the whole sleep time,
drawing about 10 mA on the 3,3V rail.

The RS485 transceiver must be switched to RX mode, as it consumes about
30 mA from the 5V rail in TX mode.
2021-06-12 16:02:21 +02:00
Thomas Kolb 5ceb014d1b Disable RS485 driver and systick before deep sleep
- The RS485 driver consumes about 150 mW if enabled
- The systick somehow can wake up the CPU from stop mode
2021-06-12 16:02:21 +02:00
Thomas Kolb 189ea810d9 deepsleep: use libopencm3 functions instead of register access 2021-06-12 16:02:21 +02:00
Thomas Kolb 98d0c08ec3 First try to implement deep sleep
It sleeps, but never wakes up again. Also it consumes a lot of current
which suspended?!
2021-06-12 16:02:21 +02:00
Thomas Kolb fa71acfc8e main.c: remove unused #includes 2021-06-12 01:12:33 +02:00
Thomas Kolb c76918ae2a Moved clock setup to separate file 2021-06-11 23:55:10 +02:00
Thomas Kolb d2a95c4353 charge_control: removed unused code 2021-06-11 23:52:50 +02:00
Thomas Kolb ed6ac04686 Refactoring: move FSMs to separate functions 2021-06-11 22:51:02 +02:00
Thomas Kolb c504fb944c Call charge_control_init() 2021-06-11 22:35:59 +02:00
Thomas Kolb 1ad35dae2b Print (dis)charge FSM state changes 2021-06-11 22:35:07 +02:00
Thomas Kolb 6b070bbf86 Started implementing real charge control
Everything untested so far…
2021-06-07 22:45:17 +02:00
Thomas Kolb 0982f8d7c9 Increase charge pump frequency to 500 Hz
This change reduces the voltage drop with higher loads, for example if
both the solar and the load switch are on at the same time.
2021-06-06 15:08:22 +02:00
Thomas Kolb 3e8ebbe201 Fixed "debug" make target 2021-06-06 12:20:58 +02:00
Thomas Kolb 46d3e16104 Make measurement usable
- Run ADC Calibration on startup (without calibration, there is a huge
  offset error, making the current sensing unusable)
- Added calibration factors which allow to compensate for inaccuracies
  in the circuitry (example: 1% tolerance transistors)
- Send measured values via RS485
2021-06-06 12:17:38 +02:00
Thomas Kolb 2ca6c41260 Implemented RS485 driver (TX only) 2021-06-06 12:16:46 +02:00
Thomas Kolb c01cb4f742 Prepare for analog measurements 2021-06-05 21:20:12 +02:00
Thomas Kolb 6644b29257 Added power switch driver 2021-06-05 16:33:21 +02:00
Thomas Kolb 5764d87a08 Added the charge pump driver 2021-06-05 15:49:29 +02:00
Thomas Kolb 8c317f2904 Initial commit
- Set up build with latest libopencm3
- Created basic project structure
- Implement Charlieplexing for the LEDs and a little test sequence
2021-06-05 00:04:36 +02:00