|Click on our menu buttons immediately below to find MegaSquirt® information quickly:|
- MShift™ TCU
- MShift™ Intro
- GPIO Build Guide for 4L60E
- Base circuits
- GPO1, GPO2, GPO3,
GPO4 (gear LEDs)
- VB1, VB2, VB3, VB4
- PWM1, PWM2, PWM3, PWM4
- GPI1, GPI2, GPI5
(2/4WD, Input2, downshift)
- GPI3 (Temperature)
- GPI4 (Brake sense)
- EGT1, EGT2, EGT3,
EGT4 (non-CAN Load,
line pressure, Input3,
- VR1 (Vehicle
- VR2 (Upshift button)
- Finishing Touches
- Testing your
- External Wiring Guide for 4L60E
- Current Release Code
- User Settings
- βeta Code
- Code Archives
- Purchase a
- Working with the Shift Table
- Solving VSS
- Ports, pins, circuits, connections
- MShift™ Discussion
- Misc. MShift™
- MShift™ sitemap
- Template Project Code
- GPIO Board Intro
MegaShift™ and Spare Port Outputs
As of the 2.120 MShift™ code, the uses of the 'spare ports' has been expanded and simplified1. Code version 5.002+ adds the optional use of the speedo output and PC line pressure output as spare outputs. In addition to certain user spare port conditions, TCC mode for spare port 1, and shift solenoid for spare port 2, all modes have bit-banged pulse width modulation (PWM) (Spare Port 1 & 2) or timer PWM (Spare Port 0).
A dedicated PWM mode has been added for all three spare outputs, and TCC, selective clutch, and shift solenoid modes have been made available on all three spare port outputs.
The PWM settings for the three spare ports are independent. They each have their own:
The user can set the PWM frequencies for spare port 1 and 2 from 30.6 Hertz to 1953 Hertz.
- PWM frequency,
- 12x1 PWM% table for spare ports 1 and 2, 16x9 PWM table for spare port 0,
- indices, and
- OFF values.
The spare ports use pulse width modulation is ALL modes. The spareport's PWM table is used whenever the output is ON, so the controller reports the current PWM%. If you want an ON/OFF digital output, set the entire PWM% table to 100% and set the OFF value to 0% for a typical output. If you want an inverted output because of the particular characteristics of your output circuit or your device, set the PWM table 0% for all cells and set 100% as the off value.
There are 5 mode options available for each of the 4 spare ports:
| PWM || TCC ||Shift|
|Spare Port 0|
(v4.100 and higher)
|Spare Port 1|
(v2.120 and higher)
|Spare Port 2|
(v2.120 and higher)
|Spare Port 3|
(v5.002 and higher)
The spare port's circuit hardware must be built appropriately for any of these outputs to handle the device it is connect to. Note that any output that is pulse width modulated must have a recirculation diode installed on the controlled device. It does not hurt to have such a diode installed on every output, even if it is ON/OFF.
Spare Port Modes:
The function of each spare port can be selected under: Spare Ports→Spare Ports Function→Spare Port X Usage (there are 5 modes for each of the three spare ports, corresponding to 5 values of the parameter spX_mode. Note that the PWM table for the respective port is used to set the ON state in any of the modes.):
- User Spare Ports/Speedo Output/Dedicated Line Pressure*:
- Spare Port 1 and Spare Port 2: User controlled settings control the behavior based on speed, rpm, load. ON and OFF PWM percentages are based on the 12 element table (ON) and PWM OFF value (OFF). The PWM is updated continuously based on the index value. The AND'ed conditions, thresholds, and hysteresis values are set under: Spare Ports→User Spare Port X. Spare ports 1 or 2 cannot be used as speedo outputs.
- Spare Port 0: Can be used as a speedometer output. Signal will be derived from VSS input. See this link: Output Pulse/Mile for more information.
- Spare Port 3 as a dedicated PC Output: Can be used as a line pressure output. The PWM will be derived from the 16x9 line prssure table, unless the pressure exceeds the up/downshift limit pressure for that shift, or if the RPM is less than 300 RPM (in which case it is set to 100% pressure = 0% PWM).
- The line pressure table is 100-PWM%, while the spare port 3 table is PWM%, so for example a value of 75% in the line pressure table would be the same as a value of 25% (100-75) in the spare port table.
- The tables and bins for the line pressure table and the spare port 3 PWM table are independent,
- You can switch between spare port 3's line pressure and PWM modes without affecting the PWM percent values in either. The tables, bins, and parameters will not be transferred by TunerStudio between the two when you switch modes, however
- The period setting (=1/frequency) is shared between the line pressure and other modes, so if you change it in one mode, it will remain changed if you switch modes.
- PWM mode: Use the only PWM 12 or 144 element table and OFF value to set the state. This setting relies on the 'PWM active' parameter (below) to determine when the PWM state is ON or OFF. The PWM can be set to a range of values from 0% to 100% in 12 bins (and the user can select if the interpolated PWM percent varies with load, temperature, speed, or engine rpm. The user can also set a single separate OFF value for the PWM. If the user doesn't want varying PWM, and wants and ON/OFF output instead, they can simply set all the table values to 100% and the OFF value to 0% (or vice-versa).
Spare Ports→Spare Port X PWM Setup→PWM Active (spX_active):
In PWM mode, the user has 3 choices as to when the PWM table is used:
- always ON: PWM percent is always based on the 12 element table, whether shifting or not. The OFF value is not used.
- ON except while shifting: PWM percent is based on 12 element table, except during shifting when it is set to the user specified OFF value.
- ON only during shift*: PWM percent is based on 12 element table during shifting, but when not shifting the PWM percent is set to the user specified OFF value. (This is the inverse of the previous mode.)
* = default value; X = 0,1,2
PWM mode for Spare Port 3 is a bit different than for the other spare ports. Spare port 3 can be used in PWM mode as a alternate algorithm for the line pressure output. The PWM will be derived from spare port 3's 16x9 PWM table (not the 16x9 load × speed line pressure table), unless:
- Shift PWM Option is set to:
- 'Use OFF value', then the fixed OFF valued specified for spare port 3 will be used during shifts, OR
- 'Use shift limits', then the higher PWM value (i.e. lower pressure for a bleed valve) of the table or (100 - maximum line pressure upshift/downshift) setting will be used (see: www.msgpio.com/manuals/mshift/V5tune.html#gl)
- If the Spare Port 3 'Table Active' value is set to 'ON if RPM>300, else OFF' then the PWM will be set to the OFF value when the engine RPM is less than 300 (i.e. if not running or cranking). This setting can reduce current draw when not running if set to 0%, and can reduce the electrical noise associated with pulse width modulating the pressure control valve.
- the dedicated line pressure table is 100-PWM%, while the spare port 3 table is PWM%, so for example a value of 75% in the line pressure table would be the same as a value of 25% (100-75) in the spare port table.
- the tables and bins for the line pressure table and the spare port 3 PWM table are separate and independent in memory. That means you can switch back and forth between spare port 3's line pressure and PWM modes without affecting the values in either. The tables, bins, and parameters will not be transferred by TunerStudio between the two when you switch modes.
- the table values in line pressure mode is subject to the temperature corrections and voltage corrections specified for the line pressure. The voltage and temperature corrections are not applied to:
- Spare port 3 modes: PWM, TCC, shift solenoid, or clutch modes,
- the user settings for Park or Neutral (i.i. if the user selects 'User Specified' (below) under 'General Settings → Shift Factors → Line pressure in Neutral/Reverse') nor
- the spare port 3 OFF setting.
- Refresh and dither is only available in line pressure mode.
- Slip based line pressure adjustments (5.003+ code) are only available in line pressure mode.
- Engine brake (aka. "jake brake") function (to increase line pressure) is only available in line pressure mode.
The pulse width modulation uses a table lookup for the ON state and has an OFF value as well as index options.
The user can select the index value to use ('Spare Ports→Spare Port X PWM Setup→PWM Index') to interpolate the 12 element PWM% table based on the bins in the 'Spare Ports→Spare Port X PWM Index' table. The possible index values are:
- Temperature (only positive temperatures are allowed).
- Current Gear**,
* = default value; X = 0,1,2
** = 5.002 code and higher
The default mode for spare port 3 is line pressure mode (the only function for this output in previous codes). Note that if PWM mode is selected the defaults are:
- 16 element index = load, i.e. the mixed and adjusted load based on a user specified combination of MAP and TPS (see: www.msgpio.com/manuals/mshift/V5tune.html#gh), but this can be changed to any of the other indices.
- 9 element index = gear, this gears a 1x16 row of PWM percent by load for each gear.
- Up/downshift limits are used for shifting,
- The OFF value of 0% is used when the RPM is less than 300.
TCC mode: Output is ON (PWM% from 12x1 table for spare port 1 and 2, from the 16x9 table for spare port 0 and 3) while TCC is engaged, OFF otherwise. None of the spare port TCC settings affect the main TCC output on PT3 (which has its own PWM frequency, PWM algorithm, etc.)
Use as Shift Solenoid: Output state is changed at some shifts based on user's output pattern. PWM% from 12x1 table for spare port 1 and 2, from the 16x9 table for spare port 0 and 3. Note that if you want to have a constant PWM% for the shift solenoid, you should enter that value in all 12/144 bins of the spare output's PWM table. As of V2.120 code Spare Port 2 becomes OUTPUT4, Spare Port 1 becomes OUTPUT7.
This gives the possibility of eight (8) possible shift solenoid outputs (9 in the 5.xxx+ beta code), depending on the outputs potential use for other functions:
|PE4||OUTPUT1||Standard shift solenoid output.||PWM parameters shared with OUTPUT 5 & 6 - 30.6 to 1953 Hertz|
|PM2||OUTPUT2||Standard shift solenoid output.||Has own PWM parameters - 31 to 1953 Hertz|
|PT1||OUTPUT3||Standard shift solenoid output.||Timer channel PWM|
|PA0||OUTPUT4||aka. SP2; must set mode to "Use as Shift Solenoid" ||12x1 PWM lookup table - 30.6 to 1953 Hertz|
|PAD01||OUTPUT5||aka. SWB; only available if using voltage based manual shift lever||PWM parameters shared with OUTPUT 1 & 6|
|PAD03||OUTPUT6||aka. SWC; only available if using voltage based manual shift lever||PWM parameters shared with OUTPUT 1 & 5|
|PT7||OUTPUT7||aka. SP1; must set mode to "Use as Shift Solenoid" ||12x1 PWM lookup table - 30.6 to 1953 Hertz|
|PT4||OUTPUT8||aka. SP0/speedo output; must set mode to "Use as Shift Solenoid"; 4.1xx+ code only||16x9 look-up table,|
Timer channel PWM
|PT2||OUTPUT9||aka. SP3/line pressure output; must set mode to "Use as Shift Solenoid"; 5.xxx+ code only||16x9 look-up table,|
Timer channel PWM
* = default value; X = 0,1,2
So there are 8 possible shift solenoids, and 6 possible PWM frequencies and percentages.
Selective Clutch: Output is ON (PWM% from 12x1 table for spare port 1 and 2, from the 16x9 table for spare port 0) while shifting AND Clutch Output1 Pattern is ON for target gear, OFF otherwise. You set the shifts to activate the spare port under 'Shift Output Patterns → Clutch Pattern'. This is similar to the PWM mode 'ON only during shift' except that the user can select which shifts are active, whereas the 'ON only during shift' is active during ALL shifts.
As of 5.102 code, the selective clutch outputs on spare port 1 and spare port 2 can be set to engage momentarily when the TCC engages (called 'TCC follow mode'), as well as when certain up/down shifts occur. This is a useful function for some VW/Audi transmissions1. Under 'Shift Output Patterns → Clutch TCC Activation' you will find a number of settings to also activate the spare port when the TCC is engaged. There are:
The menu is only accessible when the particular spare port has been set to selective clutch mode.
- Activation Period: Time duration keep the spare output activated after the TCC engages. The value can range from 0.00 to 2.50 seconds in 0.01 second steps; the default is 1.00 second, and
- SPX with TCC in Gear X: In each current gear there is a choice to 'Don't apply SP1 [or SP2] with TCC in X Gear' (the default for all gears) OR 'Apply SP1 [or SP2] with TCC in X Gear'.
Note that any output that is pulse width modulated must have a recirculation diode installed on the controlled device. It does not hurt to have such a diode installed on every output, even if it is ON/OFF.
1 One such transmission is the VW/Audi 097 model transmission which uses 7 solenoid outputs. Solenoid N94 is activated during downshifts to 2nd and 3rd and upshifts to 4th (and this was handled by the 5.101 and older code using the 'selective clutch' spare port function). However, N94 is also activated whenever the TCC is initially engaged (but only in 3rd gear and only for a second or so) and this is now handled natively in the 5.102+ code.
MegaSquirt® and MicroSquirt® and GPIO™ controllers are experimental devices intended for educational purposes.
MegaSquirt® and MicroSquirt® and GPIO™ controllers are not for sale or use on pollution controlled vehicles. Check the laws that apply in your locality to determine if using a MegaSquirt® or MicroSquirt® controller is legal for your application.
© 2012, 2015 Bruce Bowling and Al Grippo. All rights reserved.