Creating a Smoother Launch Control

For discussion and distribution of custom code and hacks
Posts: 137
Joined: Wed Apr 11, 2018 8:50 am

Creating a Smoother Launch Control

Postby bubba2533 » Sun Sep 27, 2020 1:59 pm

Hey! I'm a novice when it comes to programming and especially when it comes to reprogramming a PCM to do something it was never intended to do.

I've taken a crack at programming my own Launch Control routine for the LS1 PCM at I actually got it to work! :punk:

The basics are that it sets the coil dwell to zero if the engine RPM is greater than a set point.

Details in this thread for anyone interested
https://pcmhacking.net/forums/viewtopic.php?f=42&t=6247

The issue is I think there is a limit to how smooth it can hold the RPM's since it's a single set point and it will oscillate.

If anyone has ideas (or better yet code!) that you think would help keep the RPM consistent that would be great.

Posts: 53
Joined: Tue Dec 03, 2019 3:58 am

Re: Creating a Smoother Launch Control

Postby turbo_bu » Tue Feb 16, 2021 6:53 am

Yes, saw your work in the other thread and it looks great. My first suggestion would be to do like the rest of the factory OS does and add in a form of hysteresis (upper / lower boundary ). This could help reduce the range of oscillations. Other options would have to play with the actual spark value being commanded ... to try and make a "soft" limiter. This would mean more code than a simple hysteresis.

Posts: 53
Joined: Tue Dec 03, 2019 3:58 am

Re: Creating a Smoother Launch Control

Postby turbo_bu » Fri Apr 09, 2021 1:50 am

Disclaimer - I have not tried this code out on an actual vehicle yet!

