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.
Locked
Bernard Fife
Posts: 1696
Joined: Fri Apr 04, 2008 1:28 pm

Re: Latest Code Updates

Post by Bernard Fife » Wed Nov 04, 2015 11:04 am

5.103 code has been released here:

http://www.msgpio.com/manuals/mshift/V5code.html

This 5.103 code has:

- added 'per gear' upper and lower rev limits (rpm_limit[] and lower_rev_limit[]). The gives independent upper and lower rev limits for each applicable forward gear. See: viewtopic.php?f=4&t=1047#p5571 (Thanks mill3833!)
- put in a minimum decel mode speed parameter (inpram.min_dcl_spd) as a lower limit on decel mode, with default = 10.0 mph. Below this speed decel will be deactivated if active, and decel mode will not activate at all below this speed. This allows the trans to downshift normally when coming to a stop. See: viewtopic.php?f=4&t=1047&start=10#p5589 (Thanks mill3833!)
- put in an option to ignore shift button states for those not using them (typically if you are using the lever to shift manually). This prevents an 'accidental' shift button signals from blocking shifts. See: viewtopic.php?f=4&t=1047&start=10#p5589 (Thanks mill3833!)
- clears shift and hyst flags on change of table so that the controller can shift immediately if required by the newly activated table .
- added actual shift table number to datalog. It was in the bit flags before, but shows up as 1 or 2 now for easier reference.
- added checks for valid target_gear and valid current_gear to main loop. (Thanks camomcharo!)
- restricted current gear matches from 1 to num_gears (rather than 8) to be the same as 4.146 code. See: viewtopic.php?f=4&t=988 (Thanks camomcharo!)

In the INI:

- the newly added upper and lower rev limits are displayed for each forward gear (no lower rev limit for 1st and no upper rev limit for top gear, of course),
- the parameter and correct units are displayed for the new setting 'minimum decel mode speed' (Thanks mill3833!)
- there is a fix to the speedo output pulse/km parameter when using metric lengths. See: viewtopic.php?f=4&t=1052#p5601 (Thanks BuickV6!)

This code has been tested on my bench, but use it with caution and be prepared to revert to an earlier version at anytime until it is proven to work in all circumstances for your application.

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 » Sun Nov 29, 2015 5:40 pm

5.104 code has been released here:

http://www.msgpio.com/manuals/mshift/V5code.html

This code has eliminated a couple of bugs. It fixes:
  • a TCC issue when the trans is unlocked while cold and the temperature should be ignored ("log-only"), i.e. if bit 1 (0x02) of inpram.stdin_cfg was 0.
  • a spare port 2 (sp2) issue when actively used during 'shift only'. The pin wasn't being switched because only sp1 was switched in shiftTo() function (due to a copy/paste error).
There is more on these issues here: viewtopic.php?f=4&t=1128

Many thanks to puliukk0 for spotting the issues and testing the solutions!

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 » Wed Jan 06, 2016 8:58 am

5.106 code has been released here:

http://www.msgpio.com/manuals/mshift/V5code.html

This code has fixed a couple of bugs:

- the line pressure was not being calculated correctly when the internal table was used, it was 100x too low. The fix was to re-work the line pressure table calcs, and adjust the INI to match. It *should* work now, but please report anything that doesn't work the way it should. There is more on this here: viewtopic.php?f=4&t=1142&p=5768#p5763 Thanks to mcneil for spotting this and bringing it to our attention!

- Input2 state (high/low) was not being reported properly due to conflicting logic on the hardware (GPIO/microTCU). This has been fixed. There is more on this here: viewtopic.php?f=4&t=1145 Thanks to Halldorsson for reporting this bug and testing the solution!

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 » Mon Jan 11, 2016 3:18 pm

5.110 code has been released here:

http://www.msgpio.com/manuals/mshift/V5code.html

This code implements a new 'test mode' for the various physical inputs. When selected under 'Tools -> Input Test Configuration', the user input test value (entered under 'Tools -> Input Test Parameter Values') will be used instead of the actual measured physical value. The values used by the code in test mode are implemented as raw input values (for example the period for the VSS, or the ADC count for temperature), and these are then carried through all the normal calculations in the code. This can be useful for testing the code, or possibly for implementing a 'limp home' strategy using 'safe' input values when a sensor value is out-of-range.

While test mode can be handy for testing various input values, it doesn't substitute for a trans stim, as it doesn't test:
  • the GPIO board's input circuit for adequate operation,
  • The GPIO's proper 25x2 header jumper configuration,
  • the input port's configuration in the code (such as DDRx or ATDI0EN, etc.),
  • the harness wiring, or
  • the sensor itself.
However, test mode can be very useful for checking the operation of the code (and user configurations) when supplied with specific inputs, so it can eliminate or isolate the code's logical flow as an issue (but not necessarily the code's port configuration).

