follow ft86club on our blog, twitter or facebook.
FT86CLUB
Ft86Club
Delicious Tuning
Register Garage Community Calendar Today's Posts Search

Go Back   Toyota GR86, 86, FR-S and Subaru BRZ Forum & Owners Community - FT86CLUB > Technical Topics > Software Tuning

Software Tuning Discuss all software tuning topics.


User Tag List

Reply
 
Thread Tools Search this Thread
Old 11-13-2015, 03:35 AM   #29
Kodename47
Senior Member
 
Kodename47's Avatar
 
Join Date: Oct 2012
Drives: UK GT86
Location: UK
Posts: 3,040
Thanks: 185
Thanked 1,629 Times in 1,112 Posts
Mentioned: 155 Post(s)
Tagged: 1 Thread(s)
Quote:
Originally Posted by ztan View Post
When looking at the disassembly and running that bit of code through the HEW simulator, that table returns a value of 1.0 (scaling factor 1.0 = 0% compensation). I changed my def to suit as well as started thinking in terms of scaling factors rather than % compensation.
That's how ECUtek is and how I have my own, I much prefer it as a ratio/multiplier than a +/- % value. I just converted them too % as that's what seems to be common and everyone is used to.

As you say, it's also how the tables actually are in the ROMs so it's easier when looking through the likes of ScoobyROM or WInOLS to pick out the tables.

In case you didn't have it this is my up-to-date A01G with ratios and metric values.
__________________
.: Stealth 86 :.
Abbey Motorsport/K47 Tuned Sprintex 210 Supercharger

Kodename 47 DJ:
Soundcloud / Instagram / Facebook
Kodename47 is offline   Reply With Quote
Old 11-15-2015, 12:30 AM   #30
ztan
Senior Member
 
Join Date: Jul 2013
Drives: Toyota 86
Location: Gold Coast, Australia
Posts: 311
Thanks: 44
Thanked 358 Times in 142 Posts
Mentioned: 60 Post(s)
Tagged: 0 Thread(s)
TRAC switch doubleclick

Off topic, but related.

With the Arduino Nano going in as a FlexFuel Sensor controller, there is space for much more to be added on. I decided to make a doubleclick TRAC control switch so I don't have to hold down the TRAC switch down for 3+ seconds to turn if off. Simple code and adds 2 resistors and an NPN transistor to the circuitry.

If you want it on by default, set initial button state to 4, which acts as a doubleclick a certain time (TRAC_initializeDelay) after power on.

Why not the full pedal dance? Mine is a street car and we in Australia can't use the speeds on road which people have issues with VSC activating brakes at, requiring the pedal dance to be used or sent over CANBUS like with OFT. Out of interest, can anyone share the CAN sequence needed for pedal dance active?

Code, schematic, and picture of controller box with FlexFuel sensor leads, TRAC switch leads, PLX serial interface.

Updated Arduino code:
Code:
//Flex Fuel sensor code
//Input frequency on pin 8 - pulled up to 5V through 1.8K resistor
//V_out pin 3 - 0-5V output through 1.8K resistor with 10uf capacitor to ground
//PLX iMFD serial packet on Tx pin 0 through 3.3V TTL voltage divider (3.3K/6.8K)

//TRAC double click code
//Input switch on pin 6 - pulled up to 5V through 3.3K resistor
//Output on pin 10 through NPN transistor to take VSC connection to ground

#include <Arduino.h>
#include <FreqMeasure.h>

//FlexFuel sensor
double sum = 0;
int count = 0;
int ethanol_int, V_out_int;
float freq, ethanol, V_out, E_scalar;
float E0 = 50; //calibration data for pure gasoline
float E85 = 135; //calibration data for E85

//PLX data
long P0, P1, Pdelta;
byte PLXpacket[7] {0x80, 0x00, 0x11, 0x00, 0x00, 0x00, 0x40};

//PLX iMFD packet, sent every 100ms:
//0x80      Start byte
//0x00 0x11 Sensor device fuel level
//0x00      Sensor instance
//0x00 0x00 Sensor value (integer, unscaled)
//0x40      Stop byte

//TRAC switch double click
bool TRAC_buttonMonitor = HIGH;
int debounce = 20;
int doubleClick = 200;
int longClick = 3500;
int TRAC_initializeDelay = 5000;
int TRAC_buttonState = 0; //initialize to 0 for normal operation, 4 for on by default after delay
long TRAC_buttonCounter = 0;


void setup()
{
  pinMode (3, OUTPUT);
  pinMode (10, OUTPUT);
  digitalWrite (10, LOW);
  pinMode (6, INPUT);

  FreqMeasure.begin();
  Serial.begin(19200);
  P0 = millis();
  E_scalar = (E85 - E0) / 85;
}

