Commit Graph

24 Commits

Author SHA1 Message Date
Thomas Kolb e6891aed78 Initialize the addon board 2023-09-16 22:48:41 +02:00
Thomas Kolb e8dff1f017 Correct timebase_ms after deep sleep
During deep sleep, the millisecond counter is stopped. To ensure correct delay
times, we add the sleep duration to the counter after wakeup.
2023-06-18 16:18:44 +02:00
Thomas Kolb a140b3ade6 Do not send BMP280 data if invalid 2022-11-13 14:35:34 +01:00
Thomas Kolb 1cbe0ce410 Prevent deep sleep during BMP280 communication 2022-10-15 21:48:15 +02:00
Thomas Kolb 07dd91ecc2 bmp280: read out via DMA in the background
This removes any busy waiting on the I²C from the main loop.
Initialization is still done in a blocking way.
2022-10-15 20:49:31 +02:00
Thomas Kolb 055186180f Merge branch 'main' into bmp280 2022-10-15 16:43:36 +02:00
Thomas Kolb 2f0f6a01f2 Initial BMP280 integration
This version uses only blocking i2c calls, and long transfers will
probably cause frame loss. Also, if no BMP280 is present, the firmware
will not start up and hang in an endless loop instead.
2022-10-08 20:50:08 +02:00
Thomas Kolb 481cf6f9f4 Use the new flash config module 2022-09-25 17:24:21 +02:00
Thomas Kolb 8dd5c8121f Send error state over RS485 2021-09-19 14:21:00 +02:00
Thomas Kolb d239a947cd Zero meas_data on startup for consistent behaviour 2021-07-01 21:15: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 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 c504fb944c Call charge_control_init() 2021-06-11 22:35:59 +02:00
Thomas Kolb 6b070bbf86 Started implementing real charge control
Everything untested so far…
2021-06-07 22:45:17 +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 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