Latest Code Updates

A forum for discussing applications and implementations of the MegaShift transmission controller code for the GPIO from B&G. This can control up to 8-speeds and 6 shift solenoids (plus a 16x9 table for controlling a PWM line pressure valve). It has manual and fully automatic modes (16x9 load x speed table), with under and over rev-limit protection, and full data logging of all inputs and outputs (among many other abilities). A TransStim to test your completed board is also available.
Bernard Fife
Posts: 1696
Joined: Fri Apr 04, 2008 1:28 pm

Re: Latest Code Updates

Post by Bernard Fife »

All,

Someone has put false info out there (not on this site) about the GPIO bootloader/flash/code. The facts are:

The 32K limit is only on the Codewarrior special edition for compiling your own code for free - it isn't a limit on the bootloader. We are not running put of flash memory either - we have only used about 25% of it.

You do not need a upgraded bootloader for the GPIO with any MShift code. I am using the standard bootloader for all the trans code. The old bootloader successfully loads the 58K 2.904 code on MS-II, so it will be fine for a long time with the trans code, etc.. In any case, Bruce says, "I have been burning in the microsquirt bootloaders into every GPIO before I send them out" - this is the upgraded bootloader - so if you have a production GPIO board you already have the new bootloader.

The upgraded bootloader is only needed for MS-II engine controllers wanting to run 3.430+ code. The 2.90x code was designed to allow users to upgrade their CAN comms to the latest specification without needing a new bootloader on their MS-II processor.

So take anything your hear about the GPIO board and MShift from other sites with a big grain of salt...

Lance.
"Never wrestle with pigs. You both get dirty and the pig likes it." - George Bernard Shaw
Bernard Fife
Posts: 1696
Joined: Fri Apr 04, 2008 1:28 pm

Re: Latest Code Updates

Post by Bernard Fife »

All,

I have put new v2.005 MShift code up on the v2 code page: http://www.msgpio.com/manuals/mshift/V2code.html

Thanks to some advice from Keith (kholman), this code adds a new user parameter: minimum manual speed (allowed values are -1 to 15 mph, -1 to 20 kph; default is 6.0). It is found under 'Shift Factors'.

With the lever in 2nd and auto-mode, the controller allows gears 1 and 2. In 2nd and manual mode, the previous controller code only allows 2nd, *however* it reverted to auto-mode if the speed gets too low. That means a user could find themselves in 1st if the speed gets low even though they have selected manual and 2nd. This could be annoying if you want to select 2nd for starting or low speeds in icy or snowy conditions.

So what I have done for the 2.005 code is make that vehicle speed threshold a user specified value and the user can set it to -1 to disable the code-driven change to auto mode.
--> An entry of 0.0 will force a switch to auto-mode only if the vehicle comes to a complete stop.
--> An entry of -1.0 will leave the the trans in manual mode regardless of the speed until both shift buttons are grounded, or the rev-limits are exceeded (if rev-limits are enabled, of course).

That will give users the option to start in second gear in slippery conditions, if they prefer.

As before, this code requires TunerStudio v999.8e or higher (not available by the usual TS update, you have to get it from the TS beta page: http://www.efianalytics.com/TunerStudio/beta/)

Lance.
"Never wrestle with pigs. You both get dirty and the pig likes it." - George Bernard Shaw
Bernard Fife
Posts: 1696
Joined: Fri Apr 04, 2008 1:28 pm

Re: Latest Code Updates

Post by Bernard Fife »

All,

In response to issues raised in other threads and privately, code v2.006b has been posted on the beta page: http://www.msgpio.com/manuals/mshift/V2code.html

This code adds:

1) user setting for shift button active state. That is, the user can now set whether the button is considered 'pressed' if the CPU pin is grounded (as before, and still the default = "active low"), or ~5 Volts ("active high"). This setting is under 'General Settings/Standard Inputs/Outputs Configuration': http://www.msgpio.com/manuals/mshift/V2tune.html#gi

