Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
87fc14f
implement stm32 adc provider
mck1117 May 7, 2026
795ed49
kill legacy getSlowAdcSample
mck1117 May 7, 2026
6e89b34
dead code
mck1117 May 7, 2026
cf20585
dead stuff
mck1117 May 7, 2026
f7bbb23
operators for adc_channel_e
mck1117 May 7, 2026
c6d1f25
disable ProtectedGpio for now
mck1117 May 7, 2026
5906c89
remove adcToVoltsDivided
mck1117 May 7, 2026
9bd1bd2
dead dead dead
mck1117 May 7, 2026
2b11ef1
more dead!?
mck1117 May 7, 2026
6e7219d
support ADC_MUX_PIN I guess
mck1117 May 7, 2026
d7b303a
mostly hook up ADC provider
mck1117 May 7, 2026
4f4f9a0
fix raw analog outputs
mck1117 May 7, 2026
63c6868
fix build probably
mck1117 May 7, 2026
a486990
list of providers, rather than list of channels
mck1117 May 7, 2026
015a129
further work
dynfer May 3, 2026
0851dec
fix
dynfer May 3, 2026
426ceeb
add delay
dynfer May 3, 2026
02f78ba
further testing
dynfer May 3, 2026
e33e523
working g0 upload
dynfer May 3, 2026
742c933
lets not have O0 here
dynfer May 3, 2026
7e7778f
release pins
dynfer May 3, 2026
6c57a43
fix this
dynfer May 4, 2026
64ebfec
bump the commit
dynfer May 5, 2026
2f50679
further work
dynfer May 5, 2026
f18a404
bump g0
dynfer May 5, 2026
a6749c3
new implementation
dynfer May 8, 2026
a778685
working analog inputs via provider
dynfer May 8, 2026
55ae05b
disable debug printing
dynfer May 8, 2026
ed974cc
bump
dynfer May 10, 2026
53efa6a
bump again
dynfer May 10, 2026
b074d6b
enable hw oversampling on the g0
dynfer May 10, 2026
9ed964a
change the polling rate and fix the adc channels
dynfer May 10, 2026
0127b65
implement g0 ditigal inputs
dynfer May 10, 2026
7d83165
bump g0 outputs
dynfer May 10, 2026
fd9078e
bump
dynfer May 10, 2026
ffc840c
working outputs and digital io
dynfer May 10, 2026
168878f
split the monolith into readable chunks
dynfer May 10, 2026
b35b82b
add g0 detection
dynfer May 10, 2026
5af55b7
Merge branch 'FOME-Tech:master' into wip2
dynfer May 11, 2026
4eb088a
Merge branch 'master' into wip2
mck1117 May 12, 2026
066d0a9
shared header
dynfer May 12, 2026
e92e3bb
frame views
dynfer May 12, 2026
9b3b6cc
formatting
dynfer May 12, 2026
db9a23a
build guards for non atlas builds
dynfer May 12, 2026
1ca2361
format
dynfer May 12, 2026
670939d
g0 ini support only for atlas
dynfer May 12, 2026
9c3ff3b
enable aux spi max31855 on atlas
dynfer May 12, 2026
ed3f84a
static device on h7
dynfer May 12, 2026
939c60a
bump g0 firmware withh gpt fallback for different frequencies
dynfer May 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,7 @@
path = firmware/ext/build-tools
url = https://github.com/FOME-Tech/build-tools.git
branch = main
[submodule "firmware/ext/g0_firmware"]
path = firmware/ext/g0_firmware
url = https://github.com/dynfer/g0-extension.git
branch = main
2 changes: 1 addition & 1 deletion firmware/config/boards/atlas/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ DDEFS += -DFIRMWARE_ID=\"atlas\"
# DDEFS += -DTRIGGER_SCOPE
DDEFS += -DEFI_SOFTWARE_KNOCK=TRUE -DSTM32_ADC_USE_ADC3=TRUE

DDEFS += -DEFI_SDC_DEVICE=SDCD1
DDEFS += -DEFI_SDC_DEVICE=SDCD1 -DEFI_MAX_31855=TRUE

