Page 5 of 7

Re: Cranking fuel tables

Posted: Mon Jun 18, 2012 6:02 pm
by Torque
exxon wrote:Did it help you?

What are the disadvantages to setting the ttpmin to 1 accross the board?
Yes it did.
:)

This is all for the Z32 ECU, I don't know about your ECU though.
You have to see about TTP MIN, this is specific to my setup.

Re: Cranking fuel tables

Posted: Mon Jun 18, 2012 6:28 pm
by RomChip200
Matt wrote: This is interesting, the software now probes the knock flags (well in particular 0x0082 address for Z32) to determine if main or knock maps are selected).
Be careful:
0x82:
bit1 when 1 means you're in the knock learn region
bit7 when 0 means knock is occurring (this is instantaneous info)
0x5A:
bit2 when 0 means you're using knock maps
Matt wrote: TKAS EGI increasing in quantity revision 1×16
100/64% After idle enrich vs temp revision

TWST When starting output pulse width 1×16
TWK:10 ℃ Ms First Time Injection vs Temp

TKTW EGI increasing in quantity factor 1×16
TWK:10 ℃ 100/64% After idle enrich vs temp factor (non-neutral)

TADVC After the starting timing revision table water temperature 1×16
TWK:10 ℃ Deg After start timing vs temp
Could you clarify who is who ? Doing the link b/w TKAS, TWST, TKTWEGI, TADVC and
AS_ENRICH,&H7E00,16,1,16,1,After Start Enrich vs Temp
CRANK_ENRICH,&H7E20,16,1,16,1,First time Inj vs Temp
COLD_START_ENRICH,&H7F30,16,1,16,1,Cold start enrich vs Temp <= 15 degC
WARM_START_ENRICH,&H7EB0,16,1,16,1,Warm start enrich vs Temp => 15degC

it does not jump in the eyes :-)

Re: Cranking fuel tables

Posted: Mon Jun 18, 2012 10:32 pm
by Matt
This is what I currently use. Based on the bit set check prior to the fuel / timing maps
bit7 when 0 means knock is occurring

Re: Cranking fuel tables

Posted: Mon Jun 18, 2012 10:37 pm
by Matt
This is from RB20 data but similar for Z32 VG30

7E00 TKAS EGI increasing in quantity revision 1×16 100/64%
7E20 TWST When starting output pulse width 1×16 TWK:10 ℃ Ms
7F30 TKTW2 EGI increasing in quantity factor 1×16 TWK:10 ℃ 100/64%
7EB0 TKTW EGI increasing in quantity factor 1×16 TWK:10 ℃ 100/64%

Re: Cranking fuel tables

Posted: Mon Jun 18, 2012 11:33 pm
by RomChip200
Matt wrote:This is what I currently use. Based on the bit set check prior to the fuel / timing maps
bit7 when 0 means knock is occurring
But be careful, at the end, that's the bit2 in 0x5A that tells you if you're still using the knock maps or not.
Because the knock may have disappeared but you're still using knock maps (till you shutdown and restart the engine).

Code: Select all


RAM1:005A flags10:            rmb 1                         ; ...
RAM1:005A                                                   ; Bit 2: 1=normal map, 0=knock map

RAM1:0082 flags8:             rmb 1                         ; ...
RAM1:0082                                                   ; Bit 1: 1=inside knock learn region
RAM1:0082                                                   ; Bit 7: 0=knock

knock occurrence:

CODE:B955 ci_86:                                            ; ...
CODE:B955                     ldd timing_offset2
CODE:B958                     std timing_offset_old
CODE:B95B                     tim #%10000000, flags8        ; Bit 1: 1=inside knock learn region
CODE:B95B                                                   ; Bit 7: 0=knock
CODE:B95E                     bne ci_87
CODE:B95E 
CODE:B960                     ldaa knock_value
CODE:B963                     cmpa knock_low
CODE:B966                     ble ci_88
CODE:B966 
CODE:B968                     oim #%10000000, flags8        ; Bit 1: 1=inside knock learn region
CODE:B968                                                   ; Bit 7: 0=knock
CODE:B96B                     bra ci_88
CODE:B96B 
CODE:B96D 
CODE:B96D ci_87:                                            ; ...
CODE:B96D                     ldaa knock_value
CODE:B970                     cmpa knock_high
CODE:B973                     bgt ci_88
CODE:B973 
CODE:B975                     aim #%1111111, flags8         ; Bit 1: 1=inside knock learn region
CODE:B975                                                   ; Bit 7: 0=knock
CODE:B978 
CODE:B978 ci_88:                                            ; ...
CODE:B978                     rts
CODE:B978 
CODE:B978 ; End of function compute_ignition

