516 Commits
Author SHA1 Message Date
Martin Jäger a1e8c1d6dd CAN: Add control frame pub/sub handling
- Add data node ctrl/CtrlTarget_A for current-mode control
- Send out own value every 100 ms and apply received values
  of CAN device with highest priority.
2021-07-29 14:21:15 +02:00
Martin Jäger 88bb8059f3 Charger: Add follower state for power sharing
This state is enabled if the device receives a current target signal from
a device with higher priority via CAN. After not receiving the messages
for 1 second the state machine automatically goes back to normal operation.
2021-07-29 14:21:14 +02:00
Martin Jäger fbf7eca764 CAN: Subscribe to incoming publication messages 2021-07-23 11:53:51 +02:00
Martin Jäger b61961ca62 CAN: Rename threads and use DEVICE_DT_GET 2021-07-23 09:18:33 +02:00
Martin Jäger 8045799b81 CAN: Increase ISO-TP TX buffer size to 1000 bytes
Necessary to return large amount of data e.g. after a request to
get all conf data nodes.
2021-07-23 08:53:55 +02:00
Martin Jäger 3b72694deb DC/DC: Add some safety functions to test mode 2021-07-14 15:40:17 +02:00
Martin Jäger da04994ae6 Add UART RX pull-up to all interfaces
This avoids receiving junk characters when no other device is
connected to the serial interface and the pin is left floating.
2021-07-14 15:28:22 +02:00
Martin Jäger 985c8893d2 Move to Zephyr v2.6
- Update west.yml and platformio.ini
- Configure clock-control via Devicetree
2021-06-25 16:37:30 +02:00
Martin Jäger ecb914fe13 Fix STM32G4 bootloader triggering
The MPU must be disabled to allow writing the option bytes.

Also replacing flash_write_protection_set with direct register access
because it will be deprecated in Zephyr v2.6.
2021-06-07 13:11:37 +02:00
Martin Jäger 8de5c595c2 Bat charger: Debounce recharge from trickle state
Reduce the recharge voltage threshold and consider it for transition
between trickle and bulk charging such that the trickle state is
maintained longer and batteries don't get recharged multiple times
per day.

This is also necessary for nanogrid interface control, which can try to
maintain a voltage between recharge and trickle voltage by exporting
excess solar energy towards the grid. If the battery voltage is maintained
at the trickle voltage, the solar input power might be reduced and not all
available power can be used.
2021-06-01 18:02:52 +02:00
Martin Jäger a4760ebcb8 DAQ: Add HV bus voltage_filtered 2021-06-01 17:48:43 +02:00
Martin Jäger 9765798944 Charger: Fix state machine startup behavior
If the device starts up with the battery voltage > bat_conf->voltage_recharge,
the charger state machine did not leave CHG_STATE_IDLE. However, the PWM solar
input still started charging the battery and stayed at bulk charging voltage
all the time.

Now we don't check the recharge limits if the CHG_STATE_IDLE was reached for
the first time, so that the state machine goes into CHG_STATE_BULK properly.

Also fixing some formatting and moving the state enum before Charger class.
2021-06-01 17:44:10 +02:00
Martin Jäger 359942f3fe PWM 2420 LUS: Fix SPI pinctrl 2021-05-31 14:42:26 +02:00
Martin Jäger f821bb7412 Switch from Travis CI to GH Actions 2021-05-26 17:31:47 +02:00
Martin Jäger 6ab9fd9dc7 CAN: Fix ISO-TP net buffer handling
Also setting ISOTP buffers to default values.
2021-05-26 17:20:24 +02:00
Martin Jäger 96b8c14734 CAN: Increase bit rate to 500 kbit/s 2021-05-26 17:19:28 +02:00
Martin Jäger 955eb0edb1 Move scripts into dedicated directory
Now also using scripts/check.sh for Travis CI directly
2021-05-18 08:47:26 +02:00
Martin Jäger 84541d4311 Data nodes: Fix duplicate ID 2021-05-17 17:54:57 +02:00
Martin Jäger 70cd1e0c8d DC/DC: Simplify startup_inhibit function and increase time 2021-05-17 14:58:56 +02:00
Martin Jäger 2a59a010ff DC/DC: Improve test mode
- Go towards 50% duty cycle from both directions
- Use already existing startup_inhibit function
2021-05-17 14:50:31 +02:00
Martin Jäger d7e575f189 Data nodes: Update descriptions 2021-05-11 13:51:19 +02:00
Leonard Möller 824e33f4e8 Added a parser to scrap additional information for the esp-edge and added json-snippets for ts-nodes 2021-05-11 13:51:19 +02:00
Martin Jäger 0e8f93bc08 Add ThingSet nodes for DFU (device firmeare upgrade)
Creating new root category dfu instead of adding flash information to
info node so that all DFU / OTA related information is kept together.
2021-05-11 10:57:57 +02:00
Daniel Fanache 187b9c4c4e Trigger STM32G4xx bootloader through flash option bit.
Uses Zephyr flash driver.

