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 » Sun May 26, 2013 12:09 pm

New 5.001 beta code is here: http://www.msgpio.com/manuals/mshift/V5code.html

This code adds three new capabilities:

- The raw TPS value over CAN is now passed to a TPSxRPM table (6x6) to determine an adjusted TPS value that better reflects the actual engine load given the throttle opening and rpm. Generally, when rpm is low, very little throttle opening is required to achieve maximum engine output, but increasing throttle is required as engine rpm rises. The default table looks like this:
Image
The raw TS value is the vertical axis, and the engine rpm is the horizontal axis. The adjusted TPS is the table value at the intersection of the current raw TPS and RPM. For example, with a TPS of 25%, and an rpm of 3500, the adjusted TPS would be 80%. There is more on this here: http://www.msgpio.com/manuals/mshift/V5tune.html#al

- Instead of being TPS only or MAP only, the load can now be a mix of both (for CAN users connected to a compatible MegaSquirt engine ECU). The user can set the percentage of MAP to use. 100% is all MAP with no TPS, while 0% is all TPS with no MAP. This is set under 'General Settings -> Throttle Factors' using a slider. The parameter replaces the old TPS/MAP option (set in the CAN options). The default is 100% (i.e. MAP only). If TPS is used (i.e. slider not set to 100%) then the adjusted TPS (see above) is used in the calculation. There is more on this here: http://www.msgpio.com/manuals/mshift/V5tune.html#gh

- The single shift completion delay factor has been replaced with a 8x1 table of delays by loads. This allows users to set different shift completion delays depending on the load. The shift completion delays affect things like the clutch output duration and CAN spark advance durations, etc. There is more here: http://www.msgpio.com/manuals/mshift/V5tune.html#tc

These changes have been tested briefly, but need much more exhaustive testing, as usual.

BTW, it is possible to mostly recover the previous code behavior with any of these changes (for those that might want to), by:
- setting the slider to 100% (for MAP only), or 0% (for TPS only),
- if using TPS, setting the cells in each row of the 6x6 table to the same value as the TPS bin value for that row, like this:
Image
- putting the same shift completion delay value that was used previously in each of the eight cells of the table.

However, it is no longer possible to have different load indices for the 16x9 shift and pressure control tables. Instead, users have to find a combination from the MAP/TPS options above that best reflect the load for both tables. Having different indexes made it impossible to set the pressure in specific gears, or coordinate them is any other rational manner. It also made the code more complicated than it should have been. And the few users who tried the mixed values didn't seem to like them much. However, with the adjustable mix of TPS and MAP, the TPS 6x6 table, as well as the possibility to have different bin values for the two tables, most users should be able to find a configuration that works well for them.

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 Jun 01, 2013 8:23 am

The latest 4.125 release code is here: http://www.msgpio.com/manuals/mshift/V41code.html

This code adds no new features, user settings, or functions compared to 4.124, but fixes an error (typo really) in the spare port 2 PWM conditions. This bug was unreported, but users may still stumble onto it if they continue to use the spare port 2 capability with older code (the error appears to have been in place since the 4.112 release). Upgrading to this (or subsequent) codes will fix some instances of spare port 2 malfunctions.

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 Jun 05, 2013 4:31 pm

The latest 5.002 beta code is here: http://www.msgpio.com/manuals/mshift/V5code.html

This code adds some new functions:

- The pressure control output (PT2/PWM3/Ampseal pin 33) can now be a 'spare port'. It is called spare port 3 (aka. sp3). This spare port has line pressure (the only function in earlier codes), PWM, TCC, clutch and shift solenoid modes. All modes are completely independent of the shift table. The spare port 3 ON state is defined by a 16x9 PWM table. The indexes on either axis can be chosen from "Load", "Speed", "RPM", "Temperature", "Current Gear", "MAP", or "TPS". This output's PWM mode is suitable for use as an alternate line pressure output. There are user options to set the PWM to 0 if the rpm is less than 300, and the PWM settings for reverse and neutral can be used instead of the table value (at the user's option). The default for PWM mode are to use a load x gear table (so each gear has its own 1x16 table of PWM% versus load as a separate row). Note that the spare port 3 PWM table isn't 100-PWM like the line pressure table. So a value of 73 in the line pressure table gives the same PWM as a value of 27 in the spare port 3 table. There is much more on this here: http://www.msgpio.com/manuals/mshift/spareport.html, be sure to read and understand this document thoroughly before trying the spare port modes.

- "Current Gear", "MAP", "TPS" were added to the existing "Load", "Speed", "RPM", "Temperature" possibilities for the PWM index options for spare ports 0, 1, and 2.