void loop()
{

  //Read FlexFuel sensor frequency
  if (FreqMeasure.available())
  {
    // average several readings together
    sum = sum + FreqMeasure.read();
    count = count + 1;
    if (count > 30)
    {
      freq = FreqMeasure.countToFrequency(sum / count);
      sum = 0;
      count = 0;
    }
  }

  //Convert frequency to E%

  ethanol = (freq - E0) / E_scalar; //scale frequency to E% interpolating E0 and E85 values
  if (ethanol > 100)
  {
    ethanol = 100;
  }
  if (ethanol < 0)
  {
    ethanol = 0;
  }
  ethanol_int = (int)ethanol;

  //FlexFuel voltage output

  V_out = 5 - (0.05 * ethanol);
  V_out = 51 * V_out; //scale to 255
  V_out_int = (int)V_out; //convert to integer for analogWrite

  analogWrite(3, V_out_int); //output V_out as PWM voltage on pin 3

  //PLX data packet

  P1 = millis(); //send PLX packet on Tx pin every 100ms
  Pdelta = P1 - P0;
  if (Pdelta >= 100)
  {
    P0 = P1;
    PLXpacket[5] = ethanol_int; //set data byte in PLX packet to E%
    Serial.write(PLXpacket, 7);
  }

  //TRAC switch doubleclick

  TRAC_buttonMonitor = digitalRead(6);
  switch (TRAC_buttonState)
  {
    case 0: //inactive

      if (TRAC_buttonMonitor == LOW)  // button pressed
      {
        digitalWrite (10, HIGH); //Transistor on
        TRAC_buttonState = 1; //increment state
      }
      break;

    case 1: //check for release
      if (TRAC_buttonMonitor == HIGH) //if button released
      {
        TRAC_buttonCounter = millis(); //start counter
        TRAC_buttonState = 2; //increment state
      }
      break;

    case 2: //wait for doubleClick
      if (TRAC_buttonMonitor == LOW && (millis() - TRAC_buttonCounter) > debounce && (millis() - TRAC_buttonCounter) < doubleClick) //second click registered
      {
        TRAC_buttonState = 3; //increment state
      }
      else if ((millis() - TRAC_buttonCounter) > doubleClick)
      {
        digitalWrite (10, LOW); //Transistor off
        TRAC_buttonState = 0; //reset state
      }
      break;

    case 3: //doubleClick made
      if ((millis() - TRAC_buttonCounter) > longClick)
      {
        digitalWrite (10, LOW); //Transistor off
        TRAC_buttonState = 0; //reset state
      }
      break;

    case 4: //initialize after delay by default
      if (millis() > TRAC_initializeDelay)
      {
        digitalWrite (10, HIGH); //Transistor on
        TRAC_buttonCounter = millis(); //start counter
        TRAC_buttonState = 3; //set state to doubleClick
      }
      break;
  }

}
Attached Images
  

Last edited by ztan; 11-24-2015 at 04:31 AM.
ztan is offline   Reply With Quote
The Following 7 Users Say Thank You to ztan For This Useful Post:
DustinS (11-15-2015), EAGLE5 (11-15-2015), fer3d (01-05-2024), freerunner (11-15-2015), solidONE (11-24-2015), thambu19 (11-24-2015), Wayno (06-02-2016)
Old 11-18-2015, 06:03 AM   #31
ztan
Senior Member
 
Join Date: Jul 2013
Drives: Toyota 86
Location: Gold Coast, Australia
Posts: 311
Thanks: 44
Thanked 358 Times in 142 Posts
Mentioned: 60 Post(s)
Tagged: 0 Thread(s)
Applying scalings to injector routines

Having calculated a fuelling multiplier based on E% and scaling the stock PI (Injector scaling BRZ) and DI (DI pressure multiplier C) multiplier values in the routine described above in post #15, we need to get these values read in the fueling routines.

In the previous code, the following values are shown in the data segment following the code:
Code:
000B98B0 FF F8 D4 18 off_B98B0:      .data.l RAM_Flex_PI_Scaling ; DATA XREF: sub_B97C0
000B98B4 FF F8 D4 1C off_B98B4:      .data.l RAM_Flex_GDI_Mult_C ; DATA XREF: sub_B97C0
000B98CC 00 10 C6 80 off_B98CC:      .data.l Injector_Flow_Scaling_BRZ
000B98CC                                                     ; DATA XREF: sub_B97C0
000B98D0 00 10 C6 14 off_B98D0:      .data.l GDI_Pressure_Multiplier_C
000B98D0                                                     ; DATA XREF: sub_B97C0
The PI injector scaling is at 10C680 and the DI multiplier is at 10C614

What we need to do is find where in the ROM these values exist to be referenced and change them to point to our Flex Fuel scalars in RAM (FFF8D418 for PI and FFF8D41C for DI).

This is as simple as searching for 0010C680 and replacing with FFF8D418 (6 instances) and 0010C614 and replacing with FFF8D41C (1 instance). All these instances are referenced by code appropriately:
Code:
Address      Function  Instruction                      
-------      --------  -----------                      
ROM:0003D260           .data.l Injector_Flow_Scaling_BRZ
ROM:0003F7FC           .data.l Injector_Flow_Scaling_BRZ
ROM:00058528           .data.l Injector_Flow_Scaling_BRZ
ROM:00058AF0 sub_585FC .data.l Injector_Flow_Scaling_BRZ
ROM:0007B938           .data.l Injector_Flow_Scaling_BRZ
ROM:000A779C sub_A7280 .data.l Injector_Flow_Scaling_BRZ

Address      Function Instruction                      
-------      -------- -----------                      
ROM:0005763C          .data.l GDI_Pressure_Multiplier_C
ztan is offline   Reply With Quote
The Following 6 Users Say Thank You to ztan For This Useful Post:
DustinS (11-18-2015), EAGLE5 (11-18-2015), freerunner (11-18-2015), solidONE (11-24-2015), thambu19 (11-24-2015), Wayno (06-02-2016)
Old 11-24-2015, 04:39 AM   #32
ztan
Senior Member
 
