Page 2 of 5

Re: Flex Fuel Control

Posted: 2024 Dec 16, 12:16
by wwhite
efloth wrote: 2024 Dec 13, 14:23 It appears that the 106 KAM addresses are from [74d] to [7b7] based on this routine. Thinking of using [7b8] for KAMAFR

Code: Select all

a10d: ad,6a,30            ldzbw R30,6a           wR30 = 6a;    # 106 entries
a110: 01,38               clrw  R38              R38 = 0;
a112: b3,fe,3c,3a         ldb   R3a,[Rfe+3c]     R3a = [bc92];
a116: 38,3a,1c            jb    B0,R3a,a135      if (B0_R3a = 0)  {
a119: af,31,4d,07,3a      ldzbw R3a,[R30+74d]    wR3a = [R30+74d];    # ADAPTIVE FUEL TABLE
a11e: 64,3a,38            ad2w  R38,R3a          R38 += R3a;    # SUM OF ADAPTIVE FUEL CELLS
a121: e0,30,f5            djnz  R30,a119         R30--;
                                                 if (R30 != 0) goto a119;    # loop all KAM entries
                                                 
The code routine above is for KAM_VALIDATION_PROCEDURE.

bc92 "CHKFLG", usually zero, if 1, then KAM is assumed to be valid.

Re: Flex Fuel Control

Posted: 2024 Dec 16, 19:32
by efloth
I have checked and cannot find any reference to any memory address in the 7b8-7d9 range in the A1C code. I can see that [74c] is KAM_CHKSUM so it is possible the KAM Address space is below the 106 adaptive fuel entries. Is the KAM address range documented somewhere? I'll be reading on that.

Re: Flex Fuel Control

Posted: 2024 Dec 16, 20:10
by wwhite
I commented the code above.
Comments are from LHBH1 documents.

I’ll check for specifics later.

Re: Flex Fuel Control

Posted: 2024 Dec 18, 15:30
by efloth
KAMQA is the first KAM address [700]. FWIW here is a simple patch to always force KAMs to be reset.
Screenshot 2024-12-18 122930.png

Re: Flex Fuel Control

Posted: 2024 Dec 18, 16:20
by efloth
If this screenshot is accurate the KAM Locations are from [700] to [8ff] but only [700] to [7b7] are being used.
Screenshot 2024-12-18 130929.png
Only the 6 ISCKAM and 106 Adaptive Fuel locations are checksum'd (stored at [702] for ISC and [74C] for fuel). The remaining KAM locations are assumed to be correct unless KAMQA-KAMQC are found to be different than their initial special pattern values.

Re: Flex Fuel Control

Posted: 2024 Dec 18, 16:46
by efloth
[716] looks like a winner:

Code: Select all

700	KAMQA
702	ISKSUM
705	KAM_BIT_FLAGS
706	BPKAM
707	BPKYON
708	BPPTWT
709	BPPTWThi
70a	ISCKAM0
70c	ISCKAM1
70e	ISCKAM2
710	ISCKAM3
712	ISCKAM4
714	ISCKAM5
716	AVAILABLE for use -  KAMAFR
718	KAMQB
747	KWUCTR
748	KAMQC
74A	LTMTBLrc
74C	KAM_CHKSUM
74D-7B7	Adaptive Fuel

Re: Flex Fuel Control

Posted: 2024 Dec 18, 20:02
by efloth
Part 1 done.

Before:

Code: Select all

50a9: 6d,e5,8b,3c         ml2w  R3c,8be5         lR3c *= 8be5;
After:

Code: Select all

50a9: 6f,ee,96,3c         ml2w  R3c,[Ree+96]     lR3c *= [716];

Re: Flex Fuel Control

Posted: 2024 Dec 19, 11:01
by wwhite
How are you going to initialize 0x716 on startup, and set 0x716?

I have comments in my code:

Code: Select all

DETERMINE BASE FUEL FLOW (BASEFF)
# BASEFF is used in the foreground fuel  calculation  and  contains  base  fuel
#   flow, unadjusted for transient fuel, AE fuel, or injector hardware.
50a5: a3,e4,f0,3c         ldw   R3c,[Re4+f0]     R3c = [KAMRF1];
50a9: 6d,e5,8b,3c         ml2w  R3c,8be5         lR3c *= 8be5;                     
# 0x8be5 = 35813; 2^19 = 524288; 524288/35813 = 14.64
So, 8b35 is the stoichiometric for gas in hex, why not just change the stoichiometric to the ratio it should be for the fuel you are running?

Flex fuel should be stoichiometric 9.76, so why set a ram variable, when you can set it statically like it was?

9.76 = 524288 / FLEX_STOICH
FLEX_STOICH = (524288 / 9.76 ) = 53718 = 0xd1d6

Can you not just change 8be5 to d1d6?

Re: Flex Fuel Control

Posted: 2024 Dec 19, 11:29
by efloth
That is what I have done for the last year. The problem is e85 is not available everywhere and my wife always ends up with a random fuel mix when she drives it. Also, running gasoline occasionally cleans out any goo that builds up on the injectors.

[716] will be initialized to AAAA (12:1) when KAMs are determined to be invalid. In the logic I will also re-initialize if the value ends up less than 9 or greater than 15 just for safety reasons. The truck also has two tanks that can end up with a different mix. The idea is to always have the ECU adjust for the correct OL operation when cruising or WOT.

Re: Flex Fuel Control

Posted: 2024 Dec 19, 18:56
by efloth
Part 2 done. Initialization of [716] as AAAA

Before:

Code: Select all

3a2e: c7,ee,80,42         stb   R42,[Ree+80]     [700] = R42;
3a32: c7,ee,98,30         stb   R30,[Ree+98]     [718] = R30;
3a36: c7,ee,c8,32         stb   R32,[Ree+c8]     [748] = R32;
After:

Code: Select all

3a2e: ef,cf,68            call  a300             Sub_a300 ();
3a31: ff                  nop                    
3a32: c7,ee,98,30         stb   R30,[Ree+98]     [718] = R30;
3a36: c7,ee,c8,32         stb   R32,[Ree+c8]     [748] = R32;

Sub_a300:
a300: c7,ee,80,42         stb   R42,[Ree+80]     [700] = R42;
a304: a1,aa,aa,42         ldw   R42,aaaa         R42 = aaaa;
a308: c3,ee,96,42         stw   R42,[Ree+96]     [716] = R42;
a30c: f0                  ret                    return;