On the first knock occurrence, the switch to knock maps is memorized in flags10, and flags10 supersedes flags8:

CODE:CD2D loc_1429:                                         ; ...
CODE:CD2D                     aim #%11111, interp_flags     ; Bit 6: 0=rpm, 1=tp_d2_filt
CODE:CD30                     oim #%10100, interp_flags     ; Bit 6: 0=rpm, 1=tp_d2_filt
CODE:CD33                     aim #%10111111, flags7        ; Bit 0: EGR off
CODE:CD36                     ldx #timing_map_knock
CODE:CD39                     aim #%11111011, flags10       ; Bit 2: 1=normal map, 0=knock map
CODE:CD3C                     tim #%10000000, flags8        ; Bit 1: 1=inside knock learn region
CODE:CD3C                                                   ; Bit 7: 0=knock
CODE:CD3F                     beq loc_6697
CODE:CD3F 
CODE:CD41                     ldx #timing_map
CODE:CD44                     oim #%100, flags10            ; Bit 2: 1=normal map, 0=knock map
CODE:CD47 
CODE:CD47 loc_6697:                                         ; ...
CODE:CD47                     stx param_map
CODE:CD49                     ldx #ign_rpm_scale
CODE:CD4C                     stx param_rpm
CODE:CD4E                     ldx #ign_tp_scale
CODE:CD51                     stx param_tp
CODE:CD53                     jsr interp_2D
CODE:CD53 
CODE:CD56                     suba #128
CODE:CD58                     psha                          ; Push timing
CODE:CD59                     tim #%100, flags10            ; Bit 2: 1=normal map, 0=knock map
CODE:CD5C                     bne loc_6698
CODE:CD5C 
CODE:CD5E                     tim #%10, flags10             ; Bit 2: 1=normal map, 0=knock map
CODE:CD61                     beq loc_1433
CODE:CD61 
CODE:CD63                     aim #%11111101, flags10       ; Bit 2: 1=normal map, 0=knock map
CODE:CD66                     ldx #timing_map
CODE:CD69                     bra loc_6699
CODE:CD69 
CODE:CD6B 
CODE:CD6B loc_6698:                                         ; ...
CODE:CD6B                     tim #%10, flags10             ; Bit 2: 1=normal map, 0=knock map
CODE:CD6E                     bne loc_1433
CODE:CD6E 
CODE:CD70                     oim #%10, flags10             ; Bit 2: 1=normal map, 0=knock map
CODE:CD73                     ldx #timing_map_knock
CODE:CD76 
CODE:CD76 loc_6699:                                         ; ...
CODE:CD76                     stx param_map
CODE:CD78                     aim #%11111, interp_flags     ; Bit 6: 0=rpm, 1=tp_d2_filt
CODE:CD7B                     oim #%10100, interp_flags     ; Bit 6: 0=rpm, 1=tp_d2_filt
CODE:CD7E                     ldx #ign_rpm_scale
CODE:CD81                     stx param_rpm
CODE:CD83                     ldx #ign_tp_scale
CODE:CD86                     stx param_tp
CODE:CD88                     ldx interp_y_input_save
CODE:CD8B                     stx interp_y_input
CODE:CD8D                     ldx interp_x_input_save
CODE:CD90                     stx interp_x_input
CODE:CD92                     jsr interp_1616






Re: Cranking fuel tables

Posted: Tue Jun 19, 2012 12:15 am
by Matt
Okay I was looking at the fuel maps again for the determination. Is the 0082 bit 7 only a temporary flag? Its used here for gear determination

CA32 : tim #$80X0082 (Upgear determination)
CA35 : beq LCA46
CA37 : tim #$80X0055 (Look at #55 bit 7 for knock)
CA3A : beq LCA41
CA3C : ldx #$F000 (Knock fuel)
CA3F : bra LCA53

CA41 : ldx #$FD00 (High fuel)
CA44 : bra LCA53

CA46 : tim #$80X0055 (Look at #55 bit 7 for knock)
CA49 : beq LCA50
CA4B : ldx #$F200 (Upgear knock fuel)
CA4E : bra LCA53

CA50 : ldx #$F100 (Upgear high fuel)

Re: Cranking fuel tables

Posted: Tue Jun 19, 2012 12:37 am
by RomChip200
Maybe the bit7 in 0x82 is kept to 0 a certain amount of time in case of knock.
In the routine you posted above, it's just to determine which fuel map to use from the 4 available, the normal (high gear) one or the knock (high gear) one.

