developing a spark cut launch control solution

They go by many names, P01, P59, VPW, '0411 etc. Also covering E38 and newer here.
bubba2533
Posts: 498
Joined: Wed Apr 11, 2018 8:50 am
cars: 03 Chevy S10 Turbo V6

Re: developing a spark cut launch control solution

Post by bubba2533 »

Ok, had the day off today and I think I figured it out.

Still need to change some things around, but I think it should work with the next revision :punk:
LS1 Boost OS V3 Here. For feature suggestions post in here Development Thread. Support future development ->Patreon.
User avatar
Gampy
Posts: 2333
Joined: Sat Dec 15, 2018 7:38 am

Re: developing a spark cut launch control solution

Post by Gampy »

How do you find space to put additional code??

Is this just empty space in the bin, add your code, hijack a jump point to your location, at that point you have control, thus you can either run your code or the original code in the order you choose??
Intelligence is in the details!

It is easier not to learn bad habits, then it is to break them!

If I was here to win a popularity contest, their would be no point, so I wouldn't be here!
bubba2533
Posts: 498
Joined: Wed Apr 11, 2018 8:50 am
cars: 03 Chevy S10 Turbo V6

Re: developing a spark cut launch control solution

Post by bubba2533 »

Gampy wrote:How do you find space to put additional code??

Is this just empty space in the bin, add your code, hijack a jump point to your location, at that point you have control, thus you can either run your code or the original code in the order you choose??
Exactly, the end of the bin has tons of unused space for code & parameter data. The more difficult part was finding unused RAM.
LS1 Boost OS V3 Here. For feature suggestions post in here Development Thread. Support future development ->Patreon.
User avatar
Gampy
Posts: 2333
Joined: Sat Dec 15, 2018 7:38 am

Re: developing a spark cut launch control solution

Post by Gampy »

bubba2533 wrote:Exactly, the end of the bin has tons of unused space for code & parameter data. The more difficult part was finding unused RAM.
Thank ya sir!
Intelligence is in the details!

It is easier not to learn bad habits, then it is to break them!

If I was here to win a popularity contest, their would be no point, so I wouldn't be here!
User avatar
vwnut8392
Posts: 59
Joined: Fri Feb 28, 2014 7:38 am
cars: AAN powered 83 audi 4000 quattro
1983 audi UR quattro
1992 GTI VR6

Re: developing a spark cut launch control solution

Post by vwnut8392 »

your sort of over complicating the process of this bubba by trying to achieve so much so early in the development. have you got the retard and spark cut parts working yet? the process should be retard -500 before spark cut RPM than your spark cut RPM. retard always stays on with the spark cut. when function shuts off timing will return to normal quickly. start with a simple routine like this....

----Automatic----
1. check wheel speed, if below 2mph go to brake pedal check, if above skip.
2.check for brake pedal, if brake is pressed go to TPS check, if not skip.
3.Check to see if TPS is above 90%, if yes follow into timing retard & spark cut. of not skip.
4. retard timing starting -500 RPM of the spark cut RPM.

---Manual----
1. check wheel speed, if below 2mph go to brake pedal check, if above skip.
2.check for clutch, if clutch is pressed go to TPS check, if not skip.
3.Check to see if TPS is above 90%, if yes follow into timing retard & spark cut. of not skip.
4. retard timing starting -500 RPM of the spark cut RPM.


it can be that simple to start. the manual transmission one can be TPS and wheel speed only. doesnt need a clutch switch to detect technically to have just launch control because the decider weather launch is active will be the wheel speed sensor as it can only activate if below 2mph.


and retard isnt necessary to start, you can skip that for now too. just need to find the right spot in the code to force the coil dwell time to 0.0ms and make the ECU temporarily ignore its real dwell table. to test that is simple in theory. just make your jump out for that custom code where you think the point in the original code is that the final dwell value is placed into RAM than just make a forced constant value somewhere that is referenced and set it to 0.0ms and an RPM that spark cut will happen. once you have that its this easy......

1. check RPM constant, if at or above RPM jump to fake forced dwell time. if not skip.
2. read fake forced dwell of 0.0, 0.1, 0.2 etc constant you made and force it into RAM instead of the value from the dwell table.

