5l40e

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: 5l40e

Post by Bernard Fife »

gurov,

If your shift solenoid on output3 is 'ON/OFF', just set the 'Output3 DC when ON' value to 100% (from 90%) in the tuning software.

Lance.
"Never wrestle with pigs. You both get dirty and the pig likes it." - George Bernard Shaw
gurov
Posts: 164
Joined: Mon Jun 01, 2009 1:01 pm

Re: 5l40e

Post by gurov »

Lance wrote:gurov,

If your shift solenoid on output3 is 'ON/OFF', just set the 'Output3 DC when ON' value to 100% (from 90%) in the tuning software.

Lance.
so with the new 2.004 code it seems i do not have to make any changes to the code to add forward gears, except for one thing that MIGHT have to be adjusted.

so to reiterate:

can use 3 inputs for determining the gear position, bmw does not have 4 3 2 1 positions, and while it DOES have 5 outputs from the trans for "gear position" , it has no way to be forced to shift to those. it has P N R D and sport. when in sport, the two up shift/downshift microswitches are available (mechanical limitation from D), and there is also a switch set for "sport mode activated".

my desire is to have the "sport mode activated" switch engage the manual mode, and the switch being off engage the auto mode.

this is mostly for the reason of getting back into the auto mode from manual, as i cannot physically hold both up/down switches at the same time.

is the very basic: switch X sets auto/manual mode possible in the code right now, or is that something that will have to be added ?
Bernard Fife
Posts: 1696
Joined: Fri Apr 04, 2008 1:28 pm

Re: 5l40e

Post by Bernard Fife »

gurov,

Activating either of the up/down shift buttons selects manual mode.

Pressing both buttons together gets you back to auto-mode. I understand that you cannot do that, but what you can do is wire both switches to a separate switch to ground both of them at once, and that will select auto-mode.

