diff --git a/firmware/config/boards/frankenso/connectors/internal.yaml b/firmware/config/boards/frankenso/connectors/internal.yaml new file mode 100644 index 0000000000..872577ac63 --- /dev/null +++ b/firmware/config/boards/frankenso/connectors/internal.yaml @@ -0,0 +1,4 @@ +pins: + - id: EFI_ADC_14 + class: analog_inputs + ts_name: Analog VBatt diff --git a/firmware/config/boards/frankenso/connectors/main.yaml b/firmware/config/boards/frankenso/connectors/main.yaml new file mode 100644 index 0000000000..27516d8e7f --- /dev/null +++ b/firmware/config/boards/frankenso/connectors/main.yaml @@ -0,0 +1,223 @@ +pins: + - pin: 2 + function: Power Ignition On (input) + + - pin: 6 + id: GPIOC_9 + class: outputs + function: Ignition Coil #1 + ts_name: Coil 1F + + - pin: 7 + id: GPIOE_14 + class: outputs + function: Ignition Coil #3 + ts_name: Coil 1G + + - pin: 8 + id: GPIOC_7 + class: outputs + function: Ignition Coil #2 + ts_name: Coil 1H + + - pin: 9 + id: GPIOE_10 + class: outputs + function: Spare High #5 + ts_name: Coil 1I + + - pin: 12 + id: GPIOE_8 + class: outputs + function: Spare High #6 + ts_name: Coil 1L + + - pin: 13 + id: GPIOE_12 + class: outputs + function: Ignition Coil #4 + ts_name: Coil 1M + + - pin: 15 + id: GPIOD_8 + class: outputs + function: Spare High #8 + ts_name: Coil 1O + + - pin: 16 + id: GPIOD_9 + class: outputs + function: Spare High #7 + ts_name: Coil 1P + + - pin: 23 + function: Crank Pos/Trigger #1 + + + - pin: 24 + function: Crank Neg/Trigger #1 - + + - pin: 25 + function: Cam Pos/Trigger #2 + + + - pin: 26 + function: Cam Neg/Trigger #2 - + + - pin: 29 + function: Knock sensor + + - pin: 30 + function: Knock sensor + + - pin: 33 + function: CAN high + + - pin: 34 + function: CAN low + + - pin: 35 + id: GPIOC_13 + class: outputs + ts_name: Injector 2M + function: Idle Valve Control Solenoid + + - pin: 36 + id: GPIOD_7 + class: outputs + ts_name: Injector 2N + function: Main Relay + + - pin: 37 + id: GPIOE_5 + class: outputs + ts_name: Injector 2O + function: Coolant Fan Relay + + - pin: 38 + id: GPIOE_6 + class: outputs + ts_name: Injector 2P + function: Spare low #2 + + - pin: 39 + function: Ground + + - pin: 40 + function: Ground + + - pin: 41 + function: Ground + + - pin: 42 + function: Ground + + - pin: 43 + id: EFI_ADC_15 + class: analog_inputs + ts_name: Analog 3E + + - pin: 45 + id: EFI_ADC_7 + class: analog_inputs + ts_name: Analog 3G + + - pin: 46 + id: EFI_ADC_6 + class: analog_inputs + ts_name: Analog 3H + + - pin: 47 + id: EFI_ADC_4 + class: analog_inputs + ts_name: Analog 3I + + - pin: 48 + id: EFI_ADC_3 + class: analog_inputs + ts_name: Analog 3J + + - pin: 49 + function: 5V Sensor Power Supply Output + + - pin: 50 + id: EFI_ADC_1 + class: analog_inputs + ts_name: Analog 3L + function: Extra Input + + - pin: 51 + id: EFI_ADC_2 + class: analog_inputs + ts_name: Analog 3M + function: Throttle Position Sensor + + - pin: 52 + id: EFI_ADC_13 + class: analog_inputs + ts_name: Analog 3N + function: O2 Sensor + + - pin: 53 + id: EFI_ADC_0 + class: analog_inputs + ts_name: Analog 3O + function: MAP Sensor + + - pin: 54 + id: EFI_ADC_11 + class: analog_inputs + ts_name: Analog 3P + function: Intake air temp Sensor + + - pin: 55 + id: EFI_ADC_12 + class: analog_inputs + ts_name: Analog 3Q + function: Coolant Temp Sensor + + - pin: 57 + id: GPIOE_3 + class: outputs + ts_name: Injector 3S + function: Spare low #1 + + - pin: 58 + id: GPIOE_4 + class: outputs + ts_name: Injector 3T + function: Fuel Pump Relay + + - pin: 59 + id: GPIOD_3 + class: outputs + ts_name: Injector 3U + function: Spare low + + - pin: 60 + id: GPIOE_2 + class: outputs + ts_name: Injector 3V + function: Injector #2 + + - pin: 61 + id: GPIOB_9 + class: outputs + ts_name: Injector 3W + function: Injector #1 + + - pin: 62 + id: GPIOD_5 + class: outputs + ts_name: Injector 3X + function: Spare low + + - pin: 63 + id: GPIOB_8 + class: outputs + ts_name: Injector 3Y + function: Injector #3 + + - pin: 64 + id: GPIOB_7 + class: outputs + ts_name: Injector 3Z + function: Injector #4 diff --git a/firmware/config/boards/frankenso/mapping.yaml b/firmware/config/boards/frankenso/mapping.yaml deleted file mode 100644 index 30d5f6012b..0000000000 --- a/firmware/config/boards/frankenso/mapping.yaml +++ /dev/null @@ -1,43 +0,0 @@ -outputs: - GPIOB_7: "Injector 3Z" - GPIOB_8: "Injector 3Y" - GPIOB_9: "Injector 3W" - GPIOC_13: "Injector 2M" - - GPIOD_3: "Injector 3U" - GPIOD_5: "Injector 3X" - GPIOD_7: "Injector 2N" - GPIOE_2: "Injector 3V" - - GPIOE_3: "Injector 3S" - GPIOE_4: "Injector 3T" - GPIOE_5: "Injector 2O" - GPIOE_6: "Injector 2P" - - GPIOC_7: "Coil 1H" - GPIOC_9: "Coil 1F" - GPIOD_8: "Coil 1O" - GPIOD_9: "Coil 1P" - - GPIOE_8: "Coil 1L" - GPIOE_10: "Coil 1I" - GPIOE_12: "Coil 1M" - GPIOE_14: "Coil 1G" - -analog_inputs: - EFI_ADC_0: "Analog 3O" - EFI_ADC_1: "Analog 3L" - EFI_ADC_2: "Analog 3M" - EFI_ADC_3: "Analog 3J" - - EFI_ADC_4: "Analog 3I" - EFI_ADC_6: "Analog 3H" - EFI_ADC_7: "Analog 3G" - EFI_ADC_11: "Analog 3P" - - EFI_ADC_12: "Analog 3Q" - EFI_ADC_13: "Analog 3N" - EFI_ADC_14: "Analog VBatt" - EFI_ADC_15: "Analog 3E" - - diff --git a/firmware/config/boards/hellen/cypress/config/gen_config.sh b/firmware/config/boards/hellen/cypress/config/gen_config.sh index fc3d5ed801..8a80eee1ff 100644 --- a/firmware/config/boards/hellen/cypress/config/gen_config.sh +++ b/firmware/config/boards/hellen/cypress/config/gen_config.sh @@ -14,18 +14,6 @@ pwd bash gen_signature.sh hellen_cypress -java \ - -DSystemOut.name=gen_config_hellen_cypress_board \ - -cp ../java_tools/ConfigDefinition.jar \ - com.rusefi.board_generator.BoardReader \ - -yaml config/boards/hellen/cypress/mapping.yaml \ - -firmware_path . \ - -output_file tunerstudio/generated/hellen_cypress_prefix.txt \ - -enumInputFile controllers/algo/rusefi_enums.h \ - -enumInputFile config/boards/hellen/cypress/rusefi_hw_enums.h - -[ $? -eq 0 ] || { echo "ERROR generating TunerStudio board config for hellen_cypress"; exit 1; } - java \ -DSystemOut.name=gen_config_hellen_cypress \ -Drusefi.generator.lazyfile.enabled=true \ @@ -44,7 +32,8 @@ java \ -signature tunerstudio/generated/signature_hellen_cypress.txt \ -signature_destination controllers/generated/signature_hellen_cypress.h \ -enumInputFile controllers/algo/rusefi_enums.h \ - -prepend config/boards/hellen/cypress/config/rusefi_config_hellen_cypress.txt \ + -enumInputFile controllers/algo/rusefi_hw_enums.h \ + -board hellen_cypress \ -prepend config/boards/hellen/cypress/config/tunerstudio/generated/hellen_cypress_prefix.txt [ $? -eq 0 ] || { echo "ERROR generating TunerStudio config for hellen_cypress"; exit 1; } diff --git a/firmware/config/boards/kinetis/config/gen_config.sh b/firmware/config/boards/kinetis/config/gen_config.sh index e764d91c2c..4382153199 100644 --- a/firmware/config/boards/kinetis/config/gen_config.sh +++ b/firmware/config/boards/kinetis/config/gen_config.sh @@ -14,18 +14,6 @@ pwd bash gen_signature.sh kin -java \ - -DSystemOut.name=gen_config_kinetis_board \ - -cp ../java_tools/ConfigDefinition.jar \ - com.rusefi.board_generator.BoardReader \ - -yaml config/boards/kinetis/mapping.yaml \ - -firmware_path . \ - -output_file tunerstudio/generated/kinetis_prefix.txt \ - -enumInputFile controllers/algo/rusefi_enums.h \ - -enumInputFile config/boards/kinetis/rusefi_hw_enums.h - -[ $? -eq 0 ] || { echo "ERROR generating TunerStudio config for kinetis"; exit 1; } - java \ -DSystemOut.name=gen_config_kinetis \ -Drusefi.generator.lazyfile.enabled=true \ @@ -44,7 +32,8 @@ java \ -signature tunerstudio/generated/signature_kin.txt \ -signature_destination controllers/generated/signature_kin.h \ -enumInputFile controllers/algo/rusefi_enums.h \ - -prepend config/boards/kinetis/config/rusefi_config_kinetis.txt \ + -enumInputFile controllers/algo/rusefi_hw_enums.h \ + -board kinetis \ -prepend config/boards/kinetis/config/tunerstudio/generated/kinetis_prefix.txt [ $? -eq 0 ] || { echo "ERROR generating TunerStudio config for kinetis"; exit 1; } diff --git a/firmware/config/boards/kinetis/mapping.yaml b/firmware/config/boards/kinetis/mapping.yaml deleted file mode 100644 index d6f6d941e3..0000000000 --- a/firmware/config/boards/kinetis/mapping.yaml +++ /dev/null @@ -1,7 +0,0 @@ -# TODO if anyone would be interested - -#outputs: -# GPIOB_7: "Injector 3Z" - -#analog_inputs: -# EFI_ADC_0: "Analog 3O" \ No newline at end of file diff --git a/firmware/config/boards/microrusefi/connectors/J2.yaml b/firmware/config/boards/microrusefi/connectors/J2.yaml new file mode 100644 index 0000000000..d4803da393 --- /dev/null +++ b/firmware/config/boards/microrusefi/connectors/J2.yaml @@ -0,0 +1,24 @@ +pins: + - pin: 3 + id: GPIOB_8 + class: outputs + function: I2C1_SCL or CAN1_RX + ts_name: AUX J2 PB8 + + - pin: 6 + id: GPIOB_9 + class: outputs + function: I2C1_SDA or CAN1_TX + ts_name: AUX J2 PB9 + + - pin: 10 + id: GPIOC_12 + class: outputs + function: SPI3_MOSI or USART3_CK or UART5_TX + ts_name: AUX J2 PC12 + + - pin: 7 + id: GPIOA_15 + class: outputs + function: SPI3_NSS (Chip Select) + ts_name: AUX J2 PA15 diff --git a/firmware/config/boards/microrusefi/connectors/main.yaml b/firmware/config/boards/microrusefi/connectors/main.yaml new file mode 100644 index 0000000000..72733e996f --- /dev/null +++ b/firmware/config/boards/microrusefi/connectors/main.yaml @@ -0,0 +1,270 @@ +# +# microRusEfi board +# https://github.com/rusefi/rusefi/wiki/Hardware_microRusEfi_wiring +# + +pins: + - pin: 1 + id: EFI_ADC_11 + class: analog_inputs + color: white right + function: 12V Supply from main relay output, see also pin #29 + ts_name: Battery Sense + type: 12V + + # default Idle Air Control TLE8888 high current low side: VVT2 TLE8888_OUT5 + - pin: 3 + id: TLE8888_PIN_5 + class: outputs + color: white + function: Idle solenoid + ts_name: 3 - Lowside 2 + type: ls + + # default VVT TLE8888 high current low side: VVT1 TLE8888_OUT6 + - pin: 7 + id: TLE8888_PIN_6 + class: outputs + color: black + function: VVT + ts_name: 7 - Lowside 1 + type: ls + + # TC4427 ignition outputs (5v) + - pin: 9 + id: GPIOD_4 + class: outputs + color: dark blue + function: Ignition 1 + ts_name: 9 - Ignition 1 + type: ign + + - pin: 10 + id: GPIOD_3 + class: outputs + color: dark blue + function: Ignition 2 + ts_name: 10 - Ignition 2 + type: ign + + - pin: 11 + id: GPIOD_2 + class: outputs + color: dark blue + function: Ignition 3 + ts_name: 11 - Ignition 3 + type: ign + + - pin: 12 + id: GPIOD_1 + class: outputs + color: dark blue + function: Ignition 4 + ts_name: 12 - Ignition 4 + type: ign + + - pin: 13 + id: GPIOD_6 + class: outputs + color: yellow + function: Alternator (see JP2 jumper note) + ts_name: 13 - GP Out 6 + type: gp_high + + # TC4427 general purpose output (selectable 5v/12v) + - pin: 14 + id: GPIOD_7 + class: outputs + color: yellow + function: (see JP2 jumper note) + ts_name: 14 - GP Out 5 + type: gp_high + + - pin: 18 + id: [GPIOA_0, EFI_ADC_0] + class: [switch_inputs, analog_inputs] + color: red + function: CLT sensor + ts_name: 18 - AN temp 1 + type: at + + - pin: 19 + id: [GPIOC_2, EFI_ADC_12] + class: [switch_inputs, analog_inputs] + color: red + function: Starting from version 0.5.0 this pin can be used as 5V input for USB connection through main connector (No need to open case to access micro-USB connector) + ts_name: 19 - AN volt 4 + type: av + + - pin: 20 + id: [GPIOC_3, EFI_ADC_13] + class: [switch_inputs, analog_inputs] + color: red left + function: Throttle position sensor (TPS) + ts_name: 20 - AN volt 5 + type: av + + - pin: 22 + id: [GPIOA_3, EFI_ADC_3] + class: [switch_inputs, analog_inputs] + color: dark green + ts_name: 22 - AN temp 4 + type: at + + - pin: 23 + id: [GPIOA_1, EFI_ADC_1] + class: [switch_inputs, analog_inputs] + color: dark green + function: IAT sensor + ts_name: 23 - AN temp 2 + type: at + + - pin: 24 + id: [GPIOA_2, EFI_ADC_2] + class: [switch_inputs, analog_inputs] + color: dark green + ts_name: 24 - AN temp 3 + type: at + + # RC filter input for hall + - pin: 25 + id: [GPIOA_5, GPIOA_5] + class: [event_inputs, switch_inputs] + color: light blue right + ts_name: 25 - Hall Cam + type: hall + + - pin: 26 + id: [GPIOA_6, EFI_ADC_6] + class: [switch_inputs, analog_inputs] + color: light blue + ts_name: 26 - AN volt 2 + type: av + + - pin: 27 + id: [GPIOC_0, EFI_ADC_10] + class: [switch_inputs, analog_inputs] + color: light blue + function: MAP sensor + ts_name: 27 - AN volt 1 + type: av + + - pin: 28 + id: [GPIOA_4, EFI_ADC_4] + class: [switch_inputs, analog_inputs] + color: light blue left + ts_name: 28 - AN volt 10 + type: av + + - pin: 30 + id: [GPIOC_5, EFI_ADC_15] + class: [switch_inputs, analog_inputs] + color: pink + ts_name: 30 - AN volt 7 + type: av + + - pin: 31 + id: [GPIOA_7, EFI_ADC_7] + class: [switch_inputs, analog_inputs] + color: pink + function: Throttle Pedal Position Sensor (PPS) + ts_name: 31 - AN volt 3 + type: av + + - pin: 32 + id: [GPIOC_4, EFI_ADC_14] + class: [switch_inputs, analog_inputs] + color: pink + function: External wideband O2 sensor + ts_name: 32 - AN volt 6 + type: av + + # TLE8888 half bridges (pushpull, lowside, or high-low) TLE8888_OUT23 + - pin: 33 + id: TLE8888_PIN_23 + class: outputs + color: orange right + function: (IDLE stepper coil 2+) + ts_name: 33 - GP Out 3 + type: [gp_low, gp_pp] + + # TLE8888 half bridges (pushpull, lowside, or high-low) TLE8888_OUT22#89 + - pin: 34 + id: TLE8888_PIN_22 + class: outputs + color: orange + function: Fan relay (IDLE stepper coil 1-) + ts_name: 34 - GP Out 2 + type: [gp_low, gp_pp] + + # TLE8888 half bridges (pushpull, lowside, or high-low) TLE8888_OUT21#91 + - pin: 35 + id: TLE8888_PIN_21 + class: outputs + color: orange + function: Fuel pump relay (IDLE stepper coil 1+) + ts_name: 35 - GP Out 1 + type: [gp_low, gp_pp] + + - pin: 36 + id: [GPIOB_0, EFI_ADC_8] + class: [switch_inputs, analog_inputs] + color: orange left + ts_name: 36 - AN volt 8 + type: av + + - pin: 37 + id: TLE8888_PIN_1 + class: outputs + color: grey right + function: Injector 1 + ts_name: 37 - Injector 1 + type: inj + + - pin: 38 + id: TLE8888_PIN_2 + class: outputs + color: grey + function: Injector 2 + ts_name: 38 - Injector 2 + type: inj + + - pin: 40 + id: [GPIOB_1, EFI_ADC_9] + class: [switch_inputs, analog_inputs] + color: grey + ts_name: 40 - AN volt 9 + type: av + + - pin: 41 + id: TLE8888_PIN_3 + class: outputs + color: brown right + function: Injector 3 + ts_name: 41 - Injector 3 + type: inj + + - pin: 42 + id: TLE8888_PIN_4 + class: outputs + color: brown + function: Injector 4 + ts_name: 42 - Injector 4 + type: inj + + # TLE8888 half bridges (pushpull, lowside, or high-low) TLE8888_OUT24 + - pin: 43 + id: TLE8888_PIN_24 + class: outputs + color: brown + function: (IDLE stepper coil 2+) + ts_name: 43 - GP Out 4 + type: [gp_low, gp_pp] + + - pin: 45 + id: GPIOC_6 + class: event_inputs + color: light green right + function: Crank VR+/hall + ts_name: 45 - VR/Hall Crank + type: vr hall diff --git a/firmware/config/boards/microrusefi/connectors/pads.yaml b/firmware/config/boards/microrusefi/connectors/pads.yaml new file mode 100644 index 0000000000..1fb382e131 --- /dev/null +++ b/firmware/config/boards/microrusefi/connectors/pads.yaml @@ -0,0 +1,42 @@ +pins: + - pin: J6 + id: GPIOE_0 + class: outputs + ts_name: AUX J6 PE0 + + - pin: J10 + id: GPIOE_6 + class: outputs + function: TIM9_CH2 + ts_name: AUX J10 PE6 + + - pin: J11 + id: GPIOE_5 + class: outputs + function: TIM9_CH1 + ts_name: AUX J11 PE5 + + - pin: J18 + id: GPIOB_7 + class: outputs + ts_name: AUX J18 PB7 + + - pin: AV6 + id: GPIOC_4 + class: outputs + ts_name: AUX AV6 reuse + + - pin: AV8 + id: GPIOB_0 + class: outputs + ts_name: AUX AV8 reuse + + - pin: AV9 + id: GPIOB_1 + class: outputs + ts_name: AUX AV9 reuse + + - pin: AV10 + id: GPIOA_4 + class: outputs + ts_name: AUX AV10 reuse diff --git a/firmware/config/boards/microrusefi/mapping.yaml b/firmware/config/boards/microrusefi/mapping.yaml deleted file mode 100644 index 3b059dd115..0000000000 --- a/firmware/config/boards/microrusefi/mapping.yaml +++ /dev/null @@ -1,124 +0,0 @@ -# -# microRusEfi board -# https://github.com/rusefi/rusefi/wiki/Hardware_microRusEfi_wiring -# - -outputs: - # TLE8888 injector channels - TLE8888_PIN_1: "37 - Injector 1" - TLE8888_PIN_2: "38 - Injector 2" - TLE8888_PIN_3: "41 - Injector 3" - TLE8888_PIN_4: "42 - Injector 4" - # TC4427 ignition outputs (5v) - GPIOD_4: "9 - Ignition 1" - GPIOD_3: "10 - Ignition 2" - GPIOD_2: "11 - Ignition 3" - GPIOD_1: "12 - Ignition 4" - # TC4427 general purpose output (selectable 5v/12v) - GPIOD_7: "14 - GP Out 5" - GPIOD_6: "13 - GP Out 6" - - # default VVT TLE8888 high current low side: VVT1 TLE8888_OUT6 - TLE8888_PIN_6: "7 - Lowside 1" - # default Idle Air Control TLE8888 high current low side: VVT2 TLE8888_OUT5 - TLE8888_PIN_5: "3 - Lowside 2" - - # TLE8888 half bridges (pushpull, lowside, or high-low) TLE8888_OUT21#91 - TLE8888_PIN_21: "35 - GP Out 1" - # TLE8888 half bridges (pushpull, lowside, or high-low) TLE8888_OUT22#89 - TLE8888_PIN_22: "34 - GP Out 2" - # TLE8888 half bridges (pushpull, lowside, or high-low) TLE8888_OUT23 - TLE8888_PIN_23: "33 - GP Out 3" - # TLE8888 half bridges (pushpull, lowside, or high-low) TLE8888_OUT24 - TLE8888_PIN_24: "43 - GP Out 4" - - # J2 - GPIOA_15: "AUX J2 PA15" - GPIOB_8: "AUX J2 PB8" - GPIOB_9: "AUX J2 PB9" - GPIOC_12: "AUX J2 PC12" - GPIOE_0: "AUX J6 PE0" - GPIOE_6: "AUX J10 PE6" - GPIOE_5: "AUX J11 PE5" - GPIOB_7: "AUX J18 PB7" - - GPIOB_0: "AUX AV8 reuse" - GPIOB_1: "AUX AV9 reuse" - GPIOA_4: "AUX AV10 reuse" - GPIOC_4: "AUX AV6 reuse" - - - # Dual purpose input/output -# TLE8888_PIN_12: "AV6 outmode" -# TLE8888_PIN_11: "AV8 outmode" -# TLE8888_PIN_10: "AV9 outmode" -# TLE8888_PIN_13: "AV10 outmode" - - - - -event_inputs: - # RC filter input for hall - GPIOA_5: "25 - Hall Cam" - # TLE8888 VR/hall conditioner - GPIOC_6: "45 - VR/Hall Crank" - -switch_inputs: - GPIOA_0: "18 - AN temp 1" - GPIOA_1: "23 - AN temp 2" - GPIOA_2: "24 - AN temp 3" - GPIOA_3: "22 - AN temp 4" - GPIOA_4: "28 - AN volt 10" - - # RC filter input for hall - GPIOA_5: "25 - Hall Cam" - - GPIOA_6: "26 - AN volt 2" - GPIOA_7: "31 - AN volt 3" - GPIOB_0: "36 - AN volt 8" - GPIOB_1: "40 - AN volt 9" - GPIOC_0: "27 - AN volt 1" - # GPIOC_1: Skipped - battery sense - GPIOC_2: "19 - AN volt 4" - GPIOC_3: "20 - AN volt 5" - GPIOC_4: "32 - AN volt 6" - GPIOC_5: "30 - AN volt 7" - -analog_inputs: - # PA0 CLT - EFI_ADC_0: "18 - AN temp 1" - - # PA1 IAT - EFI_ADC_1: "23 - AN temp 2" - - # PA2 - EFI_ADC_2: "24 - AN temp 3" - # PA3 - EFI_ADC_3: "22 - AN temp 4" - # PA4 - also AUX REUSE - EFI_ADC_4: "28 - AN volt 10" - - # PA6 pull-down R31 - EFI_ADC_6: "26 - AN volt 2" - - # PA7 - usually PPS Pedal Position Sensor - EFI_ADC_7: "31 - AN volt 3" - # PB0 - also AUX REUSE - EFI_ADC_8: "36 - AN volt 8" - # PB1 - also AUX REUSE - EFI_ADC_9: "40 - AN volt 9" - - # PC0 MAP - EFI_ADC_10: "27 - AN volt 1" - # PC1 - EFI_ADC_11: "Battery Sense" - # PC2 pull-down R131 - EFI_ADC_12: "19 - AN volt 4" - - # PC3 TPS pull-down R41 - EFI_ADC_13: "20 - AN volt 5" - - # PC4 - also AUX REUSE - EFI_ADC_14: "32 - AN volt 6" - # PC5 - EFI_ADC_15: "30 - AN volt 7" diff --git a/firmware/config/boards/prometheus/mapping.yaml b/firmware/config/boards/prometheus/mapping.yaml deleted file mode 100644 index 5f9fcc201a..0000000000 --- a/firmware/config/boards/prometheus/mapping.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# TODO if anyone would be interested -# https://github.com/andreika-git/prometheus/raw/master/hardware/prometheus-wiring-diagram.pdf - -outputs: - GPIOB_7: "Injector 3Z" - -analog_inputs: - EFI_ADC_0: "Analog 3O" \ No newline at end of file diff --git a/firmware/config/boards/proteus/connectors/black23.yaml b/firmware/config/boards/proteus/connectors/black23.yaml new file mode 100644 index 0000000000..7c80057ba3 --- /dev/null +++ b/firmware/config/boards/proteus/connectors/black23.yaml @@ -0,0 +1,118 @@ +pins: + - pin: 1 + id: [GPIOE_11, GPIOE_11] + class: [event_inputs, switch_inputs] + function: Digital trigger/switch input + ts_name: Digital 2 + type: din + + - pin: 2 + id: [GPIOE_12, GPIOE_12] + class: [event_inputs, switch_inputs] + function: Digital trigger/switch input + ts_name: Digital 3 + type: din + + - pin: 3 + id: [GPIOE_13, GPIOE_13] + class: [event_inputs, switch_inputs] + function: Digital trigger/switch input + ts_name: Digital 4 + type: din + + - pin: 4 + function: Variable Reluctance #2 positive + type: vr + + - id: GPIOE_8 + class: event_inputs + ts_name: VR 2 + + - pin: 5 + function: Variable Reluctance #1 positive + type: vr + + - id: GPIOE_7 + class: event_inputs + ts_name: VR 1 + + - pin: 6 + function: ETB 1 negative + type: etb + + - pin: 7 + function: ETB 1 positive + type: etb + + - pin: 8 + function: ETB 2 negative + type: etb + + - pin: 9 + id: [GPIOE_14, GPIOE_14] + class: [event_inputs, switch_inputs] + function: Digital trigger/switch input + ts_name: Digital 5 + type: din + + - pin: 10 + id: [GPIOC_6, GPIOC_6] + class: [event_inputs, switch_inputs] + function: Digital trigger/switch input + ts_name: Digital 1 + type: din + + - pin: 11 + id: [GPIOE_15, GPIOE_15] + class: [event_inputs, switch_inputs] + function: Digital trigger/switch input + ts_name: Digital 6 + type: din + + - pin: 12 + function: Variable Reluctance #2 negative + type: vr + + - pin: 13 + function: Variable Reluctance #1 negative + type: vr + + - pin: 14 + function: Reserved For Future Use + + - pin: 15 + function: ETB 2 positive + type: etb + + - pin: 16 + function: CAN bus low + type: can + + - pin: 17 + function: CAN bus high + type: can + + - pin: 18 + id: EFI_ADC_7 + class: analog_inputs + ts_name: Battery Sense + function: Ignition power / ECU power source. Connect this pin to the output of your ignition switch. + type: 12v + + - pin: 19 + function: Power GND + type: gnd + + - pin: 20 + function: Power GND + type: gnd + + - pin: 21 + function: Reserved For Future Use + + - pin: 22 + function: Reserved For Future Use + + - pin: 23 + function: Power supply from main relay. Connect this pin to the output of the car's main relay that also powers injectors, coils, etc. Supplies power to electronic throttle drivers and high side outputs.### + type: 12v diff --git a/firmware/config/boards/proteus/connectors/black35.yaml b/firmware/config/boards/proteus/connectors/black35.yaml new file mode 100644 index 0000000000..84a6b744d6 --- /dev/null +++ b/firmware/config/boards/proteus/connectors/black35.yaml @@ -0,0 +1,237 @@ +pins: + - pin: 1 + id: GPIOA_8 + function: output + class: outputs + ts_name: Highside 2 + type: hs + + - pin: 2 + id: GPIOA_9 + function: output + class: outputs + ts_name: Highside 1 + type: hs + + - pin: 3 + id: GPIOD_7 + function: Injector #1 + class: outputs + ts_name: Lowside 1 + type: ls + + - pin: 4 + id: GPIOG_10 + function: Injector #3 + class: outputs + ts_name: Lowside 3 + type: ls + + - pin: 5 + id: GPIOG_12 + function: Injector #5 + class: outputs + ts_name: Lowside 5 + type: ls + + - pin: 6 + id: GPIOG_13 + function: Injector #6 + class: outputs + ts_name: Lowside 6 + type: ls + + - pin: 7 + id: GPIOG_14 + function: Injector #7 + class: outputs + ts_name: Lowside 7 + type: ls + + - pin: 8 + id: GPIOB_5 + function: Injector #9 + class: outputs + ts_name: Lowside 9 + type: ls + + - pin: 9 + id: GPIOB_7 + function: Injector #11 + class: outputs + ts_name: Lowside 11 + type: ls + + - pin: 10 + id: GPIOB_9 + function: main relay + class: outputs + ts_name: Lowside 13 + type: ls + + - pin: 11 + id: GPIOE_0 + function: Lowside output + class: outputs + ts_name: Lowside 14 + type: ls + + - pin: 12 + id: GPIOE_1 + function: radiator fan relay + class: outputs + ts_name: Lowside 15 + type: ls + + - pin: 13 + id: GPIOD_15 + function: output + class: outputs + ts_name: Highside 3 + type: hs + + - pin: 14 + id: GPIOD_14 + function: output + class: outputs + ts_name: Highside 4 + type: hs + + - pin: 15 + id: GPIOG_9 + function: Injector #2 + class: outputs + ts_name: Lowside 2 + type: ls + + - pin: 16 + id: GPIOG_11 + function: Injector #4 + class: outputs + ts_name: Lowside 4 + type: ls + + - pin: 17 + function: Power GND + type: gnd + + - pin: 18 + function: Power GND + type: gnd + + - pin: 19 + id: GPIOB_4 + function: Injector #8 + class: outputs + ts_name: Lowside 8 + type: ls + + - pin: 20 + id: GPIOB_6 + function: Injector #10 + class: outputs + ts_name: Lowside 10 + type: ls + + - pin: 21 + id: GPIOB_8 + function: Injector #12 + class: outputs + ts_name: Lowside 12 + type: ls + + - pin: 22 + id: GPIOC_9 + function: Ignition cylinder 3 + class: outputs + ts_name: Ign 3 + type: hl + + - pin: 23 + id: GPIOE_2 + function: Fuel Pump + class: outputs + ts_name: Lowside 16 + type: ls + + - pin: 24 + function: Power GND + type: gnd + + - pin: 25 + id: GPIOG_2 + function: Ignition cylinder 12 + class: outputs + ts_name: Ign 12 + type: hl + + - pin: 26 + id: GPIOG_3 + function: Ignition cylinder 11 + class: outputs + ts_name: Ign 11 + type: hl + + - pin: 27 + id: GPIOG_4 + function: Ignition cylinder 10 + class: outputs + ts_name: Ign 10 + type: hl + + - pin: 28 + id: GPIOG_5 + function: Ignition cylinder 9 + class: outputs + ts_name: Ign 9 + type: hl + + - pin: 29 + id: GPIOG_6 + function: Ignition cylinder 8 + class: outputs + ts_name: Ign 8 + type: hl + + - pin: 30 + id: GPIOG_7 + function: Ignition cylinder 7 + class: outputs + ts_name: Ign 7 + type: hl + + - pin: 31 + id: GPIOG_8 + function: Ignition cylinder 6 + class: outputs + ts_name: Ign 6 + type: hl + + - pin: 32 + id: GPIOC_7 + function: Ignition cylinder 5 + class: outputs + ts_name: Ign 5 + type: hl + + - pin: 33 + id: GPIOC_8 + function: Ignition cylinder 4 + class: outputs + ts_name: Ign 4 + type: hl + + - pin: 34 + id: GPIOD_3 + function: Ignition cylinder 2 + class: outputs + ts_name: Ign 2 + type: hl + + - pin: 35 + id: GPIOD_4 + function: Ignition cylinder 1 + class: outputs + ts_name: Ign 1 + type: hl + diff --git a/firmware/config/boards/proteus/connectors/white35.yaml b/firmware/config/boards/proteus/connectors/white35.yaml new file mode 100644 index 0000000000..e215254b80 --- /dev/null +++ b/firmware/config/boards/proteus/connectors/white35.yaml @@ -0,0 +1,183 @@ +pins: + - pin: 1 + function: Sensor GND + type: sgnd + + - pin: 2 + function: Sensor GND + type: sgnd + + - pin: 3 + function: Sensor GND + type: sgnd + + - pin: 4 + function: Sensor GND + type: sgnd + + - pin: 5 + function: Sensor GND + type: sgnd + + - pin: 6 + function: Sensor GND + type: sgnd + + - pin: 7 + function: Sensor GND + type: sgnd + + - pin: 8 + function: Sensor GND + type: sgnd + + - pin: 9 + function: Analog Voltage +5 supply #1 + type: 5v + + - pin: 10 + function: Analog Voltage +5 supply #2 + type: 5v + + - pin: 11 + function: 12V protected output for sensors + type: 12v + + - pin: 12 + function: 12V protected output for sensors + type: 12v + + - pin: 13 + id: [GPIOC_0, EFI_ADC_10] + class: [switch_inputs, analog_inputs] + ts_name: Analog Volt 1 + function: Analog Voltage Input #1 + type: av + + - pin: 14 + id: [GPIOC_2, EFI_ADC_12] + class: [switch_inputs, analog_inputs] + ts_name: Analog Volt 3 + function: Analog Voltage Input #3 + type: av + + - pin: 15 + id: [GPIOA_0, EFI_ADC_0] + class: [switch_inputs, analog_inputs] + ts_name: Analog Volt 5 + function: Analog Voltage Input #5 + type: av + + - pin: 16 + id: [GPIOA_2, EFI_ADC_2] + class: [switch_inputs, analog_inputs] + ts_name: Analog Volt 7 + function: Analog Voltage Input #7 + type: av + + - pin: 17 + id: [GPIOA_4, EFI_ADC_4] + class: [switch_inputs, analog_inputs] + ts_name: Analog Volt 9 + function: Analog Voltage Input #9 + type: av + + - pin: 18 + id: [GPIOA_6, EFI_ADC_6] + class: [switch_inputs, analog_inputs] + ts_name: Analog Volt 11 + function: Analog Voltage Input #11 + type: av + + - pin: 19 + id: [GPIOC_4, EFI_ADC_14] + class: [switch_inputs, analog_inputs] + ts_name: Analog Temp 1 + function: Analog Thermistor Input #1 + type: at + + - pin: 20 + id: [GPIOB_0, EFI_ADC_8] + class: [switch_inputs, analog_inputs] + ts_name: Analog Temp 3 + function: Analog Thermistor Input #3 + type: at + + - pin: 21 + function: Analog Voltage +5 supply #1 + type: 5v + + - pin: 22 + function: Analog Voltage +5 supply #2 + type: 5v + + - pin: 23 + function: Sensor GND + type: sgnd + + - pin: 24 + id: [GPIOC_1, EFI_ADC_11] + class: [switch_inputs, analog_inputs] + ts_name: Analog Volt 2 + function: Analog Voltage Input #2 + type: av + + - pin: 25 + id: [GPIOC_3, EFI_ADC_13] + class: [switch_inputs, analog_inputs] + ts_name: Analog Volt 4 + function: Analog Voltage Input #4 + type: av + + - pin: 26 + id: [GPIOA_1, EFI_ADC_1] + class: [switch_inputs, analog_inputs] + ts_name: Analog Volt 6 + function: Analog Voltage Input #6 + type: av + + - pin: 27 + id: [GPIOA_3, EFI_ADC_3] + class: [switch_inputs, analog_inputs] + ts_name: Analog Volt 8 + function: Analog Voltage Input #8 + type: av + + - pin: 28 + id: [GPIOA_5, EFI_ADC_5] + class: [switch_inputs, analog_inputs] + ts_name: Analog Volt 10 + function: Analog Voltage Input #10 + type: av + + - pin: 29 + function: Sensor GND + type: sgnd + + - pin: 30 + id: [GPIOC_5, EFI_ADC_15] + class: [switch_inputs, analog_inputs] + ts_name: Analog Temp 2 + function: Intake air temperature + type: at + + - pin: 31 + id: [GPIOB_1, EFI_ADC_9] + class: [switch_inputs, analog_inputs] + ts_name: Analog Temp 4 + function: Analog Thermistor Input #4 + type: at + + - pin: 32 + function: Analog Voltage +5 supply #1 + type: 5v + + - pin: 33 + function: Analog Voltage +5 supply #2 + type: 5v + + - pin: 34 + function: Knock input 1 on 0.4. Due to a hardware defect, knock hardware can't work on v0.3 :( + + - pin: 35 + function: Knock input 2 on 0.4 diff --git a/firmware/config/boards/proteus/mapping.yaml b/firmware/config/boards/proteus/mapping.yaml deleted file mode 100644 index d639b27fce..0000000000 --- a/firmware/config/boards/proteus/mapping.yaml +++ /dev/null @@ -1,110 +0,0 @@ -# -# proteus board -# https://github.com/rusefi/rusefi/wiki/Hardware-Proteus-Wiring-v03 -# - -outputs: - GPIOD_7: "Lowside 1" # pin 3/black35 - GPIOG_9: "Lowside 2" # pin 15/black35 - GPIOG_10: "Lowside 3" # pin 4/black35 - GPIOG_11: "Lowside 4" # pin 16/black35 - - GPIOG_12: "Lowside 5" # pin 5/black35 - GPIOG_13: "Lowside 6" # pin 6/black35 - GPIOG_14: "Lowside 7" # pin 7/black35 - GPIOB_4: "Lowside 8" # pin 19/black35 - - GPIOB_5: "Lowside 9" # pin 8/black35 - GPIOB_6: "Lowside 10" # pin 20/black35 - GPIOB_7: "Lowside 11" # pin 9/black35 - GPIOB_8: "Lowside 12" # pin 21/black35 - - GPIOB_9: "Lowside 13" # pin 10/black35 - GPIOE_0: "Lowside 14" # pin 11/black35 - GPIOE_1: "Lowside 15" # pin 12/black35 - GPIOE_2: "Lowside 16" # pin 23/black35 - - GPIOD_4: "Ign 1" # pin 35/black35 - GPIOD_3: "Ign 2" # pin 34/black35 - GPIOC_9: "Ign 3" # pin 22/black35 - GPIOC_8: "Ign 4" # pin 33/black35 - GPIOC_7: "Ign 5" # pin 32/black35 - GPIOG_8: "Ign 6" # pin 31/black35 - GPIOG_7: "Ign 7" # pin 30/black35 - GPIOG_6: "Ign 8" # pin 29/black35 - GPIOG_5: "Ign 9" # pin 28/black35 - GPIOG_4: "Ign 10" # pin 27/black35 - GPIOG_3: "Ign 11" # pin 26/black35 - GPIOG_2: "Ign 12" # pin 25/black35 - - GPIOA_9: "Highside 1" # pin 2/black35 - GPIOA_8: "Highside 2" # pin 1/black35 - GPIOD_15: "Highside 3" # pin 13/black35 - GPIOD_14: "Highside 4" # pin 14/black35 - -event_inputs: - GPIOC_6: "Digital 1" # pin 10/black23 - GPIOE_11: "Digital 2" # pin 1/black23 - GPIOE_12: "Digital 3" # pin 2/black23 - GPIOE_13: "Digital 4" # pin 3/black23 - GPIOE_14: "Digital 5" # pin 9/black23 - GPIOE_15: "Digital 6" # pin 11/black23 - GPIOE_7: "VR 1" # pin 5+13/black23 - GPIOE_8: "VR 2" # pin 4+12/black23 - -switch_inputs: - GPIOC_6: "Digital 1" - GPIOE_11: "Digital 2" - GPIOE_12: "Digital 3" - GPIOE_13: "Digital 4" - GPIOE_14: "Digital 5" - GPIOE_15: "Digital 6" - GPIOA_0: "Analog Volt 5" - GPIOA_1: "Analog Volt 6" - GPIOA_2: "Analog Volt 7" - GPIOA_3: "Analog Volt 8" - GPIOA_4: "Analog Volt 9" - GPIOA_5: "Analog Volt 10" - GPIOA_6: "Analog Volt 11" - GPIOB_0: "Analog Temp 3" - GPIOB_1: "Analog Temp 4" - GPIOC_0: "Analog Volt 1" - GPIOC_1: "Analog Volt 2" - GPIOC_2: "Analog Volt 3" - GPIOC_3: "Analog Volt 4" - GPIOC_4: "Analog Temp 1" - GPIOC_5: "Analog Temp 2" - -analog_inputs: - # PA0 - EFI_ADC_0: "Analog Volt 5" - # PA1 - EFI_ADC_1: "Analog Volt 6" - # PA2 - EFI_ADC_2: "Analog Volt 7" - # PA3 - EFI_ADC_3: "Analog Volt 8" - # PA4 - pin #17 - EFI_ADC_4: "Analog Volt 9" - # PA5 - pin #28 WBO AFR - EFI_ADC_5: "Analog Volt 10" - # PA6 - pin #18 - EFI_ADC_6: "Analog Volt 11" - # PA7 - EFI_ADC_7: "Battery Sense" - # CLT, PB0, pin #20 - EFI_ADC_8: "Analog Temp 3" - # PB1, pin #31 - EFI_ADC_9: "Analog Temp 4" - # MAP = Analog volt 1 = PC0, pin #13 - EFI_ADC_10: "Analog Volt 1" - # TPS = Analog volt 2 = PC1 - EFI_ADC_11: "Analog Volt 2" - # PC2 - EFI_ADC_12: "Analog Volt 3" - # PC3 - EFI_ADC_13: "Analog Volt 4" - # PC4 - EFI_ADC_14: "Analog Temp 1" - # IAT = Analog Temp 2 = PC5 - EFI_ADC_15: "Analog Temp 2" diff --git a/firmware/config/boards/skeleton/connectors/main.yaml b/firmware/config/boards/skeleton/connectors/main.yaml new file mode 100644 index 0000000000..72733e996f --- /dev/null +++ b/firmware/config/boards/skeleton/connectors/main.yaml @@ -0,0 +1,270 @@ +# +# microRusEfi board +# https://github.com/rusefi/rusefi/wiki/Hardware_microRusEfi_wiring +# + +pins: + - pin: 1 + id: EFI_ADC_11 + class: analog_inputs + color: white right + function: 12V Supply from main relay output, see also pin #29 + ts_name: Battery Sense + type: 12V + + # default Idle Air Control TLE8888 high current low side: VVT2 TLE8888_OUT5 + - pin: 3 + id: TLE8888_PIN_5 + class: outputs + color: white + function: Idle solenoid + ts_name: 3 - Lowside 2 + type: ls + + # default VVT TLE8888 high current low side: VVT1 TLE8888_OUT6 + - pin: 7 + id: TLE8888_PIN_6 + class: outputs + color: black + function: VVT + ts_name: 7 - Lowside 1 + type: ls + + # TC4427 ignition outputs (5v) + - pin: 9 + id: GPIOD_4 + class: outputs + color: dark blue + function: Ignition 1 + ts_name: 9 - Ignition 1 + type: ign + + - pin: 10 + id: GPIOD_3 + class: outputs + color: dark blue + function: Ignition 2 + ts_name: 10 - Ignition 2 + type: ign + + - pin: 11 + id: GPIOD_2 + class: outputs + color: dark blue + function: Ignition 3 + ts_name: 11 - Ignition 3 + type: ign + + - pin: 12 + id: GPIOD_1 + class: outputs + color: dark blue + function: Ignition 4 + ts_name: 12 - Ignition 4 + type: ign + + - pin: 13 + id: GPIOD_6 + class: outputs + color: yellow + function: Alternator (see JP2 jumper note) + ts_name: 13 - GP Out 6 + type: gp_high + + # TC4427 general purpose output (selectable 5v/12v) + - pin: 14 + id: GPIOD_7 + class: outputs + color: yellow + function: (see JP2 jumper note) + ts_name: 14 - GP Out 5 + type: gp_high + + - pin: 18 + id: [GPIOA_0, EFI_ADC_0] + class: [switch_inputs, analog_inputs] + color: red + function: CLT sensor + ts_name: 18 - AN temp 1 + type: at + + - pin: 19 + id: [GPIOC_2, EFI_ADC_12] + class: [switch_inputs, analog_inputs] + color: red + function: Starting from version 0.5.0 this pin can be used as 5V input for USB connection through main connector (No need to open case to access micro-USB connector) + ts_name: 19 - AN volt 4 + type: av + + - pin: 20 + id: [GPIOC_3, EFI_ADC_13] + class: [switch_inputs, analog_inputs] + color: red left + function: Throttle position sensor (TPS) + ts_name: 20 - AN volt 5 + type: av + + - pin: 22 + id: [GPIOA_3, EFI_ADC_3] + class: [switch_inputs, analog_inputs] + color: dark green + ts_name: 22 - AN temp 4 + type: at + + - pin: 23 + id: [GPIOA_1, EFI_ADC_1] + class: [switch_inputs, analog_inputs] + color: dark green + function: IAT sensor + ts_name: 23 - AN temp 2 + type: at + + - pin: 24 + id: [GPIOA_2, EFI_ADC_2] + class: [switch_inputs, analog_inputs] + color: dark green + ts_name: 24 - AN temp 3 + type: at + + # RC filter input for hall + - pin: 25 + id: [GPIOA_5, GPIOA_5] + class: [event_inputs, switch_inputs] + color: light blue right + ts_name: 25 - Hall Cam + type: hall + + - pin: 26 + id: [GPIOA_6, EFI_ADC_6] + class: [switch_inputs, analog_inputs] + color: light blue + ts_name: 26 - AN volt 2 + type: av + + - pin: 27 + id: [GPIOC_0, EFI_ADC_10] + class: [switch_inputs, analog_inputs] + color: light blue + function: MAP sensor + ts_name: 27 - AN volt 1 + type: av + + - pin: 28 + id: [GPIOA_4, EFI_ADC_4] + class: [switch_inputs, analog_inputs] + color: light blue left + ts_name: 28 - AN volt 10 + type: av + + - pin: 30 + id: [GPIOC_5, EFI_ADC_15] + class: [switch_inputs, analog_inputs] + color: pink + ts_name: 30 - AN volt 7 + type: av + + - pin: 31 + id: [GPIOA_7, EFI_ADC_7] + class: [switch_inputs, analog_inputs] + color: pink + function: Throttle Pedal Position Sensor (PPS) + ts_name: 31 - AN volt 3 + type: av + + - pin: 32 + id: [GPIOC_4, EFI_ADC_14] + class: [switch_inputs, analog_inputs] + color: pink + function: External wideband O2 sensor + ts_name: 32 - AN volt 6 + type: av + + # TLE8888 half bridges (pushpull, lowside, or high-low) TLE8888_OUT23 + - pin: 33 + id: TLE8888_PIN_23 + class: outputs + color: orange right + function: (IDLE stepper coil 2+) + ts_name: 33 - GP Out 3 + type: [gp_low, gp_pp] + + # TLE8888 half bridges (pushpull, lowside, or high-low) TLE8888_OUT22#89 + - pin: 34 + id: TLE8888_PIN_22 + class: outputs + color: orange + function: Fan relay (IDLE stepper coil 1-) + ts_name: 34 - GP Out 2 + type: [gp_low, gp_pp] + + # TLE8888 half bridges (pushpull, lowside, or high-low) TLE8888_OUT21#91 + - pin: 35 + id: TLE8888_PIN_21 + class: outputs + color: orange + function: Fuel pump relay (IDLE stepper coil 1+) + ts_name: 35 - GP Out 1 + type: [gp_low, gp_pp] + + - pin: 36 + id: [GPIOB_0, EFI_ADC_8] + class: [switch_inputs, analog_inputs] + color: orange left + ts_name: 36 - AN volt 8 + type: av + + - pin: 37 + id: TLE8888_PIN_1 + class: outputs + color: grey right + function: Injector 1 + ts_name: 37 - Injector 1 + type: inj + + - pin: 38 + id: TLE8888_PIN_2 + class: outputs + color: grey + function: Injector 2 + ts_name: 38 - Injector 2 + type: inj + + - pin: 40 + id: [GPIOB_1, EFI_ADC_9] + class: [switch_inputs, analog_inputs] + color: grey + ts_name: 40 - AN volt 9 + type: av + + - pin: 41 + id: TLE8888_PIN_3 + class: outputs + color: brown right + function: Injector 3 + ts_name: 41 - Injector 3 + type: inj + + - pin: 42 + id: TLE8888_PIN_4 + class: outputs + color: brown + function: Injector 4 + ts_name: 42 - Injector 4 + type: inj + + # TLE8888 half bridges (pushpull, lowside, or high-low) TLE8888_OUT24 + - pin: 43 + id: TLE8888_PIN_24 + class: outputs + color: brown + function: (IDLE stepper coil 2+) + ts_name: 43 - GP Out 4 + type: [gp_low, gp_pp] + + - pin: 45 + id: GPIOC_6 + class: event_inputs + color: light green right + function: Crank VR+/hall + ts_name: 45 - VR/Hall Crank + type: vr hall diff --git a/firmware/config/boards/skeleton/mapping.yaml b/firmware/config/boards/skeleton/mapping.yaml deleted file mode 100644 index 94256d15e3..0000000000 --- a/firmware/config/boards/skeleton/mapping.yaml +++ /dev/null @@ -1,54 +0,0 @@ -outputs: - # TLE8888 injector channels - GPIOE_14: "37 - Injector 1" - GPIOE_13: "38 - Injector 2" - GPIOE_12: "41 - Injector 3" - GPIOE_11: "42 - Injector 4" - # TC4427 ignition outputs (5v) - GPIOD_4: "9 - Ignition 1" - GPIOD_3: "10 - Ignition 2" - GPIOD_2: "11 - Ignition 3" - GPIOD_1: "12 - Ignition 4" - # TC4427 general purpose output (selectable 5v/12v) - GPIOD_7: "14 - GP Out 5" - GPIOD_6: "13 - GP Out 6" - - # TLE8888 high current low side: VVT1 TLE8888_IN10 / TLE8888_OUT6 - GPIOE_9: "7 - Lowside 1" - # TLE8888 high current low side: VVT2 TLE8888_IN9 / TLE8888_OUT5 - GPIOE_10: "3 - Lowside 2" - - # TLE8888 half bridges (pushpull, lowside, or high-low) TLE8888_IN11 / TLE8888_OUT21 - GPIOE_8: "35 - GP Out 1" - # TLE8888 half bridges (pushpull, lowside, or high-low) IN? / TLE8888_OUT22 - # this should work but it does not GPIOE_7: "34 - GP Out 2" - TLE8888_PIN_22: "34 - GP Out 2" - TLE8888_PIN_23: "33 - GP Out 3" - TLE8888_PIN_24: "43 - GP Out 4" - -event_inputs: - # RC filter input for hall - GPIOA_5: "25 - Hall Cam" - # TLE8888 VR/hall conditioner - GPIOC_6: "45 - VR/Hall Crank" - -switch_inputs: - GPIOE_10: "Brake Switch" - GPIOG_1: "Clutch Switch" - -analog_inputs: - EFI_ADC_0: "18 - AN temp 1" - EFI_ADC_1: "23 - AN temp 2" - EFI_ADC_2: "24 - AN temp 3" - EFI_ADC_3: "22 - AN temp 4" - EFI_ADC_4: "28 - AN volt 10" - EFI_ADC_6: "26 - AN volt 2" - EFI_ADC_7: "31 - AN volt 3" - EFI_ADC_8: "36 - AN volt 8" - EFI_ADC_9: "40 - AN volt 9" - EFI_ADC_10: "27 - AN volt 1" - EFI_ADC_11: "Battery Sense" - EFI_ADC_12: "19 - AN volt 4" - EFI_ADC_13: "20 - AN volt 5" - EFI_ADC_14: "32 - AN volt 6" - EFI_ADC_15: "30 - AN volt 7" diff --git a/firmware/gen_config_board.sh b/firmware/gen_config_board.sh index ddf4851b2b..578d18cd35 100755 --- a/firmware/gen_config_board.sh +++ b/firmware/gen_config_board.sh @@ -19,18 +19,6 @@ echo "BOARDNAME=${BOARDNAME} SHORT_BOARDNAME=${SHORT_BOARDNAME}" bash gen_signature.sh ${SHORT_BOARDNAME} -java -DSystemOut.name=gen_config_board \ - -Drusefi.generator.lazyfile.enabled=true \ - -cp ../java_tools/ConfigDefinition.jar \ - com.rusefi.board_generator.BoardReader \ - -yaml config/boards/${BOARDNAME}/mapping.yaml \ - -firmware_path . \ - -output_file tunerstudio/generated/${BOARDNAME}_prefix.txt \ - -enumInputFile controllers/algo/rusefi_enums.h \ - -enumInputFile controllers/algo/rusefi_hw_enums.h - -[ $? -eq 0 ] || { echo "ERROR generating TunerStudio config for ${BOARDNAME}"; exit 1; } - # work in progress: migrating to rusefi_${BUNDLE_NAME}.txt java -DSystemOut.name=gen_config_board \ -jar ../java_tools/ConfigDefinition.jar \ @@ -44,7 +32,8 @@ java -DSystemOut.name=gen_config_board \ -signature tunerstudio/generated/signature_${SHORT_BOARDNAME}.txt \ -signature_destination controllers/generated/signature_${SHORT_BOARDNAME}.h \ -enumInputFile controllers/algo/rusefi_enums.h \ - -prepend tunerstudio/generated/${BOARDNAME}_prefix.txt \ + -enumInputFile controllers/algo/rusefi_hw_enums.h \ + -board ${BOARDNAME} \ -prepend config/boards/${BOARDNAME}/prepend.txt [ $? -eq 0 ] || { echo "ERROR generating TunerStudio config for ${BOARDNAME}"; exit 1; } diff --git a/java_tools/ConfigDefinition.jar b/java_tools/ConfigDefinition.jar index b8173d03d3..9187e6c228 100644 Binary files a/java_tools/ConfigDefinition.jar and b/java_tools/ConfigDefinition.jar differ diff --git a/java_tools/configuration_definition/src/com/rusefi/ConfigDefinition.java b/java_tools/configuration_definition/src/com/rusefi/ConfigDefinition.java index 7314104f23..58a45d160d 100644 --- a/java_tools/configuration_definition/src/com/rusefi/ConfigDefinition.java +++ b/java_tools/configuration_definition/src/com/rusefi/ConfigDefinition.java @@ -4,6 +4,8 @@ import com.rusefi.output.*; import com.rusefi.util.IoUtils; import com.rusefi.util.LazyFile; import com.rusefi.util.SystemOut; +import com.rusefi.enum_reader.Value; +import org.yaml.snakeyaml.Yaml; import java.io.*; import java.math.BigInteger; @@ -48,6 +50,7 @@ public class ConfigDefinition { public static final String KEY_CACHE_ZIP_FILE = "-cache_zip_file"; private static final String KEY_SKIP = "-skip"; private static final String KEY_ZERO_INIT = "-initialize_to_zero"; + private static final String KEY_BOARD_NAME = "-board"; public static boolean needZeroInit = true; public static String definitionInputFile = null; @@ -98,6 +101,7 @@ public class ConfigDefinition { String signatureDestination = null; String signaturePrependFile = null; CHeaderConsumer.withC_Defines = true; + File[] yamlFiles = null; // used to update other files List inputFiles = new ArrayList<>(); @@ -188,6 +192,13 @@ public class ConfigDefinition { romRaiderInputFile = inputFilePath + File.separator + ROM_RAIDER_XML_TEMPLATE; inputFiles.add(romRaiderInputFile); break; + case KEY_BOARD_NAME: + String boardName = args[i + 1]; + String dirPath = "./config/boards/" + boardName + "/connectors"; + File dirName = new File(dirPath); + FilenameFilter filter = (f, name) -> name.endsWith(".yaml"); + yamlFiles = dirName.listFiles(filter); + break; } } @@ -242,6 +253,10 @@ public class ConfigDefinition { for (String prependFile : prependFiles) readPrependValues(VariableRegistry.INSTANCE, prependFile); + if (yamlFiles != null) { + processYamls(VariableRegistry.INSTANCE, yamlFiles, state); + } + BufferedReader definitionReader = new BufferedReader(new InputStreamReader(new FileInputStream(definitionInputFile), IoUtils.CHARSET.name())); List destinations = new ArrayList<>(); @@ -325,6 +340,101 @@ public class ConfigDefinition { } } + public static void processYamls(VariableRegistry registry, File[] yamlFiles, ReaderState state) throws IOException { + Map listOutputs = new HashMap<>(); + Map listAnalogInputs = new HashMap<>(); + Map listEventInputs = new HashMap<>(); + Map listSwitchInputs = new HashMap<>(); + for (File yamlFile : yamlFiles) { + processYamlFile(yamlFile, state, listOutputs, listAnalogInputs, listEventInputs, listSwitchInputs); + } + registerPins(listOutputs, "output_pin_e_enum", registry); + registerPins(listAnalogInputs, "adc_channel_e_enum", registry); + registerPins(listEventInputs, "brain_input_pin_e_enum", registry); + registerPins(listSwitchInputs, "switch_input_pin_e_enum", registry); + } + + @SuppressWarnings("unchecked") + private static void processYamlFile(File yamlFile, ReaderState state, + Map listOutputs, + Map listAnalogInputs, + Map listEventInputs, + Map listSwitchInputs) throws IOException { + Yaml yaml = new Yaml(); + Map yamlData = yaml.load(new FileReader(yamlFile)); + List> data = (List>) yamlData.get("pins"); + if (data == null) { + SystemOut.println("Null yaml for " + yamlFile); + return; + } + SystemOut.println(data); + Objects.requireNonNull(data, "data"); + for (Map pin : data) { + if (pin.get("id") instanceof ArrayList) { + for (int i = 0; i < ((ArrayList) pin.get("id")).size(); i++) { + findMatchingEnum((String) ((ArrayList) pin.get("id")).get(i), + (String) pin.get("ts_name"), + (String) ((ArrayList) pin.get("class")).get(i), + state, listOutputs, listAnalogInputs, listEventInputs, listSwitchInputs); + } + } else if (pin.get("id") instanceof String ) { + findMatchingEnum((String) pin.get("id"), (String) pin.get("ts_name"), (String) pin.get("class"), state, listOutputs, listAnalogInputs, listEventInputs, listSwitchInputs); + } + } + } + + private static void registerPins(Map listPins, String outputEnumName, VariableRegistry registry) { + if (listPins == null || listPins.isEmpty()) { + return; + } + StringBuilder sb = new StringBuilder(); + int maxValue = listPins.keySet().stream().max(Integer::compare).get(); + for (int i = 0; i <= maxValue; i++) { + if (sb.length() > 0) + sb.append(","); + + if (listPins.get(i) == null) { + sb.append("\"INVALID\""); + } else { + sb.append("\"" + listPins.get(i) + "\""); + } + } + registry.register(outputEnumName, sb.toString()); + } + + private static void findMatchingEnum(String id, String ts_name, String className, ReaderState state, + Map listOutputs, + Map listAnalogInputs, + Map listEventInputs, + Map listSwitchInputs) { + + switch (className) { + case "outputs": + assignPinName("brain_pin_e", ts_name, id, listOutputs, state, "GPIO_UNASSIGNED"); + break; + case "analog_inputs": + assignPinName("adc_channel_e", ts_name, id, listAnalogInputs, state, "EFI_ADC_NONE"); + break; + case "event_inputs": + assignPinName("brain_pin_e", ts_name, id, listEventInputs, state, "GPIO_UNASSIGNED"); + break; + case "switch_inputs": + assignPinName("brain_pin_e", ts_name, id, listSwitchInputs, state, "GPIO_UNASSIGNED"); + break; + } + } + + private static void assignPinName(String enumName, String ts_name, String id, Map list, ReaderState state, String nothingName) { + Map enumList = state.enumsReader.getEnums().get(enumName); + for(Map.Entry kv : enumList.entrySet()){ + if(kv.getKey().equals(id)){ + list.put(kv.getValue().getIntValue(), ts_name); + } else if (kv.getKey().equals(nothingName)) { + list.put(kv.getValue().getIntValue(), "NONE"); + } + } + } + private static void processTextTemplate(String inputFileName, String outputFileName) throws IOException { SystemOut.println("Reading from " + inputFileName); SystemOut.println("Writing to " + outputFileName); diff --git a/java_tools/configuration_definition/src/com/rusefi/VariableRegistry.java b/java_tools/configuration_definition/src/com/rusefi/VariableRegistry.java index 55114e2169..1b3f966f6e 100644 --- a/java_tools/configuration_definition/src/com/rusefi/VariableRegistry.java +++ b/java_tools/configuration_definition/src/com/rusefi/VariableRegistry.java @@ -1,6 +1,5 @@ package com.rusefi; -import com.rusefi.board_generator.BoardReader; import com.rusefi.enum_reader.Value; import com.rusefi.util.LazyFile; import com.rusefi.util.SystemOut; @@ -64,7 +63,7 @@ public class VariableRegistry { if (sb.length() > 0) sb.append(", "); - String value = valueNameById.getOrDefault(i, BoardReader.INVALID); + String value = valueNameById.getOrDefault(i, "INVALID"); sb.append("\"" + value + "\""); } return sb.toString(); diff --git a/java_tools/configuration_definition/src/com/rusefi/board_generator/BoardReader.java b/java_tools/configuration_definition/src/com/rusefi/board_generator/BoardReader.java deleted file mode 100644 index 4d92a20890..0000000000 --- a/java_tools/configuration_definition/src/com/rusefi/board_generator/BoardReader.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.rusefi.board_generator; - -import com.rusefi.EnumToString; -import com.rusefi.EnumsReader; -import com.rusefi.enum_reader.Value; -import com.rusefi.util.LazyFile; -import com.rusefi.util.Output; -import com.rusefi.util.SystemOut; -import org.yaml.snakeyaml.Yaml; - -import java.io.*; -import java.util.Collection; -import java.util.Map; -import java.util.Objects; - -/** - * This tool read mapping yaml file and produces a .txt file with defines in the rusefi.txt format - * - * This is a lazy to implement mapping as a separate phase of code generation. Technically this could be merged into - * the primary generation to avoid the intermediate file. - */ -public class BoardReader { - public static final String INVALID = "INVALID"; - - private static final String KEY_BOARD_NAME = "-board"; - private static final String YAML_INPUT_NAME = "-yaml"; - private static final String OUTPUT_FILE_NAME = "-output_file"; - private static final String KEY_FIRMWARE_PATH = "-firmware_path"; - - private static final String MAPPING_YAML = "mapping.yaml"; - - public static void main(String[] args) throws IOException { - if (args.length < 2) { - SystemOut.println("Please specify\r\n" - + KEY_BOARD_NAME + " x\r\n" - + KEY_FIRMWARE_PATH + " x\r\n" - ); - return; - } - String firmwarePath = "firmware"; - String yamlInputFile = null; - String outputFileName = null; - EnumsReader enumsReader = new EnumsReader(); - for (int i = 0; i < args.length - 1; i += 2) { - String key = args[i]; - if (key.equals(KEY_BOARD_NAME)) { - String boardName = args[i + 1]; - yamlInputFile = firmwarePath + "/config/boards/" + boardName + "/" + MAPPING_YAML; - } else if (key.equals(OUTPUT_FILE_NAME)) { - outputFileName = args[i + 1]; - } else if (key.equals(YAML_INPUT_NAME)) { - yamlInputFile = args[i + 1]; - } else if (key.equals(KEY_FIRMWARE_PATH)) { - firmwarePath = args[i + 1]; - } else if (key.equals(EnumToString.KEY_ENUM_INPUT_FILE)) { - String inputFile = args[i + 1]; - enumsReader.process(firmwarePath, inputFile); - } - } - - Yaml yaml = new Yaml(); - Map data = yaml.load(new FileReader(yamlInputFile)); - if (data == null) { - SystemOut.println("Null yaml for " + yamlInputFile); - } else { - SystemOut.println(data); - - Output bw = new LazyFile(outputFileName); - - bw.write(processSection(enumsReader, data, "brain_pin_e", "output_pin_e", "outputs", "GPIO_UNASSIGNED")); - bw.write(processSection(enumsReader, data, "adc_channel_e", "adc_channel_e", "analog_inputs", "EFI_ADC_NONE")); - - bw.write(processSection(enumsReader, data, "brain_pin_e", "brain_input_pin_e", "event_inputs", "GPIO_UNASSIGNED")); - bw.write(processSection(enumsReader, data, "brain_pin_e", "switch_input_pin_e", "switch_inputs", "GPIO_UNASSIGNED")); - - bw.close(); - } - SystemOut.close(); - } - - private static String processSection(EnumsReader enumsReader, Map data, String headerEnumName, String outputEnumName, String sectionName, String NOTHING_NAME) { - Objects.requireNonNull(data, "data"); - Map outputs = (Map) data.get(sectionName); - if (outputs == null) - return ""; - - Objects.requireNonNull(data, "enums"); - Map enumMap = enumsReader.getEnums().get(headerEnumName); - Objects.requireNonNull(enumMap, "enum for " + headerEnumName); - SystemOut.println(enumMap.size()); - - StringBuffer sb = new StringBuffer(); - - int maxValue = getMaxValue(enumMap.values()); - - for (int i = 0; i < maxValue; i++) { - if (sb.length() > 0) - sb.append(","); - - String code; - - Value v = findByOrdinal(i, enumMap.values()); - - if (v == null) { - code = INVALID; - } else if (v.getName().equals(NOTHING_NAME)) { - code = "NONE"; - } else if (outputs.containsKey(v.getName())) { - code = (String) outputs.get(v.getName()); - } else { - code = INVALID; - } - sb.append("\"" + code + "\""); - } - - return " #define " + outputEnumName + "_enum " + sb + "\r\n"; - } - - private static int getMaxValue(Collection values) { - int result = -1; - for (Value v : values) { - result = Math.max(result, v.getIntValue()); - } - return result; - } - - private static Value findByOrdinal(int ordinal, Collection values) { - for (Value v : values) { - if (v.getValue().equals(String.valueOf(ordinal))) { - return v; - } - } - return null; - } -}