Notices
Series I Engine Tuning Forum EMS (Flash Tuning, Interceptor, Piggy Back, Stand Alone)

Open Source Stock ECU G-ROM FlexFuel ROM - User's Guide

Thread Tools
 
Rate Thread
 
Old May 8, 2026 | 02:01 PM
  #1  
equinox92's Avatar
Thread Starter
Registered
 
Joined: Nov 2019
Posts: 367
Likes: 223
From: Detroit, MI
Open Source Stock ECU G-ROM FlexFuel ROM - User's Guide

Hello friends, I figured it was finally time to document some of this stuff in an easy to intake format that wasn't totally spread across 4 different platforms.

The information in this thread will describe how to use my FlexFuel patched factory software and explain what this software does on TOP of the already existing open source ECU information. Most of the terms and tools will be identical to the open source stuff I have posted before, so if you need some context or are just seeing this post first, I would HIGHLY encourage you to read through the existing thread on that here:

https://www.rx8club.com/series-i-eng...-guide-276137/

ROM Features
  • 0-100% Ethanol content fueling, no fuel re-mapping required if not desired
  • Immobilizer Removal
  • Additional engine timing scaled as a factor of ethanol content
  • Cranking fueling scaled as a factor of ethanol content (base calibrations available)
  • Extra parameter PIDs for more informative logging via OBD
Supported ECUs
  • 04-07 USDM 6 Port 6 Speed ECUs
ROM Bases
  • 60E0FB00
    • N3Z2ET 2004 US 6 Port MT
  • 60E0FC00
    • N3Z2EU 2004 US 6 Port MT
**NOTE: 4 Port and Automatic ECUs/Calibrations will never be supported without SIGNIFICANT effort

First and foremost, I think it's appropriate to acknowledge a few gaps in knowledge I have as far as ECU support: I believe you can straight flash the G-ROM FlexFuel ROM on to any USDM S1 6 port ECU, but I have not investigated the use of any other ECU ID and do not totally understand the hardware differences. I am happy to work through issues with people to bridge this information gap! Super worse case, we can work with your base ROM and port the patch over.

Tools RequiredOptional Tools for Advanced Users
  • G-ROM Patcher - Utility for patching software modifications on top of an existing OEM ROM