this is a basic way to figure out if you got it right. the spark cut is the most important, more important than the retard for now. i have already confirmed a few pages ago that forcing dwell to 0.0 or a very low number will give the spark cut/bouncing effect that is needed. by bouncing what i mean is the engine RPM will climb to the desired spark cut RPM than when that is hit and the dwell time is forced to a low number the RPM drops below the spark cut RPM making the ECU read the dwell table again automatically causing RPM to rise again to spark cut than back down, than back up etc. where the dwell is read is normally is a pretty high priority routine so thats why it will be a fast on/off spark cut. changing the forced dwell time can also change the speed of the cut as well. 0.0 will be faster and the higher you go the longer the space is between the cut.

to add the timing retard you will need to source some open RAM and create your flags because where the spark cut will happen in code the timing read will be in a totally different sub routine most likely. the first thing to look for in the code for the timing is if its actually sequential like if the ECU has its own RAM position for each cylinder or if the ECU takes a single timing value and breaks it up into being sequential on a hardware level. on some VAG ECU's like MED9 it has per cylinder ignition angle in RAM so i have to hijack all 4 of those to make the timing retard work. but basically i would place the code for the checks for wheel speed, TPS, brake/clutch etc where the timing retard happens than when it gets to the part in custom code to set the timing retard it also sets a flag in RAM that the spark cut code elsewhere is looking for. when the flag is set and the RPM is met spark cut will follow the timing retard.


These are the added constant values i suggest.
-Wheel speed- this is very effective for turning launch control on/off.-----to not use wheel speed if desired set wheel speed to maximum
-TPS %-if above say 90% than your LC can go active -----
-X2 RPM variables- 1 added constant for retard RPM start and 1 for Spark cut RPM.

I will elaborate on adding flat shift code to this once i see a working launch control routine.
User avatar
vwnut8392
Posts: 59
Joined: Fri Feb 28, 2014 7:38 am
cars: AAN powered 83 audi 4000 quattro
1983 audi UR quattro
1992 GTI VR6

Re: developing a spark cut launch control solution

Post by vwnut8392 »

i sort of recommented your earler posts to make sure im following this correctly.

Code: Select all