# Atlas's LSE runs in bypass mode (doesn't use OSC IN pin)
DDEFS += -DSTM32_LSE_BYPASS
Expand Down
6 changes: 6 additions & 0 deletions firmware/config/boards/atlas/board_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ void setBoardConfigOverrides() {
engineConfiguration->spi4misoPin = Gpio::E5;
engineConfiguration->spi4mosiPin = Gpio::E6;

// G0 extension firmware SPI
engineConfiguration->is_enabled_spi_5 = true;
engineConfiguration->spi5sckPin = Gpio::F7;
engineConfiguration->spi5misoPin = Gpio::F8;
engineConfiguration->spi5mosiPin = Gpio::F9;

// Clear SPI SD card pins in case it's enabled from porting a Proteus tune
if (engineConfiguration->sdCardSpiDevice || isBrainPinValid(engineConfiguration->sdCardCsPin)) {
engineConfiguration->is_enabled_spi_3 = false;
Expand Down
46 changes: 46 additions & 0 deletions firmware/config/boards/atlas/compile_atlas.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,51 @@
#!/bin/bash

set -e

SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
FW_DIR=$(readlink -f "$SCRIPT_DIR/../../..")
REPO_DIR=$(readlink -f "$FW_DIR/..")
G0_DIR="$FW_DIR/ext/g0_firmware"

export USE_OPENBLT=yes

git -C "$REPO_DIR" submodule sync firmware/ext/g0_firmware
if [ "${UPDATE_G0_FIRMWARE-yes}" = "yes" ]; then
git -C "$REPO_DIR" submodule update --init --recursive --remote firmware/ext/g0_firmware
else
git -C "$REPO_DIR" submodule update --init --recursive firmware/ext/g0_firmware
fi
git -C "$REPO_DIR" submodule update --init --depth=1 firmware/ext/build-tools

UNAME_SM=$(uname -sm)
case "$UNAME_SM" in
"Darwin "*)
COMPILER_PLATFORM=arm-gnu-toolchain-11.3.rel1-darwin-x86_64-arm-none-eabi
;;
"Linux x86_64")
COMPILER_PLATFORM=arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi
;;
*)
echo "Unsupported compiler platform: $UNAME_SM"
exit 1
;;
esac

G0_TRGT="$FW_DIR/ext/build-tools/$COMPILER_PLATFORM/bin/arm-none-eabi-"
[ -x "${G0_TRGT}g++" ] || { echo "Compiler not found at ${G0_TRGT}g++"; exit 1; }

make -C "$G0_DIR" -j$(nproc) TRGT="$G0_TRGT" USE_OPT="-Os -ggdb -fomit-frame-pointer -falign-functions=16 --specs=nosys.specs" for_fome_image

G0_IMAGE_HEADER="$G0_DIR/for_fome/g0_firmware_image.h"
G0_SPI_APP_PROTOCOL="$G0_DIR/spi_app_protocol.cpp"
if [ ! -f "$G0_SPI_APP_PROTOCOL" ]; then
G0_SPI_APP_PROTOCOL="$G0_DIR/source/spi_app_protocol.cpp"
fi
G0_APP_VERSION=$(sed -nE 's/.*(APP_VERSION|appVersion) = ([0-9]+)U;.*/\2/p' "$G0_SPI_APP_PROTOCOL" | head -n1)
[ -n "$G0_APP_VERSION" ] || { echo "Unable to determine G0 app version"; exit 1; }
if ! grep -q 'build_g0_extension_version' "$G0_IMAGE_HEADER"; then
printf '\nstatic const unsigned int build_g0_extension_version = %sU;\n' "$G0_APP_VERSION" >> "$G0_IMAGE_HEADER"
fi

cd "$SCRIPT_DIR"
bash ../common_make.sh atlas ARCH_STM32H7
80 changes: 80 additions & 0 deletions firmware/config/boards/atlas/connectors/g0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
pins:
- id: EFI_ADC_20
class: analog_inputs
ts_name: G0 Analog 1

- id: EFI_ADC_21
class: analog_inputs
ts_name: G0 Analog 2

- id: EFI_ADC_22
class: analog_inputs
ts_name: G0 Analog 3