Currently only supported on the STM32G4xx devices.
2021-05-11 10:57:57 +02:00
mulles eafb081555 Add udev rules remarks to README.md (#122) 2021-05-04 18:49:20 +02:00
mulles 283139c138 Update README.md
Changed the sentence under 3. as suggested things don't seems  to work. There seems to be no board to uncomment. But setting the default-envs variable to one of the board names, listed beneath without @x.x (did not try what happens if @0.7 is used)

The previous link http://libre.solar/docs/flashing was dead. https://learn.libre.solar/development/flashing_debugging.html might be the new location of the referenced documentation?
2021-05-04 18:13:38 +02:00
Martin Jäger 20214513f8 Add console back to prj.conf to fix ThingSet RX
Normally the console should not be necessary, as we are using the UART
driver directly. However, without these Kconfigs, input is not received.
2021-04-20 18:47:57 +02:00
Martin Jäger 5196694e42 Inclusive language: Rename master to main branch v21.0 2021-04-14 12:32:14 +02:00
Martin Jäger 613e454fed Clean up prj.conf and improve documentation 2021-04-14 12:23:07 +02:00
Martin Jäger 1943533360 Use UEXT serial for ThingSet by default
Rationale: ESP32 modules can be used as gateways without firmware change.
2021-04-14 11:41:52 +02:00
Martin Jäger 8d8a8f06ad Improve Kconfig and docs for battery type setup 2021-04-14 11:41:50 +02:00
Martin Jäger fac325d423 ThingSet: Move info/Timestamp_s to output/Uptime_s
This makes clear that the timestamp is not the actual time, but the
seconds since the device started.

The timestamp is also not stored in NVM anymore, as the DayCount provides
information about the operating time of the device already. This way
it can be found out if there was a reset of the device based on its uptime.
2021-04-14 11:20:20 +02:00
Martin Jäger cc0bdc1004 Print firmware and hardware version during startup 2021-04-14 11:19:31 +02:00
Martin Jäger daff69550f MPPT 1210 HUS: Match LED assignment with manual 2021-04-14 11:19:31 +02:00
Martin Jäger ede29544d2 CI: Add PlatformIO native manually to fix unit tests 2021-04-14 11:19:31 +02:00
Martin Jäger bc61a29bed Increase HS voltage of MPPT 2420 HC to 90V 2021-04-14 11:19:31 +02:00
Martin Jäger b4483129c2 Configure ThingSet pub messages via Kconfig and enable by default 2021-04-08 09:39:38 +02:00
Martin Jäger faf3bde214 Improve MPPT behavior for STM32G4 series
- Increase PWM step size to see differences between each controller run
- Take ADC2 measurements (current sensors) synchronous to voltages
  (previous approach with high-rate current measurement once per PWM
  cycle only makes sense for cycle-by-cylce control, not for slow MPPT)
2021-03-28 17:37:55 +02:00
Martin Jäger 94dc0d9a3f DAQ: Call update after initial calibration
Otherwise the current measurement will show wrong readings in ThingSet
messages read before control thread started.
2021-03-27 18:26:55 +01:00
Martin Jäger b2707067ac NVS data storage: Improve logging 2021-03-17 13:19:19 +01:00
Martin Jäger d2b4eb7f7e DCDC: Make low power shut off less sensitive
The controllers with fast ADC sampling speed were sometimes switched off
immediately after turn-on. Switching off at negative power flow is only an
additional safety measure. Normally the controller should switch off
reliably because of power_good_timestamp already.
2021-03-17 13:00:00 +01:00
Martin Jäger 3f11266838 Disable pull-down on PB4 and PB6 for STM32G4 MCUs
This pull-down caused issues with the latching power-good function in a
board which required PB6 to be configured as an input.
2021-03-16 17:51:24 +01:00
Martin Jäger 3b68bc1bcc Use STM32 LL API to enable clocks (e.g. for CRC)
Reason: We need to wait until the clock enable register is actually set before
we can consider the clock running. This caused an issue with the CRC
peripheral, which sometimes did not work correctly (always returned 0) right
after startup.

This commit switches to LL API, which includes a delay. Updating all occurences
of direct clock enabling via registers and not only the CRC peripheral.
2021-03-16 17:51:15 +01:00
Martin Jäger 5e02ab2292 Data storage: Add NVS backend to use flash instead of EEPROM 2021-03-12 18:40:22 +01:00
Martin Jäger 8c7a18662e Data storage: Use Zephyr logging system 2021-03-12 18:40:22 +01:00
Martin Jäger a06f14b63c Rename eeprom files to more generic data_storage
This is a preparation for futur non-volatile storage in flash memory.
2021-03-12 18:40:22 +01:00
Martin Jäger 483e09d1a2 Use generic Copyright notice in all files 2021-03-12 18:40:22 +01:00
Martin Jäger c87e5f974a Add MPPT 2420 HC v0.2 board 2021-03-12 18:40:21 +01:00
Martin Jäger 2bbba0ba13 Upgrade PlatformIO to ststm32 v12.0.0 (includes Zephyr v2.5) 2021-03-11 16:42:56 +01:00
Martin Jäger cfeec975c1 Include git SHA into firmware version
Removing separate CommitHash data node because it's not needed anymore.
2021-03-11 16:42:43 +01:00