Again, thank you for sharing your work. I spent some time digging through the code and what you did to better understand how it all works. I then ported it to an 12212156 OS since I am playing with a 512 KB PCM. One thing I changed was in making function just as a rev limiter and 2 step (I didn't try to keep the FFS portion). When I did this, I also added in a "soft" portion to both these functions. So there is an RPM limit, but also a "soft" RPM limit. If the RPM is too high, then cut spark. If RPM is within the soft window, do a timing change. You have to be careful on the amount of timing your either changing, or specifying which will take some iteration. But hopefully, this will help keep the RPM more steady.

One other final change was to use a switch to command the 2 step. I choose to use the clutch switch since it is typically not being used, or could be borrowed if in a manual transmission vehicle. This also required a few more changes to the OS / transmission segment to make sure it works as needed.


CODE:
; Launch control patch for 512 kB PCM's (works for 12202088,12208322, 12212156, 12225074)
; For 12216125, need to shift it further out.
;
; Code is specific to 12202088
; Conversions needed for 12212156 are shown
;
; Spark dwell patch code to be placed starting at $0007FC00
; Spark advance patch code to be placed starting at $0007FD00
;
; Variables: (12202088) (12212156)
; Clutch (2 step) switch - $9F22 (EXT_1B8E) 0=not pressed, 1=clutch pressed $9F28
; Brake switch - $AA40 (EXT_2100) 0=not pressed, 1=brake pedal pressed $AA4A
; VSS Filtered - $AB9E (EXT_21C7) filtered vehicle speed MPH x 128 $ABC4
; ETC flag - $AE64 (EXT_2352) ETC flag from system segment $AE70
; DBC TPS - $A6BE (EXT_1F24) DBC TPS (100/255% per bit) $A6C8
; DBW TPS - $A1C0 (EXT_1CAA) DBW TPS $A1C0
; RPM - $A0C0 (EXT_1C5A) RPM $A0C0
;
; spark flag - $FFFF81A2 – spark flag 0=no change, 1=retard 5 deg, 2=-10 deg
;
; Parameters: store at end of speedometer segment $0001EF00 (keeps it in the check sum calc)
; RPM Hard Limit - $1EF00 - 6200 rpm - 7C 00
; RPM Soft Limit - $1EF02 - 6100 rpm - 7A 00
; 2 Step RPM Limit - $1EF04 - 3200 rpm - 40 00
; 2 Step RPM Soft Limit - $1EF06 - 3150 rpm - 3F 00
; 2 Step MPH - $1EF08 - 1 mph - 00 80
; 2 Step TPS - $1EF0A - 40 % - 08 00
; Spark Reduction - $1EF0C - 5 deg - 50 00
; Spark Timing Retard - $1EF0E - -10 deg - FF F6
;
; Need to make sure clutch switch type ($16E24 = 01)
; Need to NOP code to make it check for clutch switch input
; $792B8 6654 -> NOP 4E71
;
; spark dwell section
; comes from a JSR in the spark dwell portion of the code which replaces the following line:
; JSR $26486 ;378F0: 4EB900026486 3D lookup table routine (12212156 - $379C8)
;
379C8 4EB90007FC00 JSR $7FC00

7FC00 4EB9000264B6 JSR $264B6 ; (12212156 - 000264B6)

4A389F28 TST.B $9F28 ; Check clutch switch to determine which RPM limit to use
6746 BEQ.S LAB_11 ; branch if clutch switch = 0 (clutch not pressed, 2 step not engaged), use RPM rev limiter

; 2 step requested, check for 2 step conditions
4A38AA4A TST.B $AA4A ; AA40 = Brake pedal status
6740 BEQ.S LAB_11 ; branch if brake switch = 0 (brake not pressed), leave 2 step section
3638ABC4 MOVE.W $ABC4, D3 ; AEBC = Vehicle Speed (filtered)
B6790001EF08 CMP.W 0001EF08, D3 ; compare 2 step MPH threshold to MPH
6234 BHI.S LAB_11 ; if MPH is greater or equal to MPH threshold then 2 step is NOT active, leave 2 step section
4A38AE70 TST.B $AE70.W ; DBW enable (0=DBC, 1=DBW)
6706 BEQ LAB_01 ; if =0 (DBC), goto LAB_01
3838A1C0 MOVE.W $A1C0,D4 ;A598 = DBW TPS
6004 BRA LAB_02 ;(skip next line)
LAB_01
3838A6C8 MOVE.W $A6C8, D4 ;AB64 = DBC TPS
LAB_02
B8790001EF0A CMP.W 0001EF0A, D4 ; compare TPS threshold to TPS
631C BLS.S LAB_11 ; if TPS is less than or equal to TPS, leave 2 step section

; all 2 step checks have been met, activate 2 step
3638A0C0 MOVE.W $A0C0, D3 ; $A0C0 = RPM
B6790001EF04 CMP.W 0001EF04, D3 ; compare 2 step RPM Limit to RPM
622C BHI.S LAB_21 ; if RPM is greater than or equal to 2 step RPM Limit, then need to cut spark
B6790001EF06 CMP.W 0001EF06, D3 ; compare 2 step RPM Soft Limit to RPM
6508 BCS.S LAB_11 ; if RPM is less than 2 step RPM Soft Limit, RPM is outside of 2 step zone, do nothing
; 2 step active, RPM is above 2 step RPM Soft Limit, but less than 2 step RPM limit, set timing flag
11FC000281A2 MOVE.B $0002, $81A2.W ; spark flag =2 (timing = -10 deg)
6020 BRA LAB_END ; go to end
LAB_11 ; need to clear spark flag
3638A0C0 MOVE.W $A0C0, D3 ; $A0C0 = RPM
B6790001EF00 CMP.W 0001EF00, D3 ; compare RPM Hard Limit to RPM
620F BHI.S LAB_21 ; if RPM is greater than or equal to RPM Hard Limit, then cut spark
B6790001EF02 CMP.W 0001EF02, D3 ; compare RPM Soft Limit to RPM
650A BCS.S LAB_END ; if RPM is less than RPM Soft Limit, then do nothing
; RPM is above RPM soft limit, but below RPM limit, need to retard timing, set spark flag
11FC000281A2 MOVE.B $0001, $81A2.W ; spark flag =1 (retard 5 deg)
6002 BRA LAB_END ;(skip next line)
LAB_21
4246 CLR.W D6 ; clear D6, D6=0, no spark
LAB_END
4E75 RTS (Return) (END)


; spark advance section
; comes from a JSR in the spark advance portion of the code which replaces the following lines:
; Section of code where 2004 OS 12587603 inserts a JSR to the Launch Control Patch
; next 2 lines are added in to the JSR
; SUB A2,D1 ;369FC: 924A Subtract immediate spark retard (12212156 - $36B7E)
; SUB EXT_19F2.W,D1 ;369FE: 92789B84 Subtract burst knock retard SA

36B7E: 4EB90007FD00 JSR $7FD00

$7FD00 924A SUB A2,D1 ; (12212156 - 924A)
7FD02 92789B8A SUB EXT_19F2.W,D1 ; (12212156 - 92789B8A)

4A3881A2 TST.B $81A2.W ; test spark flag
6718 BEQ.S LAB_END ; branch if =0, no change required goto END
0C78000181A2 CMPI #$0001,$81A2 ;check to see if spark flag=1
6708 BEQ.S LAB_51
; spark flag = 2, timing = -10 deg
32390001EF0E MOVE.W $0001EF0E, D1
6008 BRA LAB_52
; spark flag = 1, subtract 5 deg
LAB_51
38390001EF0C MOVE.W $0001EF0C, D4
9244 SUB D4,D1
; could also replace this move / sub with a simple sub command
; 92790001EF0C SUB $0001EF0C, D1
LAB_52
423881A2 CLR.B $81A2.W ; clear spark flag
LAB_END
4E75 RTS (Return) (END)

Posts: 137
Joined: Wed Apr 11, 2018 8:50 am

Re: Creating a Smoother Launch Control

Postby bubba2533 » Fri Apr 09, 2021 4:43 am

Awesome!

I could have easily added a soft limiter, but I was hoping to create a launch control strategy that would adapt to the conditions in real time rather than require the user to tune the parameters for it to hold a steady rpm.

It’s likely too difficult to implement it without having a higher level programming language, but I would love to be able to implement a PID control loop to vary the number of cylinders to cut for each engine cycle rather than cutting all cylinders above a threshold.

Posts: 53
Joined: Tue Dec 03, 2019 3:58 am

Re: Creating a Smoother Launch Control

Postby turbo_bu » Tue Apr 13, 2021 1:02 am

Having the OS capable of handling the rev limiter by being able to skip cylinders, etc.. would be neat, but I think the main trade off would be in how long it takes to execute the code and make those decisions. Also, as you noted, the control would most likely need a form of PID feedback loop to "tune" it so that it can handle every kind of function.

My attempt is more a KISS method ... and admittedly I am using some of the logic that is used by other EFI systems (soft rev limiter). My logic was that either I would need to do a slight change to the spark (ex: subtract 10 degrees), or that I would be using the 2 step to try and build boost (ex: set park to -10 degrees). I'm sure there are other strategies that could be implemented. This is why for the spark timing portion, I made my variable a spark type to implement. This way no matter what is the function (2 step, RPM limiter, FFS, etc...), all you would have to do is just set which kind of spark adjustment was needed, then the spark code would just do that modification. After it does the change, it resets the variable and waits for the code to check to see what kind of change is needed next.

Posts: 137
Joined: Wed Apr 11, 2018 8:50 am

Re: Creating a Smoother Launch Control

Postby bubba2533 » Wed Apr 14, 2021 2:20 am

I've made more modifications to my current LC version to have a spark advance offset based on manifold pressure.

Boost Builder Table.png
Boost Builder Table.png (15.54 KiB) Viewed 402 times


This way I can pull timing to help build boost, but I can add timing back in once I hit my target boost level so that it holds.

I tested it last year and it worked great. I think I'll do more testing with the current version before trying different methods.

Posts: 53
Joined: Tue Dec 03, 2019 3:58 am

Re: Creating a Smoother Launch Control

Postby turbo_bu » Wed Apr 14, 2021 2:36 am

That is a great idea. One question I have is how are you handling the boost measurement? The stock MAP is limited to 1 bar, but you can fake it by using a 2 or 3 bar sensor. Or are you trying to use a 2/3 bar sensor and another PID which allows you to go higher than 1 bar? (GM.MAP vs. SAE.MAP)

Posts: 137
Joined: Wed Apr 11, 2018 8:50 am

Re: Creating a Smoother Launch Control

Postby bubba2533 » Wed Apr 14, 2021 5:57 am

I'm using it with a modified os for boost and a 3 bar map sensor.

One annoying thing is that the offset table and launch control valve are outside the Address range that standard tuners use for a parameter flash. So to make changes I have to do a full flash.

Haven't had time to figure out a way to have the tuner include this address range in a parameter flash (not sure how difficult) , or move the parameters inside the normal address range (may have to override unused parameters, so not idea for other people)

Posts: 53
Joined: Tue Dec 03, 2019 3:58 am

Re: Creating a Smoother Launch Control

Postby turbo_bu » Thu Apr 15, 2021 6:03 am

So one thing I did for my code, was put the variables into the end of the speedometer segment so that you would only have to do a cal flash to make any changes. I did this for the exact reason you mentioned.

If you don't mind sharing, which modified OS are you using? I am trying to figure out what is the minimum number of tables / variables needed to create an OS for use with 2 / 3 bar MAP sensors. I know that HPT and EFILive both have their own versions, but I was hoping to use / create an OS that could be shared.

Posts: 137
Joined: Wed Apr 11, 2018 8:50 am

Re: Creating a Smoother Launch Control

Postby bubba2533 » Thu Apr 15, 2021 7:35 am

I've added quite a few parameters since I'm using tables so I'm not sure if there is enough room to add them in the current segments without overriding stock OS parameters.

I've been thinking of making my own Custom OS as well. I even made a list of features that I wanted to make.

I'll start a new thread so we can chat about it.

Return to Custom Code

Who is online

Users browsing this forum: No registered users and 1 guest