- id: EFI_ADC_23
class: analog_inputs
ts_name: G0 Analog 4

- id: EFI_ADC_24
class: analog_inputs
ts_name: G0 Analog 5

- id: EFI_ADC_25
class: analog_inputs
ts_name: G0 Analog 6

- id: EFI_ADC_26
class: analog_inputs
ts_name: G0 Analog 7

- id: EFI_ADC_27
class: analog_inputs
ts_name: G0 Analog 8

- id: EFI_ADC_28
class: analog_inputs
ts_name: G0 Analog Temp 1

- id: EFI_ADC_29
class: analog_inputs
ts_name: G0 Analog Temp 2

- id: EFI_ADC_30
class: analog_inputs
ts_name: G0 Analog Temp 3

- id: EFI_ADC_31
class: analog_inputs
ts_name: G0 Analog Temp 4

- id: G0_DIGITAL_IN_0
class: switch_inputs
ts_name: G0 Digital 1

- id: G0_DIGITAL_IN_1
class: switch_inputs
ts_name: G0 Digital 2

- id: G0_DIGITAL_IN_2
class: switch_inputs
ts_name: G0 Digital 3

- id: G0_DIGITAL_IN_3
class: switch_inputs
ts_name: G0 Digital 4

- id: G0_LOWSIDE_0
class: outputs
ts_name: G0 Lowside 1

- id: G0_LOWSIDE_1
class: outputs
ts_name: G0 Lowside 2

- id: G0_LOWSIDE_2
class: outputs
ts_name: G0 Lowside 3

- id: G0_LOWSIDE_3
class: outputs
ts_name: G0 Lowside 4
2 changes: 1 addition & 1 deletion firmware/config/boards/atlas/prepend.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define ts_show_full_pinout false
#define ts_show_egt false
#define ts_show_egt true
#define ts_show_analog_divider false
#define ts_show_spi false
#define ts_show_can_pins false
Expand Down
13 changes: 13 additions & 0 deletions firmware/config/boards/atlas_meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,16 @@
#define PROTEUS_DIGITAL_4 Gpio::E11
#define PROTEUS_DIGITAL_5 Gpio::E12
#define PROTEUS_DIGITAL_6 Gpio::E13

#define ATLAS_G0_ANALOG_1 EFI_ADC_20
#define ATLAS_G0_ANALOG_2 EFI_ADC_21
#define ATLAS_G0_ANALOG_3 EFI_ADC_22
#define ATLAS_G0_ANALOG_4 EFI_ADC_23
#define ATLAS_G0_ANALOG_5 EFI_ADC_24
#define ATLAS_G0_ANALOG_6 EFI_ADC_25
#define ATLAS_G0_ANALOG_7 EFI_ADC_26
#define ATLAS_G0_ANALOG_8 EFI_ADC_27
#define ATLAS_G0_ANALOG_TEMP_1 EFI_ADC_28
#define ATLAS_G0_ANALOG_TEMP_2 EFI_ADC_29
#define ATLAS_G0_ANALOG_TEMP_3 EFI_ADC_30
#define ATLAS_G0_ANALOG_TEMP_4 EFI_ADC_31
1 change: 1 addition & 0 deletions firmware/console/binary/output_channels.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ struct_no_prefix output_channels_s
bit ignitionFault;Error: Ignition Fault
bit isUsbConnected;isUsbConnected\nOriginal reason for this is to check if USB is connected from Lua
bit dfcoActive;DFCO: Active
bit g0Present;G0 extension: Present