The new parameters for test mode are:
  • Test Mode: Enabling test mode lets you substitute one or more of the measured input values with a value(s) you enter in TunerStudio. This can be helpful when trying to sort out issues. For the ADC inputs (PADxx) the value substituted can be a voltage from 0.00 to 5.00, for the VSS input (PT0/) the value will be the speed in MPH, the ISS (PT5) is the period in RPM (for the ISS or non-CANbus tach), and for a digital input (PE1) you can enter 'low' for a grounded input and 'high' for a non-grounded input.
  • Input 1(PAD00/EGT4/Amp26): Test the Lever Input1. The value you enter will be a voltage between 0.00 and 5.00 Volts. Grounded is usually less than about 1.0V (depending on your digital threshold setting), with any value above that considered to be 'high'.
  • Input 2 (PAD01/GPI2/Amp6): Test the Lever Input2. The value you enter will be a voltage between 0.00 and 5.00 Volts. Grounded is usually less than about 1.0V (depending on your digital threshold setting), with any value above that considered to be 'high'.
  • Input 3 (PAD03/EGT3/Amp25): Test the Lever Input3. The value you enter will be a voltage between 0.00 and 5.00 Volts. Grounded is usually less than about 1.0V (depending on your digital threshold setting), with any value above that considered to be 'high'.
  • Temperature Input (PAD02/GPI3/Amp30): The value you enter will be a voltage between 0.00 and 5.00 Volts, and this will be used to look up the temperature in the internal table.
  • Vehicle Speed Sensor (PT0/VR1/Amp2): The value you enter will be a speed between 0 and 255 MPH. Note that the value you input will be converted from a speed to a VSS period and used in the calculations in the usual way, so the result you see in TS may not match what you enter due to rounding in the code.
  • Input Speed Sensor (PT5/VR3/Amp14): The value you enter will be the ISS or tach RPM (in 50 rpm increments from 0 to 12750). Note that the value you input will be converted from an RPM to an ISS/tach period and used in the calculations in the usual way, so the result you see in TS may not match what you enter due to rounding in the code (especially at very low or very high speeds).
  • Paddle UP (PT6/VR2/Amp15): Test the upshift paddle input.
  • Paddle DOWN Input (AD06/GPI5/Amp4): The value you enter will be a voltage between 0.00 and 5.00 Volts. Grounded is usually less than about 1.0V (depending on your digital threshold setting), with any value above that considered to be 'high'.
  • Brake Input (PAD07/GPI4/Amp3): The value you enter will be a voltage between 0.00 and 5.00 Volts. Grounded is usually less than about 1.0V (depending on your digital threshold setting), with any value above that considered to be 'high'.
  • Line Pressure Input (PAD04/EGT2/Amp27): The value you enter will be a voltage between 0.00 and 5.00 Volts, and this will be used to look up the line pressure value in the internal table.
  • 4WD/Table Switching Input (PE1/GPI1/Amp5): Select between 'Low' and 'High'.
  • non-CANbus Load Input (PAD05/EGT1/Amp24): The value you enter will be a voltage between 0.00 and 5.00 Volts, and this will be used to calculate the load based on your other settings.
The input values will substitute for raw physical inputs, and the code will still apply parameters like polarity settings (ex. brake signal) and limits (ex. speed).

There is more information on test mode in the docs here: http://www.msgpio.com/manuals/mshift/V5tune.html#ot

This code has also fixed a couple of bugs:

- the tach input only worked in non-CANbus mode. It was meant to work anytime, so this has been enabled.

- when in tach mode, the RPM value was applied to the ISS instead of the engine RPM, and this has been fixed as well.

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 » Sat Jan 16, 2016 2:39 pm

5.201 code has been released here:

http://www.msgpio.com/manuals/mshift/V5code.html

This code has:

- Added CANbus load, rpm, and vBatt inputs to available test variables discussed in the previous post. This allows for more thorough testing (and a more flexible 'limp home mode').

- Added 4 output values to the outpc. structure (and to INI and datalog) used to send values to TunerStudio from MShift (outpc increases in size from 96 to 104 Bytes):
  • vBatt,
  • testing_inputs (mirrors inp2ram.test_mode, so one can tell on a datalog which input values were 'forced' to specific values),
  • shiftStat,
  • rawSpeedo, and
  • lever_count
- Added a battery voltage gauge to INI.

- Rearranged the 'legacy' memory configuration inherited from MS2 code. Segments of that structure were full with the new code, while others were empty. ROM_7000 was the filled segment, so we have moved various routines to NON_BANKED. Also removed were MAT_ROM, MAF_ROM, EGO_ROM, etc. and the freed space was used to expand OVF_ROM.

- Reserved space for additional user input parameters. The existing structures were inpram and in2ram (and correspondingly in1flash and in2flash). Added was in3ram and in3flash (this is the reason for jumping version to 5.20x) as inpram/in1flash and in2ram/in2flash were nearly full (at 1016 bytes each). The addition of in3ram/in3flash should give us a fair bit of room for future expansion. This expands the space available for user input parameters (and tables) from 2048 bytes to 3072 bytes. I found it interesting to look at the growth in parameter space size as the code has evolved:
  • 1.100 - 584 bytes used (of 2048 available) - Nov. 2009
  • 2.200 - 1096 bytes used (of 2048 available) - Apr. 2012
  • 4.146 - 1400 bytes used (of 2048 available) - Jan. 2015
  • 5.100 - 1992 bytes used (of 2048 available) - Apr. 2015
  • 5.201 - 2064 bytes used (of 3072 available) - Jan. 2016
This code has been bench tested, where it works as planned; but use with caution and be prepared to revert to older code if necessary.

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 » Wed May 31, 2017 8:20 am

5.202 code has been released here:

http://www.msgpio.com/manuals/mshift/V5code.html

This code has:

- changed CANComm.h in serCANComm_1 to add tests for table overflow. If the location or number of bytes would cause an overflow, the code makes no changes to the table (Thanks Al!).

This code might help those who are having comms issues with msextra-related ECU firmware.
"Never wrestle with pigs. You both get dirty and the pig likes it." - George Bernard Shaw

Locked