Code: Select all

CODE:CA32                     tim #%10000000, flags8        ; Bit 1: 1=inside knock learn region
CODE:CA32                                                   ; Bit 7: 0=knock
CODE:CA35                     beq cf_6                      ; If not set then branch
CODE:CA35 
CODE:CA37                     tim #%10000000, flags6        ; Bit 7: High gear
CODE:CA3A                     beq cf_5                      ; If not set then branch
CODE:CA3A 
CODE:CA3C                     ldx #fuel_map_highgear
CODE:CA3F                     bra cf_8
CODE:CA3F 
CODE:CA41 
CODE:CA41 cf_5:                                             ; ...
CODE:CA41                     ldx #fuel_map
CODE:CA44                     bra cf_8
CODE:CA44 
CODE:CA46 
CODE:CA46 cf_6:                                             ; ...
CODE:CA46                     tim #%10000000, flags6        ; Bit 0: throttle switch (1=idle)
CODE:CA46                                                   ; Bit 1: high octane (if 1, becomes 0 when bit0 of flags5 is set to 1)
CODE:CA46                                                   ; Bit 2: neutral switch(1=neutral)
CODE:CA46                                                   ; Bit 3: power steering switch (1=on)
CODE:CA46                                                   ; Bit 4: A/C switch (1=on)
CODE:CA46                                                   ; Bit 7: gear engaged and high gear
CODE:CA49                     beq cf_7
CODE:CA49 
CODE:CA4B                     ldx #fuel_map_highgear_knock
CODE:CA4E                     bra cf_8
CODE:CA4E 
CODE:CA50 
CODE:CA50 cf_7:                                             ; ...
CODE:CA50                     ldx #fuel_map_knock
CODE:CA53 
CODE:CA53 cf_8:                                             ; ...
CODE:CA53                     stx param_map
CODE:CA55                     ldx #inj_rpm_scale
CODE:CA58                     stx param_rpm
CODE:CA5A                     ldx #inj_tp_scale
CODE:CA5D                     stx param_tp
CODE:CA5F                     jsr interp_2D
CODE:CA5F 
CODE:CA62                     staa inj_pulse_raw


Re: Cranking fuel tables

Posted: Tue Jun 19, 2012 1:07 pm
by Matt
What I was concerned about after looking at this code again and seeing the same sets of flags used on both sets of maps (fuel and timing). Your disassembly has the correct ordering which means an address file update for Z32

The original ROM Editor upgear/knock fuel map definitions are backwards. Z32 definitions are different to R32 etc because of the upgear maps
HIGH_FUEL,&H7D00,16,16,256,1,High octane Fuel map
REG_FUEL,&H7000,16,16,256,1,Low octane Fuel map
UPGEAR_HIGH_FUEL,&H7100,16,16,256,1,High-octane fuel map (more than gear position 4)
UPGEAR_REG_FUEL,&H7200,16,16,256,1,Regular fuel map (more than gear position 4)
Based on proper flag usage given #80x0082 is knock determination it actually should be
HIGH_FUEL,&H7D00,16,16,256,1,High octane Fuel map
REG_FUEL,&H7100,16,16,256,1,Low octane Fuel map
UPGEAR_HIGH_FUEL,&H7000,16,16,256,1,High-octane fuel map (more than gear position 4)
UPGEAR_REG_FUEL,&H7200,16,16,256,1,Regular fuel map (more than gear position 4)
Tried to verify with GRID Map Maker has 7000/7100/7200/7D00 but no proper labeling apart from Fuel map 1,2,3,4

I think using #$80X0082 is still fine for showing current fuel map when it is being used. I used knock sensor to test that part previously as with other ECUs to confirm the map switch after adding knock sensing based table highlighting to the software

Re: Cranking fuel tables

Posted: Tue Jun 19, 2012 6:16 pm
by RomChip200
To make it more clear, I should have posted this:

Code: Select all

RAM1:0055 flags6:             rmb 1  
RAM1:005A flags10:            rmb 1
RAM1:0082 flags8:             rmb 1



DATA:F000 fuel_map_highgear
DATA:F100 fuel_map_knock
DATA:F200 fuel_map_highgear_knock
DATA:FD00 fuel_map
DATA:F800 timing_map
DATA:FC00 timing_map_knock