- An experimental new parameter called 'menu display' has been added (under ''Controller Hardware -> Menu Display'), and has three options: "Show All Menus", "Tuning Menus Only", "Configuration Menus Only". The idea is that some menus (configuration menus) have fixed values and only need to be set initially (internal gear ratios or number of VSS teeth, for example), whereas others ('tuning menus') need to be adjusted to suit circumstances as they arise (shift table, for example). This parameter can be used to reduce the clutter in the menus. If you uncheck TunerStudio's 'Show Disabled Menus' under 'Options -> Navigation -> Navigation Options' the inappropriate menus and parameters will not be shown. The parameter setting is only used for TunerStudio, it has no effect in the code at all.

- in addition to the sp3 index and PWM values, the raw MAP and raw TPS values were added to the output channels, as well as the hysteresis status (which now has an indicator on the 'front page' below the gauges as well), and the main loop counter "mloop" (which is handy for diagnostics and has a gauge).

This code also has the spare port 2 fix mentioned above for the 4.125 code.

All of these changes require much more testing, so use only with the greatest caution! We put it out now for people to try on a bench. Please start a new thread to report anything that doesn't work correctly.

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 Jun 26, 2013 1:29 pm

New 4.126 release code is here: http://www.msgpio.com/manuals/mshift/V41code.html

This code has no new user parameters or features compared to 4.125, but has a TPS reporting bug fix. There is more on that here: viewtopic.php?f=4&t=651

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 Jul 24, 2013 8:08 am

The latest 4.127 release code and INI are here: http://www.msgpio.com/manuals/mshift/V41code.html

This code:
- fixes a TPS hysteresis issue, (see viewtopic.php?f=4&t=655; thanks to gboezio)
- fixes a minimum TCC temperature issue in the INI, (see viewtopic.php?f=4&t=655&start=10#p3551; thanks to gboezio)
- removes the voltage smoothing when digital inputs are used, and significantly reduces it when a voltage based shifter is used, (see viewtopic.php?f=4&t=662; thanks to ashford)
- has changes to leave the transmission in its current state if the manual gear lever position cannot be determined (thanks again to ashford).

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 Aug 31, 2013 3:08 pm

I have put the latest 4.128 release code and INI are here: http://www.msgpio.com/manuals/mshift/V41code.html

This code has a number of fixes, including:
- a fix to the non-CANbus hysteresis,
- fixed load indexing issue for the auto-gear table lookup (this and the above crept into the code quite recently), and
- various small changes to the voltage based gear lever code (see: viewtopic.php?f=4&t=662 for more details).

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 Sep 02, 2013 8:42 am

The latest 4.130 code and INI are here:

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

This code is functionally identical to 4.129c test code (viewtopic.php?f=4&t=618&p=3700#p3697) but has an updated signature, and the INI has several improvements (see below).

Compared to the last release code, this code:

- fixes a bug caused by colliding interrupts in the VSS timer and the clock's timer overflow routines. For more information, see: viewtopic.php?f=4&t=618 Many thanks to Tobmag's patience and persistence in getting this sorted.

- adds user settings to handle lever error states more flexibly, thanks to ashford. These parameters include:
-- Lever Error Behavior: Select "Ignore Lever Errors" to have the code continue to use the previous lever position when a new input is not valid, or "Report Lever Errors" to set error states when an invalid lever state is encountered (http://www.msgpio.com/manuals/mshift/V41tune.html#ge).
-- Lever Error Delay: This is a timer that set a period during which lever errors are ignored (when the Lever Error Behavior is set to "Report Error Levers").
for more information see: viewtopic.php?f=4&t=662 Thanks to ashford for help getting these implemented and tested.
-- minimum and maximum voltages for the voltage-based lever. You can also specify minimum and maximum valid voltages for the voltage based lever inputs, and any voltage signal outside this range will be completely ignored. The defaults are a minimum of zero and a maximum of 5 Volts, making all possible voltages acceptable (http://www.msgpio.com/manuals/mshift/V41tune.html#in). Again, thanks to ashford.
-- Lets the user set the "Max. Lever Position Change". This is the maximum number of lever positions that are considered valid for a single lever position shift (in forward gears only). This will prevent the reporting a misleading lever position if an invalid state is briefly attained between valid positions. (http://www.msgpio.com/manuals/mshift/V41tune.html#il)

- fixes small bugs in the 2WD/4WD switching logic, and set the default table to table 1 (table 2 was sometimes used by default in older code depending on the inputs states),
- fixes non-CANbus table switching to use the non-CANbus load signal exclusively, regardless of the user's setting for MAP/TPS (thanks to Tobmag!),
- fixes 2WD/4WD speedo factor handling.

The new 4.130 INI has:
- better output shaft rpm (os_rpm) and VSS frequency (VSS_Hz) calculations,
- VSS_Hz added to the datalog,
- changed the naming of the CAN capability to "CANbus". This will make it easier to search for CANbus related terms, because "can" is common in English in many contexts and has diverse meanings, and is too short for many search functions.
- updated parameter help descriptions, several fixed help links, and numerous typo corrections.

The web help page for this code has been updated with the new parameters: http://www.msgpio.com/manuals/mshift/V41tune.html

4.127/4.128 code has been removed from the web site.

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 Sep 04, 2013 9:25 am

The latest 5.005 beta code is here:

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

This code incorporates all the applicable fixes and additions from the 4.125 to 4.130 codes, and also adds advanced internal slip options. This can be set up under 'General Settings -> Internal Slip Adjustments'. The options are:

* No slip adjustments - do not adjust anything regardless of amount of measured slip.

* Adjust spark only - retard spark by set amount when internal slip exceeds user threshold and load is above user threshold.

* Adjust spark AND line pressure - retard spark by set amount when internal slip exceeds user threshold and load is above user threshold and simultaneously increase line pressure (100-PWM%) by set 1% every 1/10th of a second whenever internal slip exceeds user threshold and load is above user threshold (and decrease by 1% every second once slip is below threshold).

* Adjust spark THEN line pressure - retard spark by set amount when internal slip exceeds user threshold and load is above user threshold, and the slip is still above the threshold after the Slip Delay period then increase line pressure (100-PWM%) by set 1% every 1/10th of a second whenever internal slip exceeds user threshold and load is above user threshold (and decrease by 1% every second once slip is below threshold).

* Adjust line pressure only - increase line pressure (100-PWM%) by set 1% every 1/10th of a second whenever internal slip exceeds user threshold and load is above user threshold (and decrease by 1% every second once slip is below threshold).

* Adjust line pressure THEN spark - increase line pressure (100-PWM%) by set 1% every 1/10th of a second whenever internal slip exceeds user threshold and load is above user threshold (and decrease by 1% every second once slip is below threshold), and if slip is still above the user threshold when the line pressure is maxed out (and the further Slip Delay period has elapsed) then apply the timing retard.

Note that timing retard is only applicable to CANbus setups.

To use any of these (other than 'no slip adjustments'), you must have an independent input shaft speed (ISS) sensor, and the 'TCC/Trans Slip Reporting' must be set to 'Slip in Transmission (ISS/VSS)' under 'ISS/non-CAN Tach Settings'.

This code and its associated INI are largely untested (the serial & CANbus comms, VSS, shift tables, solenoids and LEDs appear work as expected in brief testing with the default settings, though). They are meant for testing on a bench. If you decide to try this code in a vehicle, proceed with great caution, and be prepared to revert to earlier code at any time.

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 Sep 15, 2013 12:49 pm

The latest 4.131 code is here: http://www.msgpio.com/manuals/mshift/V41code.html

This code has one new function (compared to 4.130 code) and one new user setting. This code can take a VSS signal over CANbus. When it does this, it ignores any VSS signal sent directly to the GPIO's VSS input pin (eventually we will make that input available for other uses).

To use the CANbus VSS, you need to specify the offset of the VSS value in the outpc. structure. You do this under 'Tools -> CAN Configuration -> VSS offset'. If you set the value to zero (the default), or the CANbus is not enabled, the GPIO's VSS input is used. If it is not set to zero and CAN is enabled, the VSS from the external CANbus controller is used.

You can determine the required offset from the outpc. structure. The outpc structure is described in the [OutputChannels] section of the INI for your code. This will look something like:

Code: Select all

[OutputChannels]
   deadValue        = { 0 } ; Convenient unchanging value.

   ochBlockSize     = 112
   ochGetCommand    = "a\x00\x06" ; Lower case so we don't get confused.

   seconds          = scalar, U16,    0, "s",     1.000, 0.0
   secl = { seconds % 256 }, "s" ; For runtime screen.
   pulseWidth1      = scalar, U16,    2, "s",     0.001, 0.0
   pulseWidth2      = scalar, U16,    4, "s",     0.001, 0.0
...
   VSS              = scalar, U16,   %%, "mph",   0.100, 0.0
...
where the number in the "%%" position is the value you need to enter for the 'VSS offset'. The speed value may have a different label (i.e. "speed" or "speedo" or "mph", etc., instead of "VSS"; that doesn't matter). However, the speed must be x10 (0.100 in the line above), and it must be an unsigned integer (U16 above).

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 Sep 15, 2013 1:41 pm

5.006 beta code has been posted here: http://www.msgpio.com/manuals/mshift/V5code.html

This code has added the same capability to us an external CANbus source for the VSS speed as the 4.131 code above.

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

Locked