2) shift button blocking after a shift has been activated. Once a shift is requested using the shift buttons, the user must release the shift buttons for at least 1/4 of the 'shift button duration' (http://www.msgpio.com/manuals/mshift/V2tune.html#gs) before the shift buttons become active again. This helps prevent accidentally performing multiple upshifts or downshifts.

3) adjustments to the load averaging calculation to reduce the rate at which the average load is allowed to decrease while braking (to avoid unwanted upshifts due to decreasing load when we actually should be downshifting to keep the revs up).

Lance.
"Never wrestle with pigs. You both get dirty and the pig likes it." - George Bernard Shaw
Bernard Fife
Posts: 1696
Joined: Fri Apr 04, 2008 1:28 pm

Re: Latest Code Updates

Post by Bernard Fife »

All,

I have put the latest 2.006e code up on the beta code page: http://www.msgpio.com/manuals/mshift/V2code.html

This code adds:
- improvements to the flash burn routine discussed in another thread (there may be more that needs to be done), and
- a fix for a TCC misbehaviour that some were reporting. This turned out not be be a problem with the logic, but rather a scaling problem in the INI (all the temps are in degrees x10 in the code, but the trans temp limit (that forces the TCC to engage regardless of load) was x1 in the INI, so we were always seeing the TCC engage in 3rd or higher regardless of load. The new 2.006e code/INI fixes this (they must be used together). If you use an old MSQ, you will have to update the 'Lock TCC Above Temp' setting manually.

Lance.
"Never wrestle with pigs. You both get dirty and the pig likes it." - George Bernard Shaw
Bernard Fife
Posts: 1696
Joined: Fri Apr 04, 2008 1:28 pm

Re: Latest Code Updates

Post by Bernard Fife »

All,

The latest 2.007b code is up on the site (http://www.msgpio.com/manuals/mshift/V2code.html). This has:

- more flash burn improvements (discussed in another thread), especially when the shift lever position cannot be determined,
- numerous INI fixes,
- 'flash burn' indicator added,
- fixes to the TCC control logic,
- fixed 'clutch output' logic and indicators,
- larger outpc structure for TunerStudio (from 56 to 58 bytes),
- TS blockingFactor increased in INI from 56 to 64 bytes (to allow for future expansion of outpc).

The 2.007b code must be used with the 2.007b INI (also on the site). There are still some changes to be made, but the code is getting there thanks to those who are testing and providing feedback.

Lance.
"Never wrestle with pigs. You both get dirty and the pig likes it." - George Bernard Shaw
Bernard Fife
Posts: 1696
Joined: Fri Apr 04, 2008 1:28 pm

Re: Latest Code Updates

Post by Bernard Fife »

All,

I have put new 2.008 code up on the web page: http://www.msgpio.com/manuals/mshift/V2code.html

This code separates the PWM TCC from the LUF function, so it doesn't burn up spare port 2 for those wanting just to PWM the TCC (for the apply and for continuous operation). This should be helpful for 4L80E users, among others. Two new parameters were added:

- TCC PWM Mode: This setting lets you choose between the on/off TCC and PWM TCC. In On/Off mode, On allows current to flow when the TCC is active, off doesn't allow current to flow. If you need to invert this, use the PWM settings and set 'PWM% when TCC Unlocked' to 100% and 'PWM% when TCC Locked' to 0%, than set the taper time short (0.1 seconds). In PWM mode, you can set the various parameters for TCC operation in the following settings. The default is 'on/off'.
- PWM% when TCC Locked: This is the value that the TCC PWM percent will taper to, and it will stay at that level as long as the TCC is applied. The default is 100%.

The menus have been re-arranged to bring the TCC parameters onto one menu:
http://www.msgpio.com/manuals/mshift/V2tune.html#gt, so you need to use the new INI as well. The documentation (http://www.msgpio.com/manuals/mshift/V2tune.html) has been updated to match the new parameters and layout.

The old way that linked the spr2 output to the TCC was intended to accommodate the Lock-Up Feel solenoid on the 4L60E by having a both PWM output and a ON/OFF output that are synchronized for the TCC. This can still be accomplished by using the same settings as before ("Use PT3/Amp32 for LUF and SPR2/PA0/VB2 for TCC" under "Spare Port Usage", and setting the PWM parameters).

However, now if you select Use PWM for TCC under ''TCC PWM Mode", spare output 2 remains available for other uses unless you have selected "Use PT3/Amp32 for LUF and SPR2/PA0/VB2 for TCC" under "Spare Port Usage".

I have not extensively tested this code, so use with caution.

Lance.
"Never wrestle with pigs. You both get dirty and the pig likes it." - George Bernard Shaw
Bernard Fife
Posts: 1696
Joined: Fri Apr 04, 2008 1:28 pm

Re: Latest Code Updates

Post by Bernard Fife »

All,

I have put 2.009 code here: http://www.msgpio.com/manuals/mshift/V2code.html It requires the 2.009 INI.

This code adds up to two shift outputs, for a total of 6 possible shift solenoid outputs. The new shift outputs are available only when using the voltage based lever determination (Shift Input Patterns/Configure Lever type), and must also be enabled (under 'Shift Input Patterns/Configure Inputs').

These new outputs are on two of the ADC channels. To reduce electrical switching noise from affecting the ADC results, the output of these two processor pins is reduced to 1/3 of full value when PWM is enabled on them. As a result, a logic level driver is probably the best bet when designing a circuit for these outputs. Something like a RFP30N06LE-ND from Digikey (http://www.digikey.copm) (http://www.fairchildsemi.com/ds/RF/RFP30N06LE.pdf) can be used (mounted on the case with a mica insulator), with a 4001 diode across the solenoid (banded end to 12V supply). A resistor between the RFP3006 gate and processor is not required. The source can be connected to the ampseal connector using the component holes on the PCB for:

Output5: port pin PAD01, circuit GPI2 (jumpered), processor connection (gate) - C16 - (the hole furthest from the heatsink, that is not connected to ground), Ampseal connection - R29 (the hole closest the ampseal), connects to Ampseal pin 6

Output6: port pin PAD03, circuit EGT3, processor connection (gate) - R67 (the hole furthest from the Ampseal), ampseal connection - AD595 pin 14 (or either of the adjacent holes marked "a"), connects to Ampseal pin 25.

Also added to this version of the code is the ability to switch between PWM/on-off for outputs 1,2,4,5,6 ('General Setting/Solenoid PWM Setup').

So there are three possible PWM modes:

- Output3 has it's own timer channel, and is independent of 1,2,4,5,6,
- Outputs 1,2,4,5,6 can share one other bit-banged PWM setup,
- or any or all of Outputs 1,2,4,5,6 can be on-off.

The PWM on the pressure control and TCC outputs are completely independent of the shift output PWM settings.

This code also has a few fixes for the shift logic on some outputs in some gears (errors that resulted from hasty copy-n-pasting).

As before, this code has not been extensively tested, so use with caution.

Lance.
"Never wrestle with pigs. You both get dirty and the pig likes it." - George Bernard Shaw
Bernard Fife
Posts: 1696
Joined: Fri Apr 04, 2008 1:28 pm

Re: Latest Code Updates

Post by Bernard Fife »

All,

I have put the latest 2.00B code here: http://www.msgpio.com/manuals/mshift/V2code.html

As discussed in another thread, compared to the 2.009 code, this code includes:
- added 'Max. Vehicle Speed' as user setting for VSS filtering (default = 140 mph): http://www.msgpio.com/manuals/mshift/V2tune.html#gv
- added code to check for 'hot reset' by looking at engine rpm and VSS interrupts,
- removed reset speedo to 0 on reset unless the current gear is 1,
- improved logic for manual/auto switch switch at minimum manual speed (to better ensure disabling when in manual mode if 'minimum manual speed' is less than 0),
- completely removed shift to first on switch to auto mode at low speed,
- added user input 'Reset Filter Off' time (time to ignore filtering on reset) (default = 1.5 seconds, was hard coded at 5.0 seconds before): http://www.msgpio.com/manuals/mshift/V2tune.html#gv
- added 'TCC hysteresis time' as user variable (default = 7.5 seconds): http://www.msgpio.com/manuals/mshift/V2tune.html#gt

In addition, some changes were made in 2.00B over 2.00A to the ISS calculations, which could roll-over in some circumstances. The TCC hysteresis was also made more robust in 2.00B.

The user manual for this code is here: http://www.msgpio.com/manuals/mshift/V2code.html

Lance.
"Never wrestle with pigs. You both get dirty and the pig likes it." - George Bernard Shaw
Bernard Fife
Posts: 1696
Joined: Fri Apr 04, 2008 1:28 pm

Re: Latest Code Updates

Post by Bernard Fife »

All,

I have put the 2.00C code here: http://www.msgpio.com/manuals/mshift/V2code.html

This code:
- adds the TCC PWM percentage to the datalog (rather than just 0 for off or 1 for on).
- corrects the reporting of the pressure control PWM percentage in neutral (discussed in another thread)
- adds is_rpm (input shaft rpm) to the outpc structure (rather than having TS back-calculate it from the convertor slip value) so it can be datalogged, displayed on a gauge, etc.
- adds 'full time TCC lock-up mode' for the TCC above a user specified rpm and gear: http://www.msgpio.com/manuals/mshift/V2tune.html#gt. This allows the user to keep the TCC applied at all times above a user specified gear and rpm.
- adds full time under/over rev protection to manual mode (an up or down shift will occur if rpm limits are exceeded, if rpm checking is enabled). Previous versions only blocked shifts that would result in over/under revs, code now monitors rpms at all times in manual mode and shifts when required. Under/over revving does not result in a change to auto mode (unlike old codes).
- rearranges some outpc variables so that temperature, line pressure, TCC, and Brake variables are contiguous and in that order. See the INI [OutputChannels] section for details.

The 2.00C INI is required for the code.

I have tested the changes to some extent, but not extensively, so try it with great caution.

Lance.
"Never wrestle with pigs. You both get dirty and the pig likes it." - George Bernard Shaw
Bernard Fife
Posts: 1696
Joined: Fri Apr 04, 2008 1:28 pm

Re: Latest Code Updates

Post by Bernard Fife »

All,

I have put the latest 2.00Cy code on the beta page: http://www.msgpio.com/manuals/mshift/V2code.html

This code fixes are error in the gear table lookup that caused it to use value from the column one to the right off the current speed as the target gear. Many thanks to those who pointed this out privately (you know who you are!).

The code now works as described in another thread:

"What the code does is look for the current bin using the current speed (and load, of course), and the 40 mph (or kph) column represents speeds from 40 to 49.9 (i.e, the next highest value that isn't covered in the next column), and the 50 is from 50 to 54.9, etc. So when you drop below 50.0 mph, you drop to the 40 column, and the target gear becomes 3." (if you have bins of 40 mph with all 3rd gear, 50 all 4th, and the next speed bin at 55, in this example)

Also, some users are wondering why the shifts are not always exactly at the table speeds, especially when testing on the bench. Usually this is due to the code's hysteresis functions, which are found under 'General Settings/Shift Factors' (http://www.msgpio.com/manuals/mshift/V2tune.html#gs):

Shift Speed Hysteresis: A shift will not be attempted until the vehicle speed has changed by at least the shift speed hysteresis amount since the last shift.
Shift kPa Hysteresis: A shift will not be attempted until the engine load has changed by at least the shift kPa hysteresis amount since the last shift.

Everyone using older code should upgrade to this code.

Lance.
"Never wrestle with pigs. You both get dirty and the pig likes it." - George Bernard Shaw
Locked