CODE:CD2D loc_1429:                                         ; ...
CODE:CD2D                     aim #%11111, interp_flags     ; Bit 6: 0=rpm, 1=tp_d2_filt
CODE:CD30                     oim #%10100, interp_flags     ; Bit 6: 0=rpm, 1=tp_d2_filt
CODE:CD33                     aim #%10111111, flags7        ; Bit 0: EGR off
CODE:CD36                     ldx #timing_map_knock
CODE:CD39                     aim #%11111011, flags10       ; Bit 2: 1=normal map, 0=knock map
CODE:CD3C                     tim #%10000000, flags8        ; Bit 1: 1=inside knock learn region
CODE:CD3C                                                   ; Bit 7: 0=knock
CODE:CD3F                     beq loc_6697
CODE:CD3F 
CODE:CD41                     ldx #timing_map
CODE:CD44                     oim #%100, flags10            ; Bit 2: 1=normal map, 0=knock map
CODE:CD47 
CODE:CD47 loc_6697:                                         ; ...
CODE:CD47                     stx param_map
CODE:CD49                     ldx #ign_rpm_scale
CODE:CD4C                     stx param_rpm
CODE:CD4E                     ldx #ign_tp_scale
CODE:CD51                     stx param_tp
CODE:CD53                     jsr interp_2D
CODE:CD53 
CODE:CD56                     suba #128
CODE:CD58                     psha                          ; Push timing
CODE:CD59                     tim #%100, flags10            ; Bit 2: 1=normal map, 0=knock map
CODE:CD5C                     bne loc_6698
CODE:CD5C 
CODE:CD5E                     tim #%10, flags10             ; Bit 2: 1=normal map, 0=knock map
CODE:CD61                     beq loc_1433
CODE:CD61 
CODE:CD63                     aim #%11111101, flags10       ; Bit 2: 1=normal map, 0=knock map
CODE:CD66                     ldx #timing_map
CODE:CD69                     bra loc_6699
CODE:CD69 
CODE:CD6B 
CODE:CD6B loc_6698:                                         ; ...
CODE:CD6B                     tim #%10, flags10             ; Bit 2: 1=normal map, 0=knock map
CODE:CD6E                     bne loc_1433
CODE:CD6E 
CODE:CD70                     oim #%10, flags10             ; Bit 2: 1=normal map, 0=knock map
CODE:CD73                     ldx #timing_map_knock
CODE:CD76 
CODE:CD76 loc_6699:                                         ; ...
CODE:CD76                     stx param_map
CODE:CD78                     aim #%11111, interp_flags     ; Bit 6: 0=rpm, 1=tp_d2_filt
CODE:CD7B                     oim #%10100, interp_flags     ; Bit 6: 0=rpm, 1=tp_d2_filt
CODE:CD7E                     ldx #ign_rpm_scale
CODE:CD81                     stx param_rpm
CODE:CD83                     ldx #ign_tp_scale
CODE:CD86                     stx param_tp
CODE:CD88                     ldx interp_y_input_save
CODE:CD8B                     stx interp_y_input
CODE:CD8D                     ldx interp_x_input_save
CODE:CD90                     stx interp_x_input
CODE:CD92                     jsr interp_1616

So, yes, this is aligned with:
Matt wrote: HIGH_FUEL,&H7D00,16,16,256,1,High octane Fuel map
REG_FUEL,&H7100,16,16,256,1,Low octane Fuel map
UPGEAR_HIGH_FUEL,&H7000,16,16,256,1,High-octane fuel map (more than gear position 4)
UPGEAR_REG_FUEL,&H7200,16,16,256,1,Regular fuel map (more than gear position 4)

Re: Cranking fuel tables

Posted: Tue Jun 19, 2012 11:12 pm
by Matt
Are you using IDA pro for your disassembly? I need to use that one day but never get enough time with one particular ECU to go right through it unfortunately so just work with DASMX and some scripts to clean up the symbols

With my symbol tables end up using
symbol addr "addr_name"

This way you get to see the memory addresses next to the symbol name in the code still

Re: Cranking fuel tables

Posted: Wed Jun 20, 2012 12:54 am
by RomChip200
Matt wrote:Are you using IDA pro for your disassembly?
Yes
Matt wrote: This way you get to see the memory addresses next to the symbol name in the code still
In IDAPro, you just have to pass the mouse cursor over the symbol to have the corresponding address and data content highlighted.
IDAPro has some useful features as showing all the xrefs to one symbol, you can display a call tree to one routine .... all the things that help you to understand the inter-dependencies ...

Re: Cranking fuel tables