Join Date: Jul 2013
Drives: Toyota 86
Location: Gold Coast, Australia
Posts: 311
Thanks: 44
Thanked 358 Times in 142 Posts
Mentioned: 60 Post(s)
Tagged: 0 Thread(s)
Cranking Compensations

Edit ***This v.1 code has not worked the way I thought - I get an appropriate multiplier and this does not get applied to the cranking fuel. Error due to delay in Arduino reading ethanol. v.2 code in Post #46, v.3 code in Post #49. ***

For this, we'll hijack the IAT cranking compensation lookup table which normally returns 1.0 for all IAT temperatures. There are two references to the IAT cranking compensation lookup table and we'll hook both to insert an ECT based cranking multiplier which is scaled by the Flex Fuelling multiplier.

Stock code location A:
Code:
ROM:00057880             loc_57880:                              ; CODE XREF: Cranking_Fuelling_Comp
ROM:00057880 D4 24                       mov.l   #stru_B424C, r4
ROM:00057882 D6 21                       mov.l   #Pull_2D_A, r6
ROM:00057884 46 0B                       jsr     @r6 ; Pull_2D_A
ROM:00057886 F4 EC                       fmov    fr14, fr4
ROM:00057888 3D 01 30 02                 fmov.s  fr0, @((RAM_Cranking_Comp_Accel - RAM_Cranking_Comp),r13)
ROM:0005788C
ROM:0005788C             loc_5788C:                              ; CODE XREF: Cranking_Fuelling_Comp
ROM:0005788C D4 22                       mov.l   #Table_Cranking_Fuel_IPW_Compensation_IAT, r4
ROM:0005788E D6 1E                       mov.l   #Pull_2D_A, r6
ROM:00057890 46 0B                       jsr     @r6 ; Pull_2D_A
ROM:00057892 F4 FC                       fmov    fr15, fr4
ROM:00057894 3D 01 30 03                 fmov.s  fr0, @((RAM_Cranking_Comp_IAT - RAM_Cranking_Comp),r13)
ROM:00057898 B0 05                       bsr     Apply_Cranking_Compensation
ROM:0005789A 64 E3                       mov     r14, r4
ROM:0005789C FD 0A                       fmov.s  fr0, @r13

ROM:00057918 00 0B 42 20 off_57918:      .data.l Table_Cranking_Fuel_IPW_Compensation_IAT
ROM:00057918                                                     ; DATA XREF: Cranking_Fuelling_Comp:loc_5788C
Flex Fuel Code Location A:
Code:
00057880             loc_57880:                              ; CODE XREF: Cranking_Compensations
00057880 D4 24                       mov.l   #off_B424C, r4
00057882 D6 21                       mov.l   #Pull_2D_A, r6
00057884 46 0B                       jsr     @r6 ; Pull_2D_A
00057886 F4 EC                       fmov    fr14, fr4
00057888 3D 01 30 02                 fmov.s  fr0, @((RAM_Cranking_Comp_Accel - Cranking_Final),r13)
0005788C
0005788C             loc_5788C:                              ; CODE XREF: Cranking_Compensations
0005788C D2 22                       mov.l   #FlexFuel_Cranking_Comp, r2
0005788E 04 80 90 A4                 movi20  #RAM_ECT, r4 
00057892 42 4B                       jsr/n   @R2 ; FlexFuel_Cranking_Comp
00057894 3D 01 30 03                 fmov.s  fr0, @((RAM_Cranking_Comp_Flex_Fuel - Cranking_Final),r13)
00057898 B0 05                       bsr     sub_578A6
0005789A 64 E3                       mov     r14, r4
0005789C FD 0A                       fmov.s  fr0, @((Cranking_Final - Cranking_Final),r13)

00057918 00 0B 98 70 off_57918:      .data.l FlexFuel_Cranking_Comp
00057918                                                     ; DATA XREF: Cranking_Compensations:loc_5788C

000B9870             FlexFuel_Cranking_Comp:                 ; CODE XREF: Cranking_Compensations
000B9870                                                     ; Cranking_Compensations_0
000B9870                                                     ; DATA XREF: ...
000B9870 4F 22                       sts.l   pr, @-r15
000B9872 F4 48                       fmov.s  @r4, fr4        ; r4=ECT
000B9874 02 10 13 88                 movi20  #Pull_2D_A, r2
000B9878 D4 19                       mov.l   #Ethanol_Cranking_Comp_Table, r4 ; Pull_2D_A
000B987A 42 4B                       jsr/n   @R2 ; Pull_2D_A
000B987C D4 0E                       mov.l   #RAM_Flex_Crank_Comp, r4
000B987E F5 9D                       fldi1   fr5
000B9880 D6 0A                       mov.l   #RAM_Flex_Fuelling_Multiplier, r6
000B9882 F4 68                       fmov.s  @r6, fr4
000B9884 F4 51                       fsub    fr5, fr4        ; fr4-1.0
000B9886 F5 4E                       fmac    fr0, fr4, fr5   ; 1+(crank_comp*(fuelling multiplier-1))
000B9888 F0 5C                       fmov    fr5, fr0
000B988A F4 0A                       fmov.s  fr0, @r4
000B988C 4F 26                       lds.l   @r15+, pr
000B988E 00 6B                       rts/n
Stock code location B:
Code:
ROM:00057F4C D4 18                       mov.l   #Table_Cranking_Fuel_IPW_Compensation_Accelerator, r4
ROM:00057F4E D2 17                       mov.l   #Pull_2D_A, r2
ROM:00057F50 42 0B                       jsr     @R2 ; Pull_2D_A
ROM:00057F52 F4 EC                       fmov    fr14, fr4
ROM:00057F54 FC 0C                       fmov    fr0, fr12
ROM:00057F56 D4 17                       mov.l   #Table_Cranking_Fuel_IPW_Compensation_IAT, r4
ROM:00057F58 D2 14                       mov.l   #Pull_2D_A, r2
ROM:00057F5A 42 0B                       jsr     @R2 ; Pull_2D_A
ROM:00057F5C F4 FC                       fmov    fr15, fr4
ROM:00057F5E FE 0C                       fmov    fr0, fr14