So if I follow your description accurately, you could have the two shift buttons ground the respective pins, and also have your "sport mode activated" button ground both pins. That should work as you describe (except manual mode won't actually be activated until you activate the sport mode button and select a gear using an upshift or downshift button):

Image

A separate "auto/manual" button could be added to the code (this was originally planned for the code, but left off to avoid burning up a I/O pin for an essentially redundant function).

Lance.
"Never wrestle with pigs. You both get dirty and the pig likes it." - George Bernard Shaw
gurov
Posts: 164
Joined: Mon Jun 01, 2009 1:01 pm

Re: 5l40e

Post by gurov »

Lance wrote:gurov,

Activating either of the up/down shift buttons selects manual mode.

Pressing both buttons together gets you back to auto-mode. I understand that you cannot do that, but what you can do is wire both switches to a separate switch to ground both of them at once, and that will select auto-mode.

So if I follow your description accurately, you could have the two shift buttons ground the respective pins, and also have your "sport mode activated" button ground both pins. That should work as you describe (except manual mode won't actually be activated until you activate the sport mode button and select a gear using an upshift or downshift button):

Image

A separate "auto/manual" button could be added to the code (this was originally planned for the code, but left off to avoid burning up a I/O pin for an essentially redundant function).

Lance.
the manual mode switch is not a momentary thing, i.e. the selector:
Image

and the switches go like this:

Image

so if the code can take the fact that both up and down are held down at all times when the manual mode is not engaged, i'd be okay with that.
Bernard Fife
Posts: 1696
Joined: Fri Apr 04, 2008 1:28 pm

Re: 5l40e

Post by Bernard Fife »

gurov,

Yes, grounding both switches for extended periods is fine - it just keeps the code in auto mode (and of course prevents selecting any manual gear, as desired).

Lance.
"Never wrestle with pigs. You both get dirty and the pig likes it." - George Bernard Shaw
gurov
Posts: 164
Joined: Mon Jun 01, 2009 1:01 pm

Re: 5l40e

Post by gurov »

Lance wrote:gurov,

Yes, grounding both switches for extended periods is fine - it just keeps the code in auto mode (and of course prevents selecting any manual gear, as desired).

Lance.
perfect.

i will make up a small board and put it inside the case for that then.

now... the 5l40e describes two modes for 1-3 gears, where they are split into "engine braking" and "not engine braking". any idea which one i would pick ?

the 4th and 5th gears are labeled as always engine braking.
Bernard Fife
Posts: 1696
Joined: Fri Apr 04, 2008 1:28 pm

Re: 5l40e

Post by Bernard Fife »

gurov,

I am not familiar with that trans and its engine braking functions. If they are electrically selectable, you could control this using the spare outputs (and set it by gear, speed, load, etc.). So you may have to do some research on how this operates.

The 4L60E has a similar function, with engine braking in 1-2-3 but only if the gear selection lever is not in 4th ( in which case there is no engine braking in any gear). Because it is mechanically controlled, we can't do anything about it in the code.

Lance.
"Never wrestle with pigs. You both get dirty and the pig likes it." - George Bernard Shaw
gurov
Posts: 164
Joined: Mon Jun 01, 2009 1:01 pm

Re: 5l40e

Post by gurov »

Lance wrote:gurov,

I am not familiar with that trans and its engine braking functions. If they are electrically selectable, you could control this using the spare outputs (and set it by gear, speed, load, etc.). So you may have to do some research on how this operates.

The 4L60E has a similar function, with engine braking in 1-2-3 but only if the gear selection lever is not in 4th ( in which case there is no engine braking in any gear). Because it is mechanically controlled, we can't do anything about it in the code.

Lance.
i suppose i can install it and test it out.

in 4l60e, is there engine braking in 1-2-3 gears with the selector in D ?
Bernard Fife
Posts: 1696
Joined: Fri Apr 04, 2008 1:28 pm

Re: 5l40e

Post by Bernard Fife »

gurov,

Engine braking for the 4L60E is only if the selector is in 1, 2 or 3. I can't recall off the top of my head if D is 4th (=overdrive) or 3rd (with OD marked for 4th - I believe my van had a D with a circle around it for 4th, and a plain D for 3rd). So I always use the gear number, rather than the gear indication (which might change from manufacturer and model and year).

Lance.
"Never wrestle with pigs. You both get dirty and the pig likes it." - George Bernard Shaw
gurov
Posts: 164
Joined: Mon Jun 01, 2009 1:01 pm

Re: 5l40e

Post by gurov »

so i'm setting up this stuff on the bench, and i basically had to redo every single input on the board.

5L40E, or at least the bmw version if it, the bits from the lever are +12v return, and i'm using 4 inputs from the shift lever for this trans, upshift/downshift are also 12v returns.

i modeled all the circuits after brake sense circuit, a voltage divider for 12v.

the following circuits have been changed and their respective functions.
EGT4 - sw A
GPI2 - SW B
EGT3 - swC
GPI1 (2wd/4wd) - swD

GPI5 - downshift
VR2 - upshift

testing stuff on the bench reveals the following, that i hope can be fixed in firmware:

upshift/downshift appears to be reversed as far as polarity in the firmware, 0v at the cpu pin makes it trigger the buttons - perhaps a brake-sense style switch for polarity for these ?
4th gear input does not have a corresponding output channel for gauges, using FWD/2WDOC displays 1/0 instead of the ADC from input 1 - 3.

i will have to rig up some diodes same way for mode switch to trigger both up/down at the same time, quite possibly via a relay, as the mode switch gives off 12v when it's in steptronic.

i guess the most important thing for this particular install is the ability to select polarity for the up/down shift at this point, it could probably be done by changing the circuit, but surely someone will run into something like this in the future.

just for kicks, this is the input pattern:

Code: Select all

         1  2  3  4  5

P        1  1  1  0  0
R        0  0  1  1  0
N        1  1  0  1  0
D        0  0  0  1  1
4 (3)    1  0  1  1  1
3 (2)    0  0  1  0  1
2 (1)    1  0  0  0  1


cut off the last bit.

         1  2  3  4    DEC

P        1  1  1  0   14
R        0  0  1  1    3
N        1  1  0  1   13
D        0  0  0  1   1
4 (3)    1  0  1  1  11
3 (2)    0  0  1  0   2
2 (1)    1  0  0  0   8


so 4 bits appears to be enough for to input that in.

the outputs

Code: Select all

output
-----
     1 2 3
P   0 0 0
R   0 0 0
N   0 0 0
1   0 1 0
1   0 1 1  engine braking <--
2   1 1 0
2   1 1 1  engine braking <--
3   1 0 0
3   1 0 1  engine braking <--
4   0 0 1  engine braking <--
5   0 0 0  engine braking <--
now, the software also calls for unique output patterns. is that only for forward gears ?
Post Reply