Additional Vehicle Requirements
  • A FlexFuel sensor that outputs the ethanol content to CAN in the G-ROM FlexFuel format (I do build and sell these CAN adapters boards which can be found here: https://g-rom-electronics.myshopify....nsor-converter)
  • Stock fuel pump, fuel lines and injectors will be adequate for most installs
Benefits of E85 on an RX8
  • Mo powah! People (including myself using this ROM) have seen 20whp pickups, which is a 10% power increase
Open Source Bits
Software for this patch was written in a combination of ASM and C code, using a compiler made for the Rensas microcontroller on the ECU. The vast majority of effort goes into the linker, and what functions to use as a way to run the additional software.

The source code and build environment for you to look over, as well as modify freely can be found here: https://github.com/equinox311/RX8_FlexFuel

I can dive into ways in which you can write your own software for the Mazda ECU if there is interest, but this isn't entirely the thread for it. I will go through the software and it's functionality for the FlexFuel related additions.

Okay into the fun bits!!

Installing a FlexFuel Sensor
This assumes the use of a GM/Continental ethanol sensor, and all information on install for a G-ROM Converter into the factory RX-8 CAN bus can be found here: https://gromelectronics.net/wp-conte...r-manual-1.pdf
The sensor is required to send ethanol content over CAN to the ECM in the format as specified in that document.

You can refer to many other guides for more information regarding the sensor install and wiring, but I do recommend that the sensor is installed in the fuel line that goes DIRECTLY to the fuel rail. This should not be a problem on a stock fuel system RX-8

G-ROM Flex Fuel Calibration Tables
Download the latest released version of the ROM as shown above, and open it in ROMraider ECU editor (if you need to figure out how to do this, please refer to the base Open Source thread from above).

When you open the ROM up, you should see a list of tables populated in ROMraider much like a factory RX-8 ROM, and the calibration ID in the header should show up as "G_ROM_FLEX".

You should also notice the additional category of calibrations labeled "Flex Fuel"



Table Definitions and Functions

Stoich Fuel Ratio Table

This table sets the stoichometric ratio of air to fuel for a given ethanol content. This table is already setup to be accurate, and shouldn't ever need modification but it is present in the definitions in case someone wants to play. This value is what sets the base AFR for the software to properly inject fuel in all cases. There is no need for any additional closed loop or open loop fueling as this value is what sets the math up correct for the ECU to use the standard lambda tables. If there is desire to lean/enrich fueling targets based on ethanol content, please send me a message and this functionality can be added.



Ethanol Sensor CAN ID

This is a raw integer value for the received CAN message ID for the software to receive ethanol content on. If you don't know what that sentence meant, it's very unlikely you will need to change this.



Ethanol Content Sample Thresholds (Engine Speed and Engine Load)

These tables are thresholds for which, when the engine speed or engine load are greater than, the ethanol content as read in from the sensor will not update and not effect fueling. This is a method in which to filter out noisy data in high fuel flow situations, and is very similar to the Haltech strategy. Out of the box, they are set to values such that the feature is effectively turned off.



Cranking Fuel Multiplier

This table is a fueling multiplier meant to add additional cranking fuel during cold starts to help with flame propagation at lower temperatures. The value from this table is a multiplier to the OEM Primary Fuel Injector Cranking Pulse Width (see cranking pulse calculation below). Out of the box the multiplier is set to 1, such that factory cranking fueling will be used in all conditions. The table is based on current ethanol content and engine coolant temperature. The software will protect against a value of anything less than 1.0 being put into this table, but if someone really feels the need to lower is, please send me a message.



Flex Fuel related cranking fuel calculation is as such:

flex_fuel_injector_pulse_cranking = primary_fuel_injector_pulse_cranking * cranking_fuel_mult

Timing Ethanol Adder - Leading/Trailing

These tables set the amount of additional timing added to the base timing calculation and are effected by the Timing Multiplier (See timing calculation below). These tables should be tuned such that the timing value set in the table, is the maximum added to the base timing at your maximum desired ethanol content. The tables exist for the leading and trailing sides. Out of the box they are set to 0.



Timing Multiplier

This table sets the timing adder multiplier based on the ethanol content percentage. This is to say that the amount of timing in the Timing Ethanol Adder tables is multiplied by this value to come up with the actual amount of timing added to the base timing from the factory software (See timing calculation below).



Flex Fuel related timing calculation is as such:

timing_adder_trailing = timing_ethanol_adder_trailing * timing_mult

timing_adder_leading = timing_ethanol_adder_leading * timing_mult


Flashing the G-ROM FlexFuel ROM to your ECU

Download the latest released version of the ROM as shown above from the Current_Release folder on github, make your calibration tweaks using RX8Man Software, and flash it as tuned and described in the open source information thread, and you're ready to go!

Logging and Debug
To log parameters and confirm that you are up and running with software, you should use ROMraider logger and the most up to date logger definitions. For instructions on how to set this up, refer to the existing open source thread as the process is the same.

It is also worth noting that with a basic Versatuner/Mazdaedit/etc logging license, you SHOULD be able to use those programs to log basic parameters. I will not gaurentee this, and you cannot be using their software on the ECM. Programs like FORscan can still log parameters exactly as an OEM ECU would.

With ROMraider logger open, if you connect to the ECM, you should see some metrics pop up on the left side that are additional to the stock ROM.

Flex Fuel Logging Parameters

These should be self explanatory, but I will explain them simply:
  • Ethanol Content - This is the current ethanol content as read by the flex fuel sensor over CAN
  • Flex Cranking Multiplier - This is the current cranking multiplier applied from the Cranking Fuel Multiplier table above
  • Flex Fuel Timing Muliplier - This is the timing multiplier as applied from the Timing Multiplier table above
  • Flex Leading Ignition Timing Adder - This is the current added timing to the base timing as calculated from the timing calculation above for the leading spark plug
  • Flex Trailing Ignition Timing Adder - This is the current added timing to the base timing as calculated from the timing calculation above for the trailing spark plug
  • Flex Sensor Fault Status - This is a validity bit which tells you if the ECM is reading the ethanol content CAN message correctly. A value of 0 denotes there is no problem, a value of 1 denotes the ECM has not received the ethanol content CAN message within it's expected transmit period (NOTE: The Ethanol Content should also default to 15% when this value is set to 1)



Additional Logging Parameters (experimental and more to come)
  • Air Fuel Ratio - This is the current air/fuel ratio in Lambda/AFR Gasoline/AFR Ethanol that the ECM is using for it's fueling
  • OL Fuel Final - This is the current request lambda/enrichment value that the open loop fueling software is requesting

Reply
Old May 8, 2026 | 02:02 PM
  #2  
equinox92's Avatar
Thread Starter
Registered
 
Joined: Nov 2019
Posts: 367
Likes: 223
From: Detroit, MI
How it all Works!

Like I had mentioned in the first post, this will not be a guide on how to write software for this ECM, but rather an explanation of what I have done just to show exactly what everything is doing "behind the scenes". If a lot of this goes over some folks' head, I do apologize, but there is a certain baseline level of MCU and software knowledge needed to get this far.

So high level: The way this works is very simple. Write new functions, take over function call points in the factory software and point then to the newly written function, and then jump back to where we were to keep the original program running with our newly added variables. This is why we can modify things such as ignition timing and fuel injection without disrupting the rest of the software that is already running.

Where do we put these new functions?? In unused flash memory and unallocated RAM! It's just like writing a program for anything else at this point.

To compile and write the software, I am using a pretty ancient IDE called High-Performance Embedded Workshop (HEW) with the KPIT GNUSH toolchain installed. This gives us compilers and an emulator for the Rensas SH7055 chip that is on the RX-8 ECM. The emulator allows me to run OEM code, as well as my code inline before it ever hits actual hardware to make sure it's not going to be an insta-brick (which was done a LOT still to get to this point). You can download all of this stuff for free if you want an easier way to intake some of this information.

The Files

If you look at the software on github, you will see a list of files. I will open these all in HEW in order to show the files and functions, but you're more then welcome to open them in any format. A lot of what you see was also taken from some open source Subaru modifications over on the romraider forums. I will add credit for this base environment when I can dig back up the source, but the point is that I am hanging on the coat tails of other really smart people.
  • ASM (Assembly Langauge) Files
    • _section_trailers.s - This puts some plaintext headers in specific parts of memory to denote the Application and Calibration versions. This is easy tracking for me to see which version of what a ROM is running
    • flex_calibrations.s - This defines all of the newly added tables as discussed in the first post. You could do this in C, but it's just a little easier to align stuff in ASM to keep the Denso table stucture
    • RomAddresses.s - This links OEM ECU addresses to useable functions and variables. This is what allows us to call OEM software functions when their utility is desired, and use existing variables for calling tables lookups
    • simulation_handlers - This is a file that handles some things needed only for simulation and is not compiled into useable ECM code. It basically allows the emulator to jump to our code all ***** nilly for testing
  • Header Files
    • vars.h - Non descriptively named, but this holds the vast majority of the variable definitions for variables we are going to use from the stock ECM as well as holds all of the structure definitions for new software. It also pulls in all of the global functions we defined in the RomAddresses.s so we can use them as C functions. It's a messy file but it contains a lot of meat.
    • typedefine.h - This is a basic header file so that the compiler knows which types are which.. honestly not sure if it's required or not but it was there when the environment was made
    • pid_handler.h - This contains the same information as vars.h, but specifically for the added OBD PID handler, more on that later
  • C Files
    • G_ROM_FlexFuel.c - This contains all of the functions and software for the added functionality of this patch
    • pid_handler.c - This contains all of the functions and software for the added OBD PIDs



The Functions

I am going to use photos for files, which is objectively the worst way to do this.. so.. sorry.

I will skip over some of these files, and gloss over others.. but basically in RomAddresses.s, as mentioned, contains all of the links of factory functions so we can use them ourselves. These functions were found via reverse engineering, and will vary between every ROM. If the patch needed to be ported to another ROM, this file would need to be branched. It also contains a few section definitions for the linker.. probably shouldn't be here, but whatever.




Going into the main C file, I am going to go function by function:

initFlexFuelCalcs - This function just initializes our variables we need to use. This function is called inline with the rest of the software initialization and is critical to be called at module reset. This also defines some of the default values.




flexCANUnpack - This function unpacks the CAN data from the FlexFuel sensor and dumps the data into a spot in RAM that we can work in. Not really shown well here is the fact that we are taking over the message ID 0x216, which is originally used by the TCM to request torque. The function call to read in this CAN message from the CAN peripheral already existed, so I just piggybacked off this message read in so we could pull in CAN data. This is why automatic ECUs will not be supported without major effort. This CAN ID can also be changed, but the hardware configuration for reading CAN messages is 100% used from the factory so no other messages can be added for receive.



getEthanolContent - Pretty self explanatory, but is a pretty deep dive. This function grabs the data from CAN and checks on some validity data. If it receives data correctly, it updates the ethanol content, if it doesn't, it will default to the last known good receive until the ignition is cycled. This is called alongside the gear calculation as it is in a relatively slow task rate in the ECM.




getFlexMetrics - This function does all of the ethanol based table looksups, and checking on the sample thresholds. This is what will set the base AFR and timing multiplier. There are some low pass filters on these values, though one should really just be on the ethanol content as a whole. I am working around some old sensor hardware that is still in my car, and shouldn't effect anything else.



calcTimingAdders - This function calculates the additional timing as defined by the adder tables. One thing that is not shown very well is the addition of timing values to the actual base timing the ECM will use, and that is because that operation is done by the linker. In the stock software, there is a global timing adder at the end of the base timing calculation chain for each leading/trailing plug. In the stock ROM calibration, these are set to be 0 and not used. Instead of using 0, the address of the new timing adder variables is linked to that function so that it looks at our values, and not the global adder calibration, thus adding our timing adders in. Little confusing to show that.




getCrankingFuelMult - This functions does the table lookup for our cranking injector pulse multiplier, and also does some gating on how big the multiplier can be




setCrankingInjectorPulseTime_FlexFuel - This function takes over the factory cranking injector pulse function and does the math to add our additonal fueling in.



Additional PIDs

The functions in the file pid_handler are basically just clone functions of existing PIDs that can be added to the stock software in order to return data via OBD mode 0x22 PID requests. To do this, I had to reverse engineer the mode 0x22 PID request function that existed in the factory software, rewrite it in C, and add my own PID calls to it so that when a PID in the array of PIDs was out of the OEM bounds, it would jump to this function and start looking for the added PIDs for flex fuel stuff. This allows the use of additional PIDs to be callled with apps like Torque and Harry's Lap Timer.



Last edited by equinox92; May 8, 2026 at 02:59 PM.
Reply
Old May 8, 2026 | 02:02 PM
  #3  
equinox92's Avatar
Thread Starter
Registered
 
Joined: Nov 2019
Posts: 367
Likes: 223
From: Detroit, MI
Saved
Reply
Old May 8, 2026 | 02:10 PM
  #4  
equinox92's Avatar
Thread Starter
Registered
 
Joined: Nov 2019
Posts: 367
Likes: 223
From: Detroit, MI
My personal testimony!

I've been running this ROM as of April 2025 and did a full time attack season on the modifications to the ECM software and have had an awesome time playing with this. I am extremely open for criticism and porting this patch to other ECUs that do not allow for a direct reflash on the existing ROM, but it is quite some time. I am also open for making any other ECM software modifications that perhaps don't just involve flex fuel, as there is an easily downloaded build environment and patch tool for C development on this ECU... which is crazy cool.

For anyone curious about my power increases: With E60 and 60% of my full timing adders I made 208hp/144ft-lbs on a totally stock engine. This same engine 2 years prior made 187hp/131ft-lbs on pump gas.




Reply
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
ciprianrx8
Series I Engine Tuning Forum
16
May 22, 2025 06:55 AM
Jaguar_MBA
Series I Tech Garage
86
Sep 10, 2011 11:44 AM
kristopher_d
Series I Engine Tuning Forum
4
May 25, 2008 07:08 PM
Hymee
Series I Tech Garage
55
Jul 23, 2006 03:23 PM
Hymee
Australia/New Zealand Forum
0
Jan 17, 2004 04:48 PM



You have already rated this thread Rating: Thread Rating: 0 votes,  average.


All times are GMT -5. The time now is 06:34 PM.