ROM:0008A900
ROM:0008A900 ; =============== S U B R O U T I N E =======================================
ROM:0008A900
ROM:0008A900
ROM:0008A900 sub_8A900:                              ; CODE XREF: sub_3B82A+E8p
ROM:0008A900                 jsr     sub_2696E
ROM:0008A906                 tst.b   ($FFFFB370).w //DBW Enable
ROM:0008A90A                 beq.s   loc_8A912
ROM:0008A90C                 move.w  ($FFFFA598).w,d4 //DBW TPS
ROM:0008A910                 bra.s   loc_8A916
ROM:0008A912 ; ---------------------------------------------------------------------------
ROM:0008A912
ROM:0008A912 loc_8A912:                              ; CODE XREF: sub_8A900+Aj
ROM:0008A912                 move.w  ($FFFFAB64).w,d4 //NON-DBW TPS
ROM:0008A916
ROM:0008A916 loc_8A916:                              ; CODE XREF: sub_8A900+10j
(Engine speed needs to be the last variable before spark cut.)
ROM:0008A916                 move.w  ($FFFFA562).w,d3 //------------------Engine Speed Constant?
ROM:0008A91A                 cmp.w   (word_8AB00).l,d3 // -----------------Engine speed in RAM?
ROM:0008A920                 bcc.w   loc_8A9CC
ROM:0008A924                 tst.b   ($FFFF819E).w // LC Status
ROM:0008A928                 beq.s   loc_8A97E
ROM:0008A92A                 tst.b   ($FFFFAF3A).w // Brake Pedal
ROM:0008A92E                 beq.s   loc_8A94A
ROM:0008A930                 tst.b   ($FFFFAF3A).w // Brake Pedal (Need to confirm clutch ram address before changing this)
ROM:0008A934                 beq.s   loc_8A94A
(VSS needs to be flipped, read constant first than compare)
ROM:0008A936                 move.w  ($FFFFAEBC).w,d3 // ----------------Vehicle Speed Filtered in RAM?
ROM:0008A93A                 cmp.w   (word_8AB02).l,d3 //-----------------Added VSS constant? 
ROM:0008A940                 bhi.s   loc_8A94A
ROM:0008A942                 cmp.w   (word_8AB04).l,d4//------------Not sure what is being compared here.
ROM:0008A948                 bhi.s   loc_8A970
ROM:0008A94A
ROM:0008A94A loc_8A94A:                              ; CODE XREF: sub_8A900+2Ej
ROM:0008A94A                                         ; sub_8A900+34j ...
ROM:0008A94A                 clr.b   ($FFFF819E).w  // Disable LC if a parameter is no longer satisfied
ROM:0008A94E                 move.w  ($FFFFAEBC).w,d3 // Vehicle Speed
ROM:0008A952                 cmp.w   (word_8AB02).l,d3
ROM:0008A958                 bhi.s   locret_8A9CE
ROM:0008A95A                 cmp.w   (word_8AB04).l,d4
ROM:0008A960                 bcs.s   locret_8A9CE
ROM:0008A962                 move.b  #1,($FFFF819F).w  // Enable timed spark retard
ROM:0008A968                 move.w  ($FFFFB544).w,($FFFF81A0).w // Move cycle counter to a local copy when timed retard is enabled
ROM:0008A96E                 bra.s   locret_8A9CE
ROM:0008A970 ; ---------------------------------------------------------------------------
ROM:0008A970
ROM:0008A970 loc_8A970:                              ; CODE XREF: sub_8A900+48j
ROM:0008A970                 move.w  ($FFFFA562).w,d3 // Engine speed
ROM:0008A974                 cmp.w   (word_8AB06).l,d3
ROM:0008A97A                 bcc.s   loc_8A9CC
ROM:0008A97C                 bra.s   locret_8A9CE
ROM:0008A97E ; ---------------------------------------------------------------------------
ROM:0008A97E
ROM:0008A97E loc_8A97E:                              ; CODE XREF: sub_8A900+28j
ROM:0008A97E                 tst.b   ($FFFFAF3A).w  // Brake Pedal
ROM:0008A982                 beq.s   loc_8A9A6
ROM:0008A984                 tst.b   ($FFFFAF3A).w  // Brake Pedal (Need to confirm clutch ram address before changing this)
ROM:0008A988                 beq.s   loc_8A9A6
ROM:0008A98A                 move.w  ($FFFFAEBC).w,d3 // Vehicle Speed
ROM:0008A98E                 cmp.w   (word_8AB02).l,d3
ROM:0008A994                 bhi.s   loc_8A9A6
ROM:0008A996                 cmp.w   (word_8AB04).l,d4
ROM:0008A99C                 bcs.s   loc_8A9A6
ROM:0008A99E                 move.b  #1,($FFFF819E).w  // Enable LC if all parameters are satisifed
ROM:0008A9A4                 bra.s   locret_8A9CE
ROM:0008A9A6 ; ---------------------------------------------------------------------------
ROM:0008A9A6
ROM:0008A9A6 loc_8A9A6:                              ; CODE XREF: sub_8A900+82j
ROM:0008A9A6                                         ; sub_8A900+88j ...
ROM:0008A9A6                 tst.b   ($FFFFAF3A).w // FFS Brake Pedal (Need to confirm clutch ram address before changing this)
ROM:0008A9AA                 beq.s   locret_8A9CE
ROM:0008A9AC                 move.w  ($FFFFAEBC).w,d3 // Compare vehicle speed for FFS
ROM:0008A9B0                 cmp.w   (word_8AB08).l,d3
ROM:0008A9B6                 bcs.s   locret_8A9CE
ROM:0008A9B8                 cmp.w   (word_8AB04).l,d4 // Compare TPS for FFS
ROM:0008A9BE                 bcs.s   locret_8A9CE
ROM:0008A9C0                 move.w  ($FFFFA562).w,d3 // Compare engine speed for FFS
ROM:0008A9C4                 cmp.w   (word_8AB0C).l,d3
ROM:0008A9CA                 bcs.s   locret_8A9CE
ROM:0008A9CC
ROM:0008A9CC loc_8A9CC:                              ; CODE XREF: sub_8A900+20j
ROM:0008A9CC                                         ; sub_8A900+7Aj
ROM:0008A9CC                 clr.l   d6     // Clear dwell value
ROM:0008A9CE
ROM:0008A9CE locret_8A9CE:                           ; CODE XREF: sub_8A900+58j
ROM:0008A9CE                                         ; sub_8A900+60j ...
ROM:0008A9CE                 rts
ROM:0008A9CE ; End of function sub_8A900
ROM:0008A9CE

Code: Select all

