Pages: 1 [2] 3 4
Author Topic: Spark Retard and Enrich Launch Control for 2.7t ME7.1 8D0907551M  (Read 20166 times)
Cadensdad14
Full Member
***

Karma: +8/-1
Offline Offline

Posts: 134


« Reply #15 on: June 14, 2018, 07:27:03 PM »

ok.  I always say if i stare at a problem long enough I will solve it, and I think i have it.  I believe I have found KFZWMN on my 1.8t file.  I have been using the fully defined 518F file as a guide to building my own xdf.  I have found several issues with it, primarily in the axis calls.  I have also been cross referencing off of the CB BAM file.  I believe the 518F file has the wrong location for KFZWMN.  It explains why overrun fueling never worked.  The 551M file references KFZWMN as follows:
ROM:0088AAC0 loc_88AAC0:                             ; CODE XREF: sub_88AA20+66j
ROM:0088AAC0                                         ; sub_88AA20+70j
ROM:0088AAC0                 movbz   r4, rl
ROM:0088AAC4                 mov     [-r0], r4
ROM:0088AAC6                 movbz   r4, nmot
ROM:0088AACA                 mov     [-r0], r4
ROM:0088AACC                 mov     r4, KFZWMN_offset        <-------------
ROM:0088AAD0                 mov     [-r0], r4
ROM:0088AAD2                 movbz   r12, byte_816B0A
ROM:0088AAD6                 mov     r13, #6B0Ch
ROM:0088AADA                 movbz   r14, byte_816B0B
ROM:0088AADE                 mov     r15, #6B1Ch
ROM:0088AAE2                 calls   0, sub_7B7A
ROM:0088AAE6                 add     r0, #6
ROM:0088AAE8                 movb    byte_380D9B, rl4

writing to a RAM location 2 bytes before zwmnms. 

I crossreferenced the location 2 bytes before zwmnms and saw this

ROM:0089D3F2 loc_89D3F2:                             ; CODE XREF: sub_89D356+26j
ROM:0089D3F2                                         ; sub_89D356+94j ...
ROM:0089D3F2                 jnb     word_FD6E.3, loc_89D42C
ROM:0089D3F6                 movbz   r4, byte_8122F8
ROM:0089D3FA                 and     r4, #1
ROM:0089D3FC                 jmpr    cc_Z, loc_89D42C
ROM:0089D3FE                 movbz   r4, rl
ROM:0089D402                 mov     [-r0], r4
ROM:0089D404                 movbz   r4, nmot
ROM:0089D408                 mov     [-r0], r4
ROM:0089D40A                 mov     r4, #6DCCh      <--------------------
ROM:0089D40E                 mov     [-r0], r4
ROM:0089D410                 movbz   r12, unk_816DAE
ROM:0089D414                 mov     r13, #6DB0h
ROM:0089D418                 movbz   r14, unk_816DAF
ROM:0089D41C                 mov     r15, #6DC0h
ROM:0089D420                 calls   0, sub_7B7A
ROM:0089D424                 add     r0, #6
ROM:0089D426                 movb    byte_380B93, rl4
ROM:0089D42A                 jmpr    cc_UC, loc_89D44A

So I pulled up the 0x816DCC in the CH file and compared it to the BAM file and the table size and axes work and the data makes sense within the table and roughly matches the BAM data.

Do I have it?
Logged
TijnCU
Hero Member
*****

Karma: +60/-4
Offline Offline

Posts: 690


flying brick


« Reply #16 on: June 15, 2018, 02:23:08 AM »

I want to do the full map switch because I feel like I have more things I want to make, and implementing a map switch seems more useful later.  It also gives me more data points to tune. 