ROM:00057FB4 00 0B 42 20 off_57FB4:      .data.l Table_Cranking_Fuel_IPW_Compensation_IAT
ROM:00057FB4                                                     ; DATA XREF: sub_57F00
Flex Fuel Code Location B:
Code:
00057F4C D4 18                       mov.l   #Table_Cranking_Fuel_IPW_Compensation_Accelerator, r4
00057F4E D2 17                       mov.l   #Pull_2D_A, r2
00057F50 42 0B                       jsr     @R2 ; Pull_2D_A
00057F52 F4 EC                       fmov    fr14, fr4
00057F54 FC 0C                       fmov    fr0, fr12
00057F56 D2 17                       mov.l   #FlexFuel_Cranking_Comp, r2
00057F58 04 80 90 A4                 movi20  #RAM_ECT, r4 ; FlexFuel_Cranking_Comp
00057F5C 42 4B                       jsr/n   @R2 ; FlexFuel_Cranking_Comp
00057F5E FE 0C                       fmov    fr0, fr14

00057FB4 00 0B 98 70 off_57FB4:      .data.l FlexFuel_Cranking_Comp
00057FB4                                                     ; DATA XREF: Cranking_Compensations_0

000B9870             FlexFuel_Cranking_Comp:                 ; CODE XREF: Cranking_Compensations
000B9870                                                     ; Cranking_Compensations_0
000B9870                                                     ; DATA XREF: ...
000B9870 4F 22                       sts.l   pr, @-r15
000B9872 F4 48                       fmov.s  @r4, fr4        ; r4=ECT
000B9874 02 10 13 88                 movi20  #Pull_2D_A, r2
000B9878 D4 19                       mov.l   #Ethanol_Cranking_Comp_Table, r4 ; Pull_2D_A
000B987A 42 4B                       jsr/n   @R2 ; Pull_2D_A
000B987C D4 0E                       mov.l   #RAM_Flex_Crank_Comp, r4
000B987E F5 9D                       fldi1   fr5
000B9880 D6 0A                       mov.l   #RAM_Flex_Fuelling_Multiplier, r6
000B9882 F4 68                       fmov.s  @r6, fr4
000B9884 F4 51                       fsub    fr5, fr4        ; fr4-1.0
000B9886 F5 4E                       fmac    fr0, fr4, fr5   ; 1+(crank_comp*(fuelling multiplier-1))
000B9888 F0 5C                       fmov    fr5, fr0
000B988A F4 0A                       fmov.s  fr0, @r4
000B988C 4F 26                       lds.l   @r15+, pr
000B988E 00 6B                       rts/n

Last edited by ztan; 12-18-2015 at 05:56 PM.
ztan is offline   Reply With Quote
The Following 5 Users Say Thank You to ztan For This Useful Post:
DustinS (11-25-2015), solidONE (11-24-2015), tato.valverde (11-24-2015), thambu19 (11-24-2015), Wayno (06-02-2016)
Old 11-24-2015, 07:04 AM   #33
thambu19
Senior Member
 
Join Date: Aug 2015
Drives: Scion FRS
Location: MI
Posts: 229
Thanks: 140
Thanked 78 Times in 61 Posts
Mentioned: 15 Post(s)
Tagged: 0 Thread(s)
Garage
@ztan I wish I could help out but this is way over my league.. Keep up the great work!!!
thambu19 is offline   Reply With Quote
Old 11-30-2015, 10:20 PM   #34
ztan
Senior Member
 
Join Date: Jul 2013
Drives: Toyota 86
Location: Gold Coast, Australia
Posts: 311
Thanks: 44
Thanked 358 Times in 142 Posts
Mentioned: 60 Post(s)
Tagged: 0 Thread(s)
Beta testing

It Works!!!

Early beta testing, still need to post up fuelling and timing interpolation code, verify reasonable use of multipliers.

Have filled up to E20 (up to E35 with E85 sitting in the tank before mixing in with residual fuel) and using a E85 multiplier of 1.35, trims look quite stable at present.
Attached Images
  
ztan is offline   Reply With Quote
The Following 14 Users Say Thank You to ztan For This Useful Post:
Akya2120 (09-09-2016), Awstryker (12-01-2015), DustinS (12-01-2015), freerunner (12-01-2015), JonAvalon (11-30-2015), killswitch (12-01-2015), LOLS2K (11-30-2015), ShaunNeutron (12-01-2015), Shiv@Openflash (12-01-2015), solidONE (12-02-2015), steve99 (12-01-2015), tato.valverde (12-01-2015), thambu19 (11-30-2015), Wayno (06-02-2016)
Old 11-30-2015, 10:25 PM   #35
DannyQ86
Senior Member
 
