Bastian de Byl b7fcd2b301
Build Firmware / Build stm32-teslacharger (pull_request) Successful in 59s
feat: broadcast worst-case OBC temperature on 0x211 byte 7
The Tesla OBC hardware already publishes 9 temperature probes (3
modules × {tmp1, tmp2, tmpin}) on CAN 0x237/0x239/0x23B which the
teslacharger receives as c[123]tmp[12,in]. Until now none of these
were forwarded downstream — the Polarity VCU's STATUS_SCREEN OBC-temp
and DCDC-temp fields rendered 0 °C on OI-OBC cars.

This commit:

- Adds Param::tmpobcmax — derived value computed each Ms100Task tick
  as the max across the 9 probes, skipping any that read -40 °C
  (sensor absent / module not present).
- Maps it to 0x211 byte 7 (previously reserved, the last unused byte
  of the 7-byte frame). Wire encoding uses the Tesla OBC convention
  of offset 40 (wire = °C + 40), matching c[123]tmp* upstream so
  receivers can decode with the same formula.
- Bumps VERSTR to -S5 so the right firmware is visually confirmable
  in the OpenInverter web UI.

The new byte is purely additive — existing 0x211 consumers that read
only bytes 0-6 continue to work unchanged.

The Polarity VCU's 0x211 RX handler grows a corresponding decode +
display path in a paired stm32-hal-vcu commit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 15:48:40 -04:00
2023-01-23 11:30:16 +01:00
2024-06-12 15:43:36 +02:00
2023-01-23 11:32:15 +01:00
2022-10-10 12:39:30 +01:00
2023-12-15 17:56:07 +01:00
2022-10-10 12:39:30 +01:00
2023-12-15 17:56:07 +01:00

stm32-template

This project can be a starting point to your own STM32 project. It contains facilities that make software development easier and ensures compatibility with the esp8266 web interface.

It provides

  • Mostly object oriented syntax
  • A simple, hardware based scheduler for recurring tasks
  • Analog input management, fully independent with DMA
  • Digital I/O management
  • CAN library supporting up to 2 CAN interfaces
    • hardware filter support
    • No limitation on number of messages
    • Automatic mapping from/to parameter module
    • CAN Open SDO support
    • Fully interrupt driven
  • Error memory
  • ligthweight fixed point arithmetic
  • string functions to be independent of stdlib
  • Parameter module that interfaces to esp8266 web GUI
  • Saving parameters to flash
  • Serial terminal with custom commands and DMA transfer
  • Mathematical functions (sin/cos, arctan, square root)
  • PI controller class
  • Functions for field oriented control

OTA (over the air upgrade)

The firmware is linked to leave the 4 kb of flash unused. Those 4 kb are reserved for the bootloader that you can find here: https://github.com/jsphuebner/tumanako-inverter-fw-bootloader When flashing your device for the first time you must first flash that bootloader. After that you can use the ESP8266 module and its web interface to upload your actual application firmware. The web interface is here: https://github.com/jsphuebner/esp8266-web-interface

Compiling

You will need the arm-none-eabi toolchain: https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads On Ubuntu type

sudo apt-get install git gcc-arm-none-eabi

The only external depedencies are libopencm3 and libopeninv. You can download and build these dependencies by typing

make get-deps

Now you can compile stm32- by typing

make

And upload it to your board using a JTAG/SWD adapter, the updater.py script or the esp8266 web interface.

Editing

The repository provides a project file for Code::Blocks, a rather leightweight IDE for cpp code editing. For building though, it just executes the above command. Its build system is not actually used. Consequently you can use your favority IDE or editor for editing files.

Adding classes or modules

As your firmware grows you probably want to add classes. To do so, put the header file in include/ and the source file in src/ . Then add your module to the object list in Makefile that starts in line 43 with .o extension. So if your files are called "mymodule.cpp" and "mymodule.h" you add "mymodule.o" to the list.

When changing a header file the build system doesn't always detect this, so you have to "make clean" and then make. This is especially important when editing the "*_prj.h" files.

S
Description
Skudak fork of jsphuebner/stm32-teslacharger — OpenInverter-based Tesla Gen2 charger firmware with SKUDAK CAN broadcast (0x210) for VCU integration
Readme 1.2 MiB
Languages
C++ 56.3%
C 33.8%
Makefile 8.2%
Linker Script 1.7%