Well, that is entirely up to you. My advice is to not make it more complex than needed. Do you need the full KFZW and KFZW2 map for launch control? Do you need KFZWMN?
Do you need KFLBTS and LAMFA? If you want to achieve retarded ignition and have the ability to write your own patch, it makes much more sense to add your patch at the very end of the calculation. This ensures it will not be affected by any other ME7 functionality. ZWOUT is the actual output angle to the coils, you can make a nice custom map if you like (and definitely more handy to have it NOT load based but something more predictable like 3D rpm * pedal or just 2D rpm).
Same goes for fuel, if you want to have it follow lambda (how do you predict what mrfa or rl values will be during launch conditions?) you might as well just use LAMFA. The lowest lambda value will be the result anyway. My personal preference (also based on how most standalone ecu's do this) was to make it a percentual increase of fuel. You could also force a lambda value if you want that, or a fixed injector opening time. I was unsure about lambda control during launch conditions and if it remains closed loop, so I decided not to alter any lambda based strategy but essentially patch the injector size (by giving a final multiplicative correction) while setting my own axis parameters. Again I want to point out that the axis variables of all your changed maps are not designed for this function you want them to control, so why not customize them to your needs?
Logged

Cadensdad14
Full Member
***

Karma: +8/-1
Offline Offline

Posts: 134


« Reply #17 on: June 17, 2018, 07:30:11 AM »

Ok.  I see what you're saying.  Make it as simple as writing a constant value for zwout when flags are active.  Zwout is written in 3 locations.  Make the write a call to a subroutine that writes a constant for antilag or preserves the function and then returns to the next line.  Leave all the ignition tables alone, and leave the map switch active for just lamfa and make a rich request.  Quick, simple, done.
Logged
Cadensdad14
Full Member
***

Karma: +8/-1
Offline Offline

Posts: 134


« Reply #18 on: June 17, 2018, 07:31:35 AM »

You can even place the constant in the 1st to make it easily editable.
Logged
Cadensdad14
Full Member
***

Karma: +8/-1
Offline Offline

Posts: 134


« Reply #19 on: June 17, 2018, 10:04:12 AM »

Ok.  Revisions have been made to follow the recommendations from TinjCU.  Once flags are set, it returns.  Then subroutines are called that are flag dependent that either copy the original code or insert constant values for zwout, lamfaw_w, and B_kr. 

Flag Setting Routine
ROM:008A3ACC ALS_Coding:                             ; CODE XREF: sub_86FB9C+3EP
ROM:008A3ACC                 bmov    S_cruise.6, word_FDD6.5
ROM:008A3AD0
ROM:008A3AD0 B_ALS_Set:
ROM:008A3AD0                 extp    #0E1h, #1 ; 'ß'
ROM:008A3AD4                 movb    rl4, tmotlin
ROM:008A3AD8                 exts    #81h, #1 ; 'ü'
ROM:008A3ADC                 movb    rh4, AL_MaxTemp
ROM:008A3AE0                 cmpb    rl4, rh4
ROM:008A3AE2                 jmpr    cc_UGT, B_als_reset
ROM:008A3AE4                 exts    #81h, #1 ; 'ü'
ROM:008A3AE8                 movb    rh4, AL_MinTemp
ROM:008A3AEC                 cmpb    rl4, rh4
ROM:008A3AEE                 jmpr    cc_ULE, B_als_reset
ROM:008A3AF0
ROM:008A3AF0 LC_SetRoutine:
ROM:008A3AF0                 movb    rl4, CWALS
ROM:008A3AF4                 jnb     r4.0, B_LC_reset
ROM:008A3AF8                 jnb     Cl_Br_Pos_Cond.13, B_LC_reset
ROM:008A3AFC                 mov     r4, vfil_w
ROM:008A3B00                 exts    #81h, #1 ; 'ü'
ROM:008A3B04                 mov     r9, ALSpdThresh
ROM:008A3B08                 cmp     r4, r9
ROM:008A3B0A                 jmpr    cc_NC, B_LC_reset
ROM:008A3B0C                 mov     r4, nmot_w
ROM:008A3B10                 exts    #81h, #1 ; 'ü'
ROM:008A3B14                 mov     r9, LaunchRPM
ROM:008A3B18                 cmp     r4, r9
ROM:008A3B1A                 jmpr    cc_ULE, B_LC_reset
ROM:008A3B1C                 extp    #0E0h, #1 ; 'a'
ROM:008A3B20                 movb    rl4, B_alsflags
ROM:008A3B24                 bset    r4.0
ROM:008A3B26                 extp    #0E0h, #1 ; 'a'
ROM:008A3B2A                 movb    B_alsflags, rl4
ROM:008A3B2E                 jmpr    cc_UC, B_NLS_set
ROM:008A3B30 ; ---------------------------------------------------------------------------
ROM:008A3B30
ROM:008A3B30 B_LC_reset:                             ; CODE XREF: ROM:008A3AF4j
ROM:008A3B30                                         ; ROM:008A3AF8j ...
ROM:008A3B30                 extp    #0E0h, #1 ; 'a'
ROM:008A3B34                 movb    rl4, B_alsflags
ROM:008A3B38                 bclr    r4.0
ROM:008A3B3A                 extp    #0E0h, #1 ; 'a'
ROM:008A3B3E                 movb    B_alsflags, rl4
ROM:008A3B42                 jmpr    cc_UC, B_NLS_set
ROM:008A3B44 ; ---------------------------------------------------------------------------
ROM:008A3B44
ROM:008A3B44 B_als_reset:                            ; CODE XREF: ROM:008A3AE2j
ROM:008A3B44                                         ; ROM:008A3AEEj
ROM:008A3B44                 extp    #0E0h, #1 ; 'a'
ROM:008A3B48                 mov     B_alsflags, ZEROS
ROM:008A3B4C                 jmpr    cc_UC, flg_return
ROM:008A3B4E ; ---------------------------------------------------------------------------
ROM:008A3B4E
ROM:008A3B4E B_NLS_set:                              ; CODE XREF: ROM:008A3B2Ej
ROM:008A3B4E                                         ; ROM:008A3B42j
ROM:008A3B4E                 extp    #0E0h, #1 ; 'a'
ROM:008A3B52                 movb    rl4, B_alsflags
ROM:008A3B56                 jb      r4.0, nls_bit_reset
ROM:008A3B5A                 movb    rl4, CWALS
ROM:008A3B5E                 jnb     r4.1, nls_bit_reset
ROM:008A3B62                 jnb     Cl_Br_Pos_Cond.13, nls_bit_reset
ROM:008A3B66                 jb      Cl_Br_Pos_Cond.9, nls_bit_reset
ROM:008A3B6A                 mov     r4, nmot_w
ROM:008A3B6E                 exts    #81h, #1 ; 'ü'
ROM:008A3B72                 mov     r9, NLSRPMThresh
ROM:008A3B76                 cmp     r4, r9
ROM:008A3B78                 jmpr    cc_ULE, nls_bit_reset
ROM:008A3B7A                 movbz   r4, wped
ROM:008A3B7E                 exts    #81h, #1 ; 'ü'
ROM:008A3B82                 movbz   r9, NLSAccPedal
ROM:008A3B86                 cmp     r4, r9
ROM:008A3B88                 jmpr    cc_ULE, nls_bit_reset
ROM:008A3B8A                 extp    #0E0h, #1 ; 'a'
ROM:008A3B8E                 movb    rl4, B_alsflags
ROM:008A3B92                 bset    r4.1
ROM:008A3B94                 extp    #0E0h, #1 ; 'a'
ROM:008A3B98                 movb    B_alsflags, rl4
ROM:008A3B9C                 jmpr    cc_UC, flg_return
ROM:008A3B9E ; ---------------------------------------------------------------------------
ROM:008A3B9E
ROM:008A3B9E nls_bit_reset:                          ; CODE XREF: ROM:008A3B56j
ROM:008A3B9E                                         ; ROM:008A3B5Ej ...
ROM:008A3B9E                 extp    #0E0h, #1 ; 'a'
ROM:008A3BA2                 movb    rl4, B_alsflags
ROM:008A3BA6                 bclr    r4.1
ROM:008A3BA8                 extp    #0E0h, #1 ; 'a'
ROM:008A3BAC                 movb    B_alsflags, rl4
ROM:008A3BB0                 jmpr    cc_UC, flg_return
ROM:008A3BB2 ; ---------------------------------------------------------------------------
ROM:008A3BB2
ROM:008A3BB2 flg_return:                             ; CODE XREF: ROM:008A3B4Cj
ROM:008A3BB2                                         ; ROM:008A3B9Cj ...
ROM:008A3BB2                 rets
ROM:008A3BB2 ; ---------------------------------------------------------------------------


And then the RAM functions
als_kr_disable:                         ; CODE XREF: sub_872D1C+90P
ROM:008A4000                 extp    #0E0h, #1 ; 'a'
ROM:008A4004                 movb    rl4, B_alsflags
ROM:008A4008                 cmpb    rl4, #0
ROM:008A400C                 jmpr    cc_NZ, loc_8A4014
ROM:008A400E                 bset    b_kr.14
ROM:008A4010                 jmps    87h, loc_872DB2
ROM:008A4014 ; ---------------------------------------------------------------------------
ROM:008A4014
ROM:008A4014 loc_8A4014:                             ; CODE XREF: ROM:008A400Cj
ROM:008A4014                 jmps    87h, loc_872DB0
ROM:008A4018
ROM:008A4018 ; =============== S U B R O U T I N E =======================================
ROM:008A4018
ROM:008A4018
ROM:008A4018 ALS_lamfaset:                           ; CODE XREF: sub_8693B6:lamfa_hijackP
ROM:008A4018                 extp    #0E0h, #1 ; 'a'
ROM:008A401C                 movb    rl6, B_alsflags
ROM:008A4020                 cmpb    rl6, #0
ROM:008A4024                 jmpr    cc_NZ, als_lamfa
ROM:008A4026                 extp    #0E1h, #1 ; 'ß'
ROM:008A402A
ROM:008A402A stk_lamfa:
ROM:008A402A                 mov     lamfaw_w, r4
ROM:008A402E                 jmpr    cc_UC, lam_ret
ROM:008A4030 ; ---------------------------------------------------------------------------
ROM:008A4030
ROM:008A4030 als_lamfa:                              ; CODE XREF: ALS_lamfaset+Cj
ROM:008A4030                 mov     r4, #6Ch ; 'l'
ROM:008A4034                 extp    #0E1h, #1 ; 'ß'
ROM:008A4038                 mov     lamfaw_w, r4
ROM:008A403C                 jmpr    cc_UC, lam_ret
ROM:008A403E ; ---------------------------------------------------------------------------
ROM:008A403E
ROM:008A403E lam_ret:                                ; CODE XREF: ALS_lamfaset+16j
ROM:008A403E                                         ; ALS_lamfaset+24j
ROM:008A403E                 rets
ROM:008A403E ; End of function ALS_lamfaset
ROM:008A403E
ROM:008A4040
ROM:008A4040 ; =============== S U B R O U T I N E =======================================
ROM:008A4040
ROM:008A4040
ROM:008A4040 als_zwoutset:                           ; CODE XREF: sub_89CD08:zwout_als1P
ROM:008A4040                                         ; sub_89CD08:loc_89CDA6P ...
ROM:008A4040                 extp    #0E0h, #1 ; 'a'
ROM:008A4044                 movb    rl6, B_alsflags
ROM:008A4048                 cmpb    rl6, #0
ROM:008A404C                 jmpr    cc_NZ, als_zwout
ROM:008A404E
ROM:008A404E stk_zwout:
ROM:008A404E                 movb    zwout, [r12]
ROM:008A4052                 jmpr    cc_UC, zwout_ret
ROM:008A4054 ; ---------------------------------------------------------------------------
ROM:008A4054
ROM:008A4054 als_zwout:                              ; CODE XREF: als_zwoutset+Cj
ROM:008A4054                 movb    rl4, #0E4h ; 'S'
ROM:008A4058                 movb    rl4, zwout
ROM:008A405C                 jmpr    cc_UC, zwout_ret
ROM:008A405E ; ---------------------------------------------------------------------------
ROM:008A405E
ROM:008A405E zwout_ret:                              ; CODE XREF: als_zwoutset+12j
ROM:008A405E                                         ; als_zwoutset+1Cj
ROM:008A405E                 rets
ROM:008A405E ; End of function als_zwoutset
ROM:008A405E
ROM:008A405E ; ---------------------------------------------------------------------------
Logged
Cadensdad14
Full Member
***

Karma: +8/-1
Offline Offline

Posts: 134


« Reply #20 on: June 17, 2018, 12:14:09 PM »

Tested it.  Quick stutter at rpm threshold and then EPC light and nothing in the system.  I'm guessing I need to shutdown misfire recognition when the system is active.
Logged
Cadensdad14
Full Member
***

Karma: +8/-1
Offline Offline

Posts: 134


« Reply #21 on: June 17, 2018, 03:01:37 PM »

So going through the FR I think I have some of my problem figured out.  Im going back to my older maps because they created less problems when the system didnt work.  My spark is following zwist and hanging around 0 instead of dropping to -20.  Going to write zwgru, zwmnms, zwmn, and dzws or zwist.  zwist is zwopt minus dzws.  i believe if that zwist is the way to go
   
Logged
Cadensdad14
Full Member
***

Karma: +8/-1
Offline Offline

Posts: 134


« Reply #22 on: June 17, 2018, 07:00:10 PM »

How does B_mdstop get written?  I can see where its check for being 8 or not, but not how it becomes 8.
Logged
prj
Hero Member
*****

Karma: +914/-425
Offline Offline

Posts: 5830


« Reply #23 on: June 18, 2018, 12:39:59 AM »

It's enough to write zwgru, I've been doing it for years.

Your code is horrible (sorry). You seem to know some basics about programming but you lack knowledge about how the ECU works...
You need both to make anything useful.
Logged

PM's will not be answered, so don't even try.
Log your car properly.
Cadensdad14
Full Member
***

Karma: +8/-1
Offline Offline

Posts: 134


« Reply #24 on: June 18, 2018, 03:19:02 AM »

I didn't know anything about coding before I started trying this.  Ive been trying to follow the FR to track how things move through the system.  Basically, I know what I want, and I know people have done it, but no one has published anything about it.  So trying to do it myself.  Can you tell me whats horrible?

With afr, I know that you have lamfaw, lambts, and Lamfakr and that the richest will be used.

For ignition I think zwnws is the value gotten from KFZW/KFZW2.  It then gets dzwkg, dzwol, and dzwoag added to it to become zwgru.  Then dzwwl, dzwob, wkrdy, dwkr, dzwzk, and dzwbank are all added to zwgru.  Its switched based on whether its at start and then vszw, zwappl, and vstdzw are added and it becomes zwbas.  zwbas goes through a minimum check that comes out of KLZWBSMN.  It gets switched with zwsol, which is zwopt plus or minus dzws.  It must be greater than zwspae and less than zwbas.  Its then switched with zwspae, which comes from zwmnms and zwmnd from zwmn.  wphg and zwdllprt are added and then its checked against the min and max constants, signed 4E and E0, and comes out as zwout.

I am trying.  I changed from map switching to replacing ram values.  Can I get a pointer where Im wrong now.  Alter B_nozwe to cut off the reference to zwist and get my value of zwgru to go through? 

« Last Edit: June 18, 2018, 03:49:49 AM by Cadensdad14 » Logged
woj
Hero Member
*****

Karma: +41/-3
Offline Offline

Posts: 500


« Reply #25 on: June 18, 2018, 03:36:09 AM »

Basically, I know what I want, and I know people have done it, but no one has published anything about it.

No? http://nefariousmotorsports.com/forum/index.php?topic=10485.msg114637#msg114637
Logged
Cadensdad14
Full Member
***

Karma: +8/-1
Offline Offline

Posts: 134


« Reply #26 on: June 18, 2018, 03:51:10 AM »

Thank You.
Logged
prj
Hero Member
*****

Karma: +914/-425
Offline Offline

Posts: 5830


« Reply #27 on: June 18, 2018, 05:04:02 AM »

I told you what to do - set zwgru to preset value or use a RPM based 1D map, as that is going to decide how much boost you build.
I don't know why you want to switch lambda, in most cases this is completely unnecessary.

There's only 2 things to do - switch zwgru and disable KR. Both are doable in around 5-6 instructions...
Logged

PM's will not be answered, so don't even try.
Log your car properly.
nyet
Administrator
Hero Member
*****

Karma: +604/-166
Offline Offline

Posts: 12233


WWW
« Reply #28 on: June 18, 2018, 08:49:10 AM »

I told you what to do - set zwgru to preset value or use a RPM based 1D map, as that is going to decide how much boost you build.
I don't know why you want to switch lambda, in most cases this is completely unnecessary.

There's only 2 things to do - switch zwgru and disable KR. Both are doable in around 5-6 instructions...

Also misfire detection?
Logged

ME7.1 tuning guide (READ FIRST)
ECUx Plot
ME7Sum checksum checker/corrrector for ME7.x

Please do not ask me for tunes. I'm here to help people make their own.

Do not PM me technical questions! Please, ask all questions on the forums! Doing so will ensure the next person with the same issue gets the opportunity to learn from your experience.
prj
Hero Member
*****

Karma: +914/-425
Offline Offline

Posts: 5830


« Reply #29 on: June 18, 2018, 01:15:42 PM »

I have never ever had issues with misfire detection on ME7 with my NLS and LC algorithm.
But maybe that's because I don't use copy-paste code? :p
Logged

PM's will not be answered, so don't even try.
Log your car properly.
Pages: 1 [2] 3 4
  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Page created in 0.03 seconds with 17 queries. (Pretty URLs adds 0s, 0q)