Join Date: Jul 2015
Drives: 2013 frs
Location: SoCal
Posts: 113
Thanks: 87
Thanked 39 Times in 31 Posts
Mentioned: 2 Post(s)
Tagged: 2 Thread(s)
Great job man, this is also way out of my league but great to have contributors like yourself and steve99 on this forum.
DannyQ86 is offline   Reply With Quote
Old 12-01-2015, 03:49 AM   #36
ztan
Senior Member
 
Join Date: Jul 2013
Drives: Toyota 86
Location: Gold Coast, Australia
Posts: 311
Thanks: 44
Thanked 358 Times in 142 Posts
Mentioned: 60 Post(s)
Tagged: 0 Thread(s)
Flex Fuel Primary OL fuelling

This one is tricky.

I've used the routine for Primary OL enrichment lookup and assigned that to E85. The OL additive is a table that gets used normally when IAM < 1.0 and I've used that for an E0 table. The modified code is also a bit longer than the original and overlaps (by 2 bytes) a routine that is not used in stock A01G.

Stock code:
Code:
ROM:00061420 D6 67                       mov.l   #byte_114663, r6 ; Move Immediate Long Data
ROM:00061422 62 60                       mov.b   @r6, r2         ; r2=0
ROM:00061424 22 28                       tst     r2, r2          ; Test Logical
ROM:00061426 8B 3A                       bf      Not_Used        ; T
ROM:00061426
ROM:00061428 D6 66                       mov.l   #byte_10C319, r6 ; Move Immediate Long Data
ROM:0006142A 60 60                       mov.b   @r6, r0         ; r0=0
ROM:0006142C 88 5A                       cmp/eq  #h'5A, r0 ; 'Z' ; Compare: Equal
ROM:0006142E 89 18                       bt      Not_Used_1      ; Branch if True
ROM:0006142E
ROM:00061430 D4 65                       mov.l   #Table_Primary_Open_Loop_Fueling, r4 ; Move Immediate Long Data
ROM:00061432 D2 66                       mov.l   #Pull_3D_A, r2  ; Move Immediate Long Data
ROM:00061434 34 F1 70 01                 fmov.s  @(4,r15), fr4   ; Floating-point move single precision
ROM:00061438 42 0B                       jsr     @R2 ; Pull_3D_A ; Jump to Subroutine
ROM:0006143A F5 F8                       fmov.s  @r15, fr5       ; Floating-point move single precision
ROM:0006143A
ROM:0006143C 3F 01 30 03                 fmov.s  fr0, @(h'C,r15) ; Floating-point move single precision
ROM:00061440 D4 63                       mov.l   #Table_Primary_Open_Loop_Fueling_Additive, r4 ; Move Immediate Long Data
ROM:00061442 F7 F8                       fmov.s  @r15, fr7       ; Floating-point move single precision
ROM:00061444 34 F1 70 01                 fmov.s  @(4,r15), fr4   ; Floating-point move single precision
ROM:00061448 D2 60                       mov.l   #Pull_3D_A, r2  ; Move Immediate Long Data
ROM:0006144A 42 0B                       jsr     @R2 ; Pull_3D_A ; Jump to Subroutine
ROM:0006144C F5 7C                       fmov    fr7, fr5        ; Floating-point move
ROM:0006144C
ROM:0006144E 3A 01 30 16                 fmov.s  fr0, @((flt_FFF8A8FC - flt_FFF8A8A4),r10) ; Floating-point move single precision
ROM:00061452 F0 9D                       fldi1   fr0             ; fr0=1.0
ROM:00061454 F0 D1                       fsub    fr13, fr0       ; fr0=1.0-IAM
ROM:00061456 35 F1 70 03                 fmov.s  @(h'C,r15), fr5 ; fr5= return from Primary OL table
ROM:0006145A 39 A1 70 16                 fmov.s  @((flt_FFF8A8FC - flt_FFF8A8A4),r10), fr9 ; fr9=return from primary open loop additive table
ROM:0006145E A0 4D                       bra     loc_614FC       ; Branch
ROM:00061460 F5 9E                       fmac    fr0, fr9, fr5   ; fr5=fr0*fr9+fr5
Flex Fuel code:
Code:
00061420 D6 01                       mov.l   #RAM_Flex_Fuelling_Interpolant, r6
00061422 A0 05                       bra     loc_61430
00061424 F8 68                       fmov.s  @r6, fr8
00061424             ; ---------------------------------------------------------------------------
00061426 FF FF                       .data.w h'FFFF
00061428 FF F8 D4 24 off_61428:      .data.l RAM_Flex_Fuelling_Interpolant
00061428                                                     ; DATA XREF: sub_613A2
0006142C FF FF FF FF                 .data.l h'FFFFFFFF
00061430             ; ---------------------------------------------------------------------------
00061430
00061430             loc_61430:                              ; CODE XREF: sub_613A2
00061430 D4 65                       mov.l   #Table_Primary_OL_Fueling_E85, r4
00061432 D2 66                       mov.l   #Pull_3D_A, r2
00061434 34 F1 70 01                 fmov.s  @(4,r15), fr4   ; Load
00061438 42 0B                       jsr     @R2 ; Pull_3D_A
0006143A F5 F8                       fmov.s  @r15, fr5       ; RPM
0006143C 3F 01 30 03                 fmov.s  fr0, @(h'C,r15) ; Primary OL Fuelling E85 result
00061440 D4 63                       mov.l   #Table_Primary_OL_Fueling_E0, r4
00061442 F7 F8                       fmov.s  @r15, fr7       ; RPM
00061444 34 F1 70 01                 fmov.s  @(4,r15), fr4   ; Load
00061448 D2 60                       mov.l   #Pull_3D_A, r2
0006144A 42 0B                       jsr     @R2 ; Pull_3D_A
0006144C F5 7C                       fmov    fr7, fr5        ; RPM
0006144E 3A 01 30 16                 fmov.s  fr0, @((RAM_Primary_OL_E0_Result - flt_FFF8A8A4),r10)
00061452 F0 9D                       fldi1   fr0             ; fr0=1.0
00061454 F0 81                       fsub    fr8, fr0        ; fr0=1.0-FF_interpolant
00061456 35 F1 70 03                 fmov.s  @(h'C,r15), fr5 ; fr5= return from Primary OL E85 table
0006145A 39 A1 70 16                 fmov.s  @((RAM_Primary_OL_E0_Result - flt_FFF8A8A4),r10), fr9 ; fr9=return from primary OL E0 table
0006145E F5 82                       fmul    fr8, fr5        ; fr5=Primary OL E85 * FF_Interpolant
00061460 A0 4C                       bra     loc_614FC
00061462 F5 9E                       fmac    fr0, fr9, fr5   ; (1-FF_interpolant)*(Primary_OL_E0) + (FF_interpolant*Primary_OL_E85)
Besides interpolating an enrichment factor between the two tables, a table header re-definition for the OL additive also needs to occur to change the offset value of the table.

Stock table defs:
Code:
ROM:000B5854 00 0D 00 17 Table_Primary_Open_Loop_Fueling:Table_Type <h'D, 0, h'17>
ROM:000B5854                                                     ; DATA XREF: sub_613A2
ROM:000B5854                                                     ; sub_613A2
ROM:000B5858 00 11 14 34                 .data.l Primary_Open_Loop_Fueling_X_Axis
ROM:000B585C 00 11 14 68                 .data.l Primary_Open_Loop_Fueling_Y_Axis
ROM:000B5860 00 11 14 C4                 .data.l Primary_Open_Loop_Fueling
ROM:000B5864 04 00                       .data.w h'400
ROM:000B5866 00 00                       .data.w 0
ROM:000B5868 3C 00 00 00                 .float 0.0078125
ROM:000B586C 00 00 00 00                 .float 0.0

ROM:000B588C 00 0D 00 17 Table_Primary_Open_Loop_Fueling_Additive:Table_Type <h'D, 0, h'17>
ROM:000B588C                                                     ; DATA XREF: sub_613A2
ROM:000B588C                                                     ; sub_613A2:off_615D0
ROM:000B5890 00 11 16 04                 .data.l unk_111604
ROM:000B5894 00 11 16 38                 .data.l unk_111638
ROM:000B5898 00 11 16 94                 .data.l Primary_Open_Loop_Fueling_Additive
ROM:000B589C 04 00                       .data.w h'400
ROM:000B589E 00 00                       .data.w 0
ROM:000B58A0 3C 00 00 00                 .float 0.0078125
ROM:000B58A4 BF 80 00 00                 .float -1.0
Modified table defs:
Code:
000B5854 00 0D 00 17 Table_Primary_OL_Fueling_E85:Table_Type <h'D, 0, h'17>
000B5854                                                     ; DATA XREF: sub_613A2:loc_61430
000B5854                                                     ; sub_613A2:off_615C8
000B5858 00 11 14 34                 .data.l Primary_Open_Loop_Fueling_X_Axis
000B585C 00 11 14 68                 .data.l Primary_Open_Loop_Fueling_Y_Axis
000B5860 00 11 14 C4                 .data.l Primary_Open_Loop_Fueling
000B5864 04 00 00 00                 .data.l h'4000000
000B5868 3C 00 00 00                 .float 0.0078125
000B586C 00 00 00 00                 .float 0.0

000B588C 00 0D 00 17 Table_Primary_OL_Fueling_E0:Table_Type <h'D, 0, h'17>
000B588C                                                     ; DATA XREF: sub_613A2
000B588C                                                     ; sub_613A2:off_615D0
000B5890 00 11 16 04                 .data.l Primary_Open_Loop_Fueling_Additive_X_Axis
000B5894 00 11 16 38                 .data.l Primary_Open_Loop_Fueling_Additive_Y_Axis
000B5898 00 11 16 94                 .data.l Primary_Open_Loop_Fueling_Additive
000B589C 04 00 00 00                 .data.l h'4000000
000B58A0 3C 00 00 00                 .float 0.0078125
000B58A4 00 00 00 00                 .float 0.0
Attached Images
 
ztan is offline   Reply With Quote
The Following 9 Users Say Thank You to ztan For This Useful Post:
504 (03-04-2016), DustinS (12-01-2015), EAGLE5 (12-01-2015), freerunner (12-01-2015), Shiv@Openflash (12-02-2015), solidONE (12-02-2015), tato.valverde (12-01-2015), thambu19 (12-01-2015), Wayno (06-02-2016)
Old 12-01-2015, 06:14 AM   #37
slowest86
Member
 
Join Date: Oct 2014
Drives: slow frs
Location: South Carolina
Posts: 31
Thanks: 3
Thanked 7 Times in 6 Posts
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Awesome progress man. Keep up the good work!
slowest86 is offline   Reply With Quote
Old 12-02-2015, 07:05 PM   #38
Shiv@Openflash
Senior Member
 
Shiv@Openflash's Avatar
 
Join Date: Sep 2013
Drives: 2013 FRS
Location: SF, CA
Posts: 2,629
Thanks: 1,055
Thanked 5,469 Times in 1,494 Posts
Mentioned: 605 Post(s)
Tagged: 9 Thread(s)
Amazing!
Shiv@Openflash is offline   Reply With Quote
Old 12-02-2015, 09:17 PM   #39
solidONE
Senior Member
 
solidONE's Avatar
 
Join Date: Dec 2012
Drives: FR-S Whiteout
Location: California
Posts: 2,863
Thanks: 1,808
Thanked 790 Times in 611 Posts
Mentioned: 42 Post(s)
Tagged: 0 Thread(s)
Gangster!
__________________
Intent > Content

cowardice is the mother of cruelty.
solidONE is offline   Reply With Quote
Old 12-10-2015, 05:06 PM   #40
DustinS
Senior Member
 
DustinS's Avatar
 
Join Date: Apr 2014
Drives: 2013 Ultramarine FR-S
Location: Springfield, MO
Posts: 1,948
Thanks: 2,538
Thanked 1,412 Times in 804 Posts
Mentioned: 31 Post(s)
Tagged: 3 Thread(s)
Excited to see this so close. Great Job!!
__________________
DustinS is offline   Reply With Quote
Old 12-12-2015, 05:02 PM   #41
ztan
Senior Member
 
Join Date: Jul 2013
Drives: Toyota 86
Location: Gold Coast, Australia
Posts: 311
Thanks: 44
Thanked 358 Times in 142 Posts
Mentioned: 60 Post(s)
Tagged: 0 Thread(s)
Updated log data

Fuelling daily drive data from the last couple of weeks, slowly moving across to E85. This data is with the Flex fuelling multiplier applied to 2 values only: PI scaling BRZ and GDI pressure multiplier C.

OL data is similar, though there is a early crossover period that looks rich when a higher E% is in the DI line where my sensor sits and fuel with a lower E% is still getting flushed out of that line.
Attached Images
 
ztan is offline   Reply With Quote
The Following User Says Thank You to ztan For This Useful Post:
Wayno (06-02-2016)
Old 12-12-2015, 05:14 PM   #42
ztan
Senior Member
 
Join Date: Jul 2013
Drives: Toyota 86
Location: Gold Coast, Australia
Posts: 311
Thanks: 44
Thanked 358 Times in 142 Posts
Mentioned: 60 Post(s)
Tagged: 0 Thread(s)
Flex Fuel Timing

For this code, I'm using Base Timing B as a E85 table, Base Timing A as an E0 table and interpolating between them based on E%.

The stock ROM has a value (FFF8ADB8 in A01G) which interpolates between the tables and we'll hijack that. Base Timing A gets used after a flash in the first few minutes AVCS is calibrating then switches to Base Timing B for the rest of the time.

Stock code for the base timing table pull:
Code:
ROM:00069C76 D2 46                       mov.l   #RAM_ECT, r2
ROM:00069C78 F8 28                       fmov.s  @R2, fr8
ROM:00069C7A FF 8A                       fmov.s  fr8, @r15
ROM:00069C7C D2 45                       mov.l   #RAM_E_Load, r2
ROM:00069C7E FD 28                       fmov.s  @R2, fr13
ROM:00069C80 0E 80 AD 70                 movi20  #RAM_Base_Timing, r14
ROM:00069C84 35 E1 70 0D                 fmov.s  @((RAM_RPM_1 - RAM_Base_Timing),r14), fr5
ROM:00069C88 FC 5C                       fmov    fr5, fr12
ROM:00069C8A D4 43                       mov.l   #Table_Base_Timing_B, r4
ROM:00069C8C D2 3E                       mov.l   #Pull_3D_A, r2
ROM:00069C8E 42 0B                       jsr     @R2 ; Pull_3D_A
ROM:00069C90 F4 DC                       fmov    fr13, fr4
ROM:00069C90
ROM:00069C92 E0 5C                       mov     #h'5C, r0 ; '\'
ROM:00069C94 FE 07                       fmov.s  fr0, @(r0,r14)  ; ADCC
ROM:00069C96 FE E6                       fmov.s  @(r0,r14), fr14
ROM:00069C98 3F E1 70 12                 fmov.s  @((RAM_Base_Timing_Interp_Factor - RAM_Base_Timing),r14), fr15
ROM:00069C9C D4 3F                       mov.l   #Table_Base_Timing_A, r4
ROM:00069C9E F4 DC                       fmov    fr13, fr4
ROM:00069CA0 D2 39                       mov.l   #Pull_3D_A, r2
ROM:00069CA2 42 0B                       jsr     @R2 ; Pull_3D_A
ROM:00069CA4 F5 CC                       fmov    fr12, fr5
ROM:00069CA4
ROM:00069CA6 E0 60                       mov     #h'60, r0 ; '`'
ROM:00069CA8 FE 07                       fmov.s  fr0, @(r0,r14)  ; FFF8ADD0
ROM:00069CAA FE F2                       fmul    fr15, fr14      ; FFF8ADB8*Base Timing B result
ROM:00069CAC F0 9D                       fldi1   fr0
ROM:00069CAE F0 F1                       fsub    fr15, fr0       ; 1.0-FFF8ADB8
ROM:00069CB0 F8 E6                       fmov.s  @(r0,r14), fr8
ROM:00069CB2 FE 8E                       fmac    fr0, fr8, fr14  ; Base_Timing A *(1-FFF8ADB8) + Base_Timing_B * FFF8ADB8
Modified Flex Fuel Timing code:
Code:
00069C76 D2 46                       mov.l   #RAM_ECT, r2
00069C78 F8 28                       fmov.s  @R2, fr8
00069C7A FF 8A                       fmov.s  fr8, @r15
00069C7C D2 45                       mov.l   #RAM_E_Load, r2
00069C7E FD 28                       fmov.s  @R2, fr13
00069C80 0E 80 AD 70                 movi20  #RAM_Base_Timing, r14
00069C84 35 E1 70 0D                 fmov.s  @((RAM_RPM_1 - RAM_Base_Timing),r14), fr5
00069C88 FC 5C                       fmov    fr5, fr12
00069C8A D4 43                       mov.l   #Table_Base_Timing_E85, r4
00069C8C D2 3E                       mov.l   #Pull_3D_A, r2
00069C8E 42 0B                       jsr     @R2 ; Pull_3D_A
00069C90 F4 DC                       fmov    fr13, fr4
00069C92 D2 02                       mov.l   #FlexFuel_Timing_Interpolation, r2
00069C94 42 4B                       jsr/n   @R2 ; FlexFuel_Timing_Interpolation
00069C96 A0 03                       bra     loc_69CA0
00069C98 00 09                       nop
00069C98             ; ---------------------------------------------------------------------------
00069C9A FF FF                       .data.w h'FFFF
00069C9C 00 0B 98 50 off_69C9C:      .data.l FlexFuel_Timing_Interpolation
00069C9C                                                     ; DATA XREF: Base_Timing_Lookup
00069CA0             ; ---------------------------------------------------------------------------
00069CA0
00069CA0             loc_69CA0:                              ; CODE XREF: Base_Timing_Lookup
00069CA0 D2 39                       mov.l   #Pull_3D_A, r2
00069CA2 42 0B                       jsr     @R2 ; Pull_3D_A
00069CA4 F5 CC                       fmov    fr12, fr5
00069CA6 E0 60                       mov     #h'60, r0 ; '`'
00069CA8 FE 07                       fmov.s  fr0, @(r0,r14)  ; FFF8ADD0: Base Timing E0 Result
00069CAA FE F2                       fmul    fr15, fr14      ; Base timing E85 * FF_Timing_Interpolant
00069CAC F0 9D                       fldi1   fr0
00069CAE F0 F1                       fsub    fr15, fr0       ; 1-FF_Timing_Interpolant
00069CB0 F8 E6                       fmov.s  @(r0,r14), fr8
00069CB2 FE 8E                       fmac    fr0, fr8, fr14  ; (Base timing E0 * (1-FF_Timing_Interpolant)) + (Base timing E85 * FF_Timing_Interpolant)

000B9850             FlexFuel_Timing_Interpolation:          ; CODE XREF: Base_Timing_Lookup
000B9850                                                     ; DATA XREF: Base_Timing_Lookup
000B9850 4F 22                       sts.l   pr, @-r15
000B9852 E0 5C                       mov     #h'5C, r0 ; '\'
000B9854 FE 07                       fmov.s  fr0, @(r0,r14)
000B9856 FE E6                       fmov.s  @(r0,r14), fr14
000B9858 D4 19                       mov.l   #RAM_Flex_Timing_Interpolant, r4
000B985A FF 48                       fmov.s  @r4, fr15
000B985C D4 24                       mov.l   #Table_Base_Timing_E0, r4
000B985E F4 DC                       fmov    fr13, fr4
000B9860 4F 26                       lds.l   @r15+, pr
000B9862 00 6B                       rts/n
Below are daily drive logs moving slowly from E5 to E60 displaying the interpolation value as well as base timing from a significantly knock limited area on E0 : 3200 +/- 50 RPM and 0.8 +/- 0.05 Load
Attached Images
  
ztan is offline   Reply With Quote
The Following 5 Users Say Thank You to ztan For This Useful Post:
504 (03-04-2016), phrosty (12-12-2015), steve99 (12-13-2015), thambu19 (12-13-2015), Wayno (06-02-2016)
 
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Open source Over Boost Fuel Cut ztan Software Tuning 18 07-05-2023 08:30 AM
Open Source Electric Supercharger neutron256 Forced Induction 913 08-22-2021 05:16 PM
open source software question GeeTee86 AFRICA 15 02-15-2015 06:52 PM
The Retrofit Source summer open house! soundman98 Southeast 0 06-23-2014 08:41 PM
ECUtek Flex Fuel REVOLUTION: World's First Flex Fuel Factory ECU GTR - BRZ soon! Visconti Engine, Exhaust, Transmission 356 05-20-2013 09:36 AM


All times are GMT -4. The time now is 11:39 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
User Alert System provided by Advanced User Tagging v3.3.0 (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.

Garage vBulletin Plugins by Drive Thru Online, Inc.