Posted: Wed Jun 20, 2012 1:56 am
by RomChip200
Regarding, injector pulses values during cranking, I attached a log with control flags.
Have a look when starter bit (ST) is set.
ST is set for 0.8s and injectors values start from 23ms to 10ms:
Time RPM RPM Ref Temp Speed TPS Fuel temp DCFlags1 DCFlags2 Inj time (LHS) Inj time (RHS) Timing AAC AF Alpha (LHS) AF Alpha (RHS) TP Lambda LHS Lambda RHS AFR AFR RHS TP (MSB) Injector duty AOI Knock Timing flag Knock Fuel flag
00:08.5 0 0 16 0 0.46 -50 __ __ NT __ TP __ __ __ __ __ __ __ 1.32 1.32 16 0 100 100 0 [0] 1.36 1.29 20.1 19.1 0 0 ___ __ __
00:08.6 125 0 16 0 0.46 -50 __ __ NT ST TP __ __ __ __ __ __ __ 23 23 16 0 100 100 0 [0] 1.36 1.29 20.1 19.1 0 2 ___ __ __
00:08.7 162 0 16 0 0.46 -50 __ __ NT ST TP __ __ __ FP __ __ __ 22 22 16 0 100 100 2961 [11] 1.36 1.29 20.1 19.1 11 2 ___ __ __
00:08.8 200 0 16 0 0.46 -50 __ __ NT ST TP __ __ __ FP __ __ __ 20 20 16 0 100 100 3733 [14] 1.36 1.29 20.1 19.1 14 3 ___ __ __
00:08.9 212 0 16 0 0.46 -50 __ __ NT ST TP __ __ __ FP __ __ __ 21 21 16 0 100 100 4375 [17] 1.36 1.29 20.1 19.1 17 3 ___ __ __
00:09.1 225 0 16 0 0.46 -50 __ __ NT ST TP __ __ __ FP __ __ __ 19 19 16 0 100 100 4325 [16] 1.36 1.29 20.1 19.1 16 3 ___ __ __
00:09.2 200 0 16 0 0.46 -50 __ __ NT ST TP __ __ __ FP __ __ __ 20 20 16 0 100 100 5062 [19] 1.36 1.29 20.1 19.1 19 3 ___ __ __
00:09.3 200 0 16 0 0.46 -50 __ __ NT ST TP __ __ __ FP __ __ __ 20 20 16 0 100 100 5552 [21] 1.36 1.29 20.1 19.1 21 3 ___ __ __
00:09.4 475 0 16 0 0.46 -50 __ __ NT ST TP __ __ __ FP __ __ __ 10 10 16 0 100 100 3746 [14] 1.36 1.29 20.1 19.1 14 3 ___ __ __
00:09.5 925 0 16 0 0.46 -50 __ __ NT __ TP __ __ __ FP __ __ __ 5.97 5.97 28 0 100 100 2679 [10] 1.36 1.29 20.1 19.1 10 4 ___ __ __
NIStune_2012-06-18_0805_59.csv
(784.2 KiB) Downloaded 244 times
To give some reference, @WOT maxTP, injector pulse is about 15-16ms.
I run 740cc instead of 370cc and E85 fuel.
Z32.

Re: Cranking fuel tables

Posted: Wed Jun 20, 2012 7:29 pm
by RomChip200
Coming back to the 7E20 CRANK enrich table:

from my logs I can tell this table directly contains some injector pulses durations in ms and interpolation is done according to temp.
e.g. if engine temp is 22°C when exercising the starter, the ECU will start with a 15ms pulse on all injectors.
if engine temp is 16°C when exercising the starter, the ECU will start with a 23ms pulse on all injectors.

Code: Select all

-40   -30    -20   -10    0      10     20    30    40      50    60     70     80     90     100   110
120	120	75	67	46	33	17	11	9	8	6	6	6	6	6	6

Re: Cranking fuel tables

Posted: Thu Jun 21, 2012 11:58 pm
by Matt
That is right it should be ms. Its been fixed up now so CRANK_ENRICH is what FT_INJECT used to be

Re: Cranking fuel tables

Posted: Wed Jun 27, 2012 3:05 am
by Matt
Automatic calculations are only to provide a start point

romchip with the scaling I used the injection resize on my R31 and R34 to get initial values correct due to flooding on startup (due using fixed ms time). Perhaps E85 requires more tweaking?

My adjustments were for smaller injectors 270CC > 444CC (R31) [Crank enrich table only] x1.64
After start/after idle were left alone

Adjustments for the R34 380CC > 480CC were smaller adjustments to the crank enrich and crank enrich offset table x 1.26

These are not as big as the 2x on your vehicle, so the automatic scalings are subjective. Apart from pulling back the scaling on larger multiples cant really think of how to improve this functionality otheriwse