ROM:0008A9D0
ROM:0008A9D0 ; =============== S U B R O U T I N E =======================================
ROM:0008A9D0
ROM:0008A9D0
ROM:0008A9D0 sub_8A9D0:                              ; CODE XREF: sub_3A436+58p
ROM:0008A9D0                 jsr     sub_26994
ROM:0008A9D6                 tst.b   ($FFFF819F).w // Test if timed retard active
ROM:0008A9DA                 beq.s   locret_8AA22
ROM:0008A9DC                 tst.b   ($FFFFB370).w // DBW Enable
ROM:0008A9E0                 beq.s   loc_8A9E8
ROM:0008A9E2                 move.w  ($FFFFA598).w,d3 // DBW TPS
ROM:0008A9E6                 bra.s   loc_8A9EC
ROM:0008A9E8 ; ---------------------------------------------------------------------------
ROM:0008A9E8
ROM:0008A9E8 loc_8A9E8:                              ; CODE XREF: sub_8A9D0+10j
ROM:0008A9E8                 move.w  ($FFFFAB64).w,d3 // Non-DBW TPS
ROM:0008A9EC
ROM:0008A9EC loc_8A9EC:                              ; CODE XREF: sub_8A9D0+16j
ROM:0008A9EC                 cmp.w   (word_8AB04).l,d3
ROM:0008A9F2                 bcs.s   loc_8AA1E
ROM:0008A9F4                 clr.l   d3
ROM:0008A9F6                 move.w  ($FFFF81A0).w,d1 // Cycle counter when timed retard was activated
ROM:0008A9FA                 move.w  ($FFFFB544).w,d3 // Cycle counter
ROM:0008A9FE                 sub.w   d1,d3
ROM:0008AA00                 move.w  d3,($FFFF81A4).w  // Delta cycles
ROM:0008AA04                 mulu.w  #$10,d3
ROM:0008AA08                 cmpi.w  #$2800,d3 
ROM:0008AA0C                 bcc.s   loc_8AA1E
ROM:0008AA0E                 tbls.w  (word_8AB0E).l,d3
ROM:0008AA16                 add.w   d3,d0
ROM:0008AA18                 move.w  d3,($FFFF81A2).w // Save result from table lookup
ROM:0008AA1C                 bra.s   locret_8AA22
ROM:0008AA1E ; ---------------------------------------------------------------------------
ROM:0008AA1E
ROM:0008AA1E loc_8AA1E:                              ; CODE XREF: sub_8A9D0+22j
ROM:0008AA1E                                         ; sub_8A9D0+3Cj
ROM:0008AA1E                 clr.b   ($FFFF819F).w // Clear timed retard status
ROM:0008AA22
ROM:0008AA22 locret_8AA22:                           ; CODE XREF: sub_8A9D0+Aj
ROM:0008AA22                                         ; sub_8A9D0+4Cj
ROM:0008AA22                 rts
ROM:0008AA22 ; End of function sub_8A9D0
ROM:0008AA22


Here is flow diagrams i made for you to follow for a good flow in the code.
LC retard diagram.jpeg
LC spark cut diagram.jpeg
User avatar
vwnut8392
Posts: 59
Joined: Fri Feb 28, 2014 7:38 am
cars: AAN powered 83 audi 4000 quattro
1983 audi UR quattro
1992 GTI VR6

Re: developing a spark cut launch control solution

Post by vwnut8392 »

And here is a diagram of how flat shift would be added into the equation with the spark cut routine.

on the hard cut RPM limiter to make it true 2 step you use both stock fuel cut and the spark cut one. if you dont like the violence and flames set your stock fuel cut to whatever you want your rev limit to be than set the hard spark cut limiter a few 100 RPM higher than the stock fuel cut one, this way if the engine manages to push through the fuel cut one the spark cut one will catch it and stop it. If you want the drama of backfiring and flames on the rev limiter you set the spark cut to be your lower limiter and and the fuel cut a few 100RPM later. this way the fuel stays on during the spark cut limiter and you get the drama that makes all the kiddies drool and ask for more lol.
LC diagram w_ flat shift.jpeg
bubba2533
Posts: 498
Joined: Wed Apr 11, 2018 8:50 am
cars: 03 Chevy S10 Turbo V6

Re: developing a spark cut launch control solution

Post by bubba2533 »

To summarize current state of what I have:
1. Spark cut launch control works, but could use some updates to try and make it smoother. Ideas are welcome. I have one idea, but would like more.
2. I believe the timed retard after launch is also working, but I want to do more testing. This is not during launch control, when LC disables this goes active to reduce power for a short period of time to reduce or eliminate wheel spin. It will only activate if LC disables with the brake or clutch. And disables if the throttle position goes below LC TPS. This is geared towards drag racing.
3. I need someone to test the clutch input. Using PCMLogger of a RAM address to verify both the location and the state of the flag when the pedal is up and down. This will allow use for manual vehicles and allow testing of the flat foot shift. I may just have to see if I know someone running this OS with a manual so I can do testing in person.
vwnut8392 wrote:your sort of over complicating the process of this bubba by trying to achieve so much so early in the development.
Maybe, but why not add features now vs trying to re-do the whole thing. I think the hardest part I'm dealing with is how long it takes me to code this up in ASM. I'm not a programmer, but I have read that some people have written in higher level languages and then compiling to ASM. That would help a lot, but it would probably take me some time to learn it.
vwnut8392 wrote:have you got the retard and spark cut parts working yet?
I got the spark cut working days ago when I posted the chart of the dwell going to zero. I'm not doing a spark retard for the limiter, I don't think there is much use for that other than changing the sound and maybe it could make it a little smoother.