uint16_t RPMValue;@@GAUGE_NAME_RPM@@;"RPM",1, 0, 0, 8000, 0
Expand Down
8 changes: 8 additions & 0 deletions firmware/console/status_loop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
#include "main_trigger_callback.h"
#include "spark_logic.h"
#include "gitversion.h"
#if HW_ATLAS
#include "hw_layer/g0_extension/g0_extension_io.h"
#endif
#include "can_hw.h"
#include "periodic_thread_controller.h"
#include "binary_logging.h"
Expand Down Expand Up @@ -492,6 +495,11 @@ void updateTunerStudioState() {
tsOutputChannels->gyroYaw = engine->sensors.accelerometer.yawRate;

tsOutputChannels->turboSpeed = Sensor::getOrZero(SensorType::TurbochargerSpeed);
#if HW_ATLAS
tsOutputChannels->g0Present = isG0ExtensionPresent();
#else
tsOutputChannels->g0Present = false;
#endif
extern FrequencySensor vehicleSpeedSensor;
tsOutputChannels->vssEdgeCounter = vehicleSpeedSensor.eventCounter;

Expand Down
21 changes: 21 additions & 0 deletions firmware/controllers/algo/rusefi_hw_enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,27 @@ enum class Gpio : uint16_t {
TLE6240_PIN_15 = 213,
TLE6240_PIN_16 = 214,

G0_ANALOG_1 = 215,
G0_ANALOG_2 = 216,
G0_ANALOG_3 = 217,
G0_ANALOG_4 = 218,
G0_ANALOG_5 = 219,
G0_ANALOG_6 = 220,
G0_ANALOG_7 = 221,
G0_ANALOG_8 = 222,
G0_ANALOG_TEMP_1 = 223,
G0_ANALOG_TEMP_2 = 224,
G0_ANALOG_TEMP_3 = 225,
G0_ANALOG_TEMP_4 = 226,
G0_DIGITAL_IN_0 = 227,
G0_DIGITAL_IN_1 = 228,
G0_DIGITAL_IN_2 = 229,
G0_DIGITAL_IN_3 = 230,
G0_LOWSIDE_0 = 231,
G0_LOWSIDE_1 = 232,
G0_LOWSIDE_2 = 233,
G0_LOWSIDE_3 = 234,

CAN_INPUT_0 = 249,
CAN_INPUT_1 = 250,
CAN_INPUT_2 = 251,
Expand Down
1 change: 0 additions & 1 deletion firmware/controllers/controllers.mk
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,3 @@ CONTROLLERS_INC=\
$(CONTROLLERS_DIR)/actuators \
$(CONTROLLERS_DIR)/actuators/gppwm \
$(CONTROLLERS_DIR)/serial \

28 changes: 28 additions & 0 deletions firmware/controllers/system/efi_gpio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
#include "engine_sniffer.h"

#include "drivers/gpio/gpio_ext.h"
#if EFI_PROD_CODE && HW_ATLAS
#include "hw_layer/g0_extension/g0_extension_io.h"
#endif

#if HW_HELLEN
#include "hellen_meta.h"
Expand Down Expand Up @@ -458,6 +461,13 @@ void OutputPin::setValue(int logicValue) {
int electricalValue = getElectricalValue(logicValue, m_mode);

#if EFI_PROD_CODE
#if HW_ATLAS
if (isG0ExtensionLowsidePin(m_brainPin)) {
setG0ExtensionLowsideOutput(m_brainPin, electricalValue != 0);
return;
}
#endif

#if (BOARD_EXT_GPIOCHIPS > 0)
if (!this->ext) {
setOnchipValue(electricalValue);
Expand Down Expand Up @@ -575,6 +585,13 @@ void OutputPin::initPin(
setDefaultPinState(outputMode);

#if EFI_PROD_CODE
#if HW_ATLAS
if (isG0ExtensionLowsidePin(m_brainPin)) {
brain_pin_markUsed(m_brainPin, msg);
return;
}
#endif

iomode_t ioMode = (outputMode == OM_DEFAULT || outputMode == OM_INVERTED) ? PAL_MODE_OUTPUT_PUSHPULL
: PAL_MODE_OUTPUT_OPENDRAIN;

Expand Down Expand Up @@ -621,6 +638,17 @@ void OutputPin::deInit() {

efiPrintf("unregistering %s", hwPortname(m_brainPin));

#if EFI_PROD_CODE
#if HW_ATLAS
if (isG0ExtensionLowsidePin(m_brainPin)) {
disableG0ExtensionLowsideOutput(m_brainPin);
brain_pin_markUnused(m_brainPin);
m_brainPin = Gpio::Unassigned;
return;
}
#endif
#endif

efiSetPadUnused(m_brainPin);

// Clear the pin so that it won't get set any more
Expand Down
Loading
Loading