I tested my code at the track and it seemed to hold the RPM's fairly smoothly at the set point. It's not as smooth as my WOT BOX that I have in my truck, but it's not bad for a first try. I'm open to other ideas on how to make it hold the RPM smoother, but I don't really want to modify timing as I want to leave that for a boost builder function I have an idea for.
vwnut8392 wrote:it can be that simple to start. the manual transmission one can be TPS and wheel speed only. doesnt need a clutch switch to detect technically to have just launch control because the decider weather launch is active will be the wheel speed sensor as it can only activate if below 2mph.
I want to be able to let the user rev past the LC limiter when stopped if they want to. That's why I am adding the clutch switch. I can always add parameters to disable the use of the brake/clutch input for people that don't have them. If the user has it wired in already then I imagine it could helpful.
vwnut8392 wrote: to add the timing retard you will need to source some open RAM and create your flags because where the spark cut will happen in code the timing read will be in a totally different sub routine most likely. the first thing to look for in the code for the timing is if its actually sequential like if the ECU has its own RAM position for each cylinder or if the ECU takes a single timing value and breaks it up into being sequential on a hardware level. on some VAG ECU's like MED9 it has per cylinder ignition angle in RAM so i have to hijack all 4 of those to make the timing retard work. but basically i would place the code for the checks for wheel speed, TPS, brake/clutch etc where the timing retard happens than when it gets to the part in custom code to set the timing retard it also sets a flag in RAM that the spark cut code elsewhere is looking for. when the flag is set and the RPM is met spark cut will follow the timing retard.


These are the added constant values i suggest.
-Wheel speed- this is very effective for turning launch control on/off.-----to not use wheel speed if desired set wheel speed to maximum
-TPS %-if above say 90% than your LC can go active -----
-X2 RPM variables- 1 added constant for retard RPM start and 1 for Spark cut RPM.

I will elaborate on adding flat shift code to this once i see a working launch control routine.
I already have some open RAM that I found and I'm using it to do spark retard. It's one single value that can be modified, which I believe I've done successfully. There is a little more testing that I want to do as I think I was having some other issue with my tune that was getting in the way of testing my logic.

I added a very basic Flat Foot Shift logic, but I don't have a vehicle to test it with. I will need someone to test that I have the clutch switch variable correct.
LS1 Boost OS V3 Here. For feature suggestions post in here Development Thread. Support future development ->Patreon.
User avatar
vwnut8392
Posts: 59
Joined: Fri Feb 28, 2014 7:38 am
cars: AAN powered 83 audi 4000 quattro
1983 audi UR quattro
1992 GTI VR6

Re: developing a spark cut launch control solution

Post by vwnut8392 »

sounds like a good start though. spark cut will always be violent, thats its nature. if you watch my one video with the maroon silverado you will see a difference between a smoother LC and very harsh. the timing retard makes it a little smoother. the purpose here is to use the backfires to build boost on turbocharged engines, it needs to be that way. the retard creates added load on the engine to also build boost on turbo vehicles and on NA helps build torque on the starting line.
User avatar
NSFW
Posts: 679
Joined: Fri Feb 02, 2018 3:13 pm

Re: developing a spark cut launch control solution

Post by NSFW »

Programming in C is indeed easier. There is a learning curve with it, but given how much progress you've made with this approach I have no doubt you'd pick it up quickly.

I created a new thread in the Tools subform to talk more about C development, and more specifically to talk about a tool that we'll need to get C compiler output patched into bin files. That has a learning curve as well. But in the end I'm sure it will be worth it. I'm not saying to stop what you're doing here in asm, because you're making great progress... but consider ramping up on C and the patch tool if you have extra time and energy.

viewtopic.php?f=4&t=6920
Please don't PM me with technical questions - start a thread instead, and send me a link to it. That way I can answer in public, and help other people who have the same question. Thanks!
Post Reply