Notices
2010-2014 Mustang Information on The S197 {GenII}
Sponsored By:
Sponsored By:

When you tune your car what your actually changing. An inside look.

Thread Tools
 
Search this Thread
 
Old 5/2/14, 09:45 AM
  #1  
Mach 1 Member
Thread Starter
 
zeroaviation's Avatar
 
Join Date: March 1, 2007
Location: Kansas City
Posts: 669
Likes: 0
Received 5 Likes on 2 Posts
When you tune your car what your actually changing. An inside look.

When you load a tune on your car, what exactly are you changing?
This is another popular question i'll try to answer But first I want to go into some of the Major parts of the PCM. This post will stay high level on just what a tune changes. I'm going to write about how the PCM thinks next week

Most all Electronic Engine Control units have 3 BIG parts where all the computation happens.
1. MCU (Microcontroller) - Some people may call this the processor, or Similar.

2. RAM (Memory or Random Access Memory) - This is volatile memory where the application is loaded and executed. (This is a whole post in its own.)

3. FLASH (Persistent storage) - This is non-volatile memory, and where everything is stored. Such as, The bootloader (1 and 2), the O/S (In the case of Copperhead its a RTOS), codes, Engineer console, and most important the calibration (or parts called the "tune").

When a EEC is first powered on, there is some initialization that happens in the processor (such as clocks), then the application is ran (RTOS) Once the o/s is initialized, the calibration is loaded into memory and computation starts. (For Example)

So lets talk specifically about the Tune itself.

When you plug a tuner into your car and start the tuning process it does the following things. (Specific to the PCM, it does other things as well that will be covered in another post).
1. Identifies the PCM - This way the tuner knows what PCM unlocking algorithm, security hash, and memory sections.

2. Unlocks the PCM - Since about 1996, the EEC has to be unlocked to prevent un-auhtorized access by rouge modules. Unfortunately, over the years, this has been quiet easy for folks to reverse engineer.

3. Downloads the stock tune - It starts a session with the PCM asking either to download the entire calibration (rarely used) or queries sections of memory to download. In the case of a SCT, most (meaning 90%) of the time its downloading certains sections, not always in concurrency. This will make more sense soon why you would only download sections and not all of it.

4. Uploads the modified tune - Now here is where the modified tune starts to be uploaded to your PCM. The device may choose whether to upload all of the tune, or again only certain sections. (Sections that have been modified).

5. The PCM/TCM is reset

All tunes start from the Factory Calibration.

Which is a image of the calibration portion of flash memory. Typically this is handled as a HEX type, but sometimes Intel bin is used. Personally, I prefer to deal with hex, as they contain a better mapping as well.

So for this example i'm going to use a make believe portion of memory here to adjust High Speed Fan on ECT. In this example I'm going to use a PCM with a tear tag of CDC2.

Each part of the calibration has a address. So each setting and change is stored at an address (much like your home address). So lets say in this example that High Speed Fan on ECT is located at an address of 0x000CABC5.

So a stock hex file could look like this

Offset(h). 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
000CABC0 43 60 00 00 43 64 00 00 43 64 00 00 40 A0 00 00

After modify the stock setting to say 200F it could look like this

Offset(h). 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
000CABC0 43 60 00 00 43 48 00 00 43 64 00 00 40 A0 00 00

Notice that row 05 changed from 64 to 48. That one byte controls the C temperature of the HSF cut on.

When you use your tuner you are uploading a version of the stock calibration slightly modified as described above. That is a single change there, things like spark, maf, etc require 2 and 3 dimensional arrays and can cover many bytes of memory. (I'm not going to cover this here, but can if requested. Its for someone who understands coding or matlab).

So when you return your vehicles PCM back to stock your changing the memory map values back to their downloaded values. This is how Ford cannot detect that there was an aftermarket calibration or what the calibration that previously was on it was. They have had to resort to other methods of tracking these changes. There are a few PID's out there that were supposed to stay secret to show the Flash count for many areas of memory.

Tuners like SCT, Diablo, HP, have spent many countless hours reverse engineering these tables and mapping out the EEC memory. However, Ford has started to work with some major companies to share this information. If you had plenty of time and knowledge you could build your own tuning software and tuners. (I'm personally considering it)

I hope I did a decent job at explaining this. I look forward to comments and questions. As most of you know i'm a huge supporter of OSHW and OSSW. Putting the knowledge in the peoples hands is they it should be, we buy these cars and should know how they work, and if we want to make changes we should be able to. (I wish our government practiced same logic).

Cheers all,
-Matt

Last edited by zeroaviation; 4/16/15 at 10:28 AM.
Old 5/2/14, 11:28 AM
  #2  
I Have No Life
 
FromZto5's Avatar
 
Join Date: September 24, 2011
Posts: 10,141
Received 172 Likes on 145 Posts
Whoa that is deep man. Lol. I just plugged my SCT in with the magnuson tune, and voila, magic it works lol
Old 5/2/14, 03:06 PM
  #3  
Roush Forum Stalker
 
Stage_3's Avatar
 
Join Date: March 9, 2013
Location: Massachusetts
Posts: 11,152
Received 1,733 Likes on 1,232 Posts
Great read Matt. Thanks!
Old 5/2/14, 04:24 PM
  #4  
Shelby GT350 Member
 
dmichaels's Avatar
 
Join Date: April 14, 2013
Location: CT
Posts: 2,460
Received 111 Likes on 101 Posts
Good info - I got into tuning with my last car (B5 S4 - twin turbo), and it is very interesting, time consuming, frustrating at times, and rewarding to write a tune and see positive results.

I'm not familiar with the Mustang ECU specifically, but the concept is the same and the above is a good overall view. I'm not a computer whiz (aerospace engineer... I like parts, not electrons and code), but the car tuning world is pretty interesting.
Old 5/2/14, 04:42 PM
  #5  
Banned
 
5.M0NSTER's Avatar
 
Join Date: August 2, 2013
Location: Little north of Stuttgart, Germany
Posts: 3,090
Received 254 Likes on 230 Posts
Matt, you used my least favorite word. Matlab. I still have nightmares about it from my college days. It got so bad, that sometimes I'd have dreams of rows and rows of 1s and 0s.... and then, there would be a 2! I'd wake up in panic.

On a serious note, I was wondering about why Ford wouldn't be able to tell that a ECM was re-flashed. Most EEPROM has a finite number of life cycles anyway, and in a lot of other applications there is a flash count like yuo said, or date/time code when it was last modified. I'd figure the ECM would use something similar, so even if you flash it back it would be clear the ECU memory was altered.

Also I'm guessing the original Ford ECM uses RTOS? I'm also guessing there would be some fuzzy sets used in calculation of control variables. I work on the electronic brake controllers and we also use RTOS along with fuzzy logic and of course PID control.

Thanks for the good info.

Last edited by 5.M0NSTER; 5/2/14 at 04:49 PM.
Old 5/2/14, 04:49 PM
  #6  
Mach 1 Member
Thread Starter
 
zeroaviation's Avatar
 
Join Date: March 1, 2007
Location: Kansas City
Posts: 669
Likes: 0
Received 5 Likes on 2 Posts
Originally Posted by 5.M0NSTER
Matt, you used my least favorite word. Matlab. I still have nightmares about it from my college days. It got so bad, that sometimes I'd have dreams of rows and rows of 1s and 0s.... and then, there would be a 2! I'd wake up in panic.

On a serious note, I was wondering about why Ford wouldn't be able to tell that a ECM was re-flashed. Most EEPROM has a finite number of life cycles anyway, and in a lot of other applications there is a flash count like yuo said, or date/time code when it was last modified. I'd figure the ECM would use something similar, so even if you flash it back it would be clear the ECU memory was altered.
Sad thing is that I use Matlab professionally... I also use LabView... Lesser of the two evils... I guess paying attention in college payed off ...

The flash used in Copperheads have a 100k write cycle lifespan. The "magical counter" that people shouldnt even know about lives in non accessible flash (through the o/s CAN bus)... You could probably break out a JTAG and go that route. I do think there are some flash protection fuses set though.

-Matt
Old 5/3/14, 05:21 AM
  #7  
V6 Member
 
Navjag96's Avatar
 
Join Date: March 22, 2014
Location: Northern Virginia
Posts: 63
Likes: 0
Received 0 Likes on 0 Posts
Fantastic, detailed info on tuning - thanks for sharing this with us!
Old 5/3/14, 10:16 AM
  #8  
Member
 
MALWR's Avatar
 
Join Date: January 5, 2014
Location: Katy
Posts: 26
Likes: 0
Received 0 Likes on 0 Posts
This is great info. Thanks for sharing.

Last edited by MALWR; 5/20/14 at 06:54 PM.
Old 5/3/14, 09:25 PM
  #9  
Legacy TMS Member
 
jim010's Avatar
 
Join Date: November 7, 2006
Location: Alberta
Posts: 2,790
Received 49 Likes on 43 Posts
After looking through all that, all I can say is ...

... huh ... ?
Old 5/3/14, 09:43 PM
  #10  
Mach 1 Member
 
ElkGroveFordGuy's Avatar
 
Join Date: February 3, 2014
Location: Elk Grove, CA
Posts: 877
Received 43 Likes on 40 Posts
Yup, plug it in!
Push some buttons!
Go faster!
Old 5/4/14, 06:51 AM
  #11  
I Have No Life
 
FromZto5's Avatar
 
Join Date: September 24, 2011
Posts: 10,141
Received 172 Likes on 145 Posts
Originally Posted by ElkGroveFordGuy
Yup, plug it in! Push some buttons! Go faster!
This
Old 5/4/14, 07:21 AM
  #12  
Shelby GT500 Member
 
kcoTiger's Avatar
 
Join Date: December 20, 2011
Location: CenTex...sort of
Posts: 4,354
Received 53 Likes on 52 Posts
I'd be interested in learning about the 2- and 3-dimensional arrays necessary for the other components (sizes, ranges, etc). I've worked with them before so I'm familiar with the concept, I'm curious how they're implemented with a vehicle's functionality.
Old 5/20/14, 06:52 PM
  #13  
Member
 
madbill1's Avatar
 
Join Date: May 9, 2014
Posts: 2
Likes: 0
Received 0 Likes on 0 Posts
Great post Matt!! Just a curiosity do you know what RTOS/uC ford uses in their ecu.
Old 5/20/14, 07:14 PM
  #14  
Legacy TMS Member
 
laserred38's Avatar
 
Join Date: January 6, 2006
Location: Bay Area, CA
Posts: 14,047
Received 166 Likes on 141 Posts
And when you tune your car, do NOT use an SCT iTSX piece of garbage.
Old 5/21/14, 07:19 AM
  #15  
Mach 1 Member
Thread Starter
 
zeroaviation's Avatar
 
Join Date: March 1, 2007
Location: Kansas City
Posts: 669
Likes: 0
Received 5 Likes on 2 Posts
Originally Posted by kcoTiger
I'd be interested in learning about the 2- and 3-dimensional arrays necessary for the other components (sizes, ranges, etc). I've worked with them before so I'm familiar with the concept, I'm curious how they're implemented with a vehicle's functionality.
Sure thing. I'll add that to the list. Its typical of what you would expect when working with a flat bin image.

Originally Posted by madbill1
Great post Matt!! Just a curiosity do you know what RTOS/uC ford uses in their ecu.
Its proprietary, most all in house built.

Originally Posted by laserred38
And when you tune your car, do NOT use an SCT iTSX piece of garbage.
Ehhh, there ok, what kinda issues did you have?

-Matt
Old 5/21/14, 06:51 PM
  #16  
Member
 
InfinibandGT's Avatar
 
Join Date: May 21, 2014
Location: Silicon Valley
Posts: 3
Likes: 0
Received 0 Likes on 0 Posts
Yea, great post. I've been a software engineer for about 25 years. What's happening is updating the config/parameters. It cool to hear what's going on at a low level.

So Ford wrote their own RTOS? I wonder why they didn't use something like VXWorks.

Anyway, thanks for the post. I'd like to hear more.
Old 5/21/14, 07:28 PM
  #17  
Legacy TMS Member
 
data174's Avatar
 
Join Date: April 7, 2008
Location: Ocala,Florida
Posts: 298
Likes: 0
Received 2 Likes on 2 Posts
So does ford have written parameter that they can relate to. And how does it relate to the asbuilt code.
Old 5/22/14, 10:25 PM
  #18  
Mach 1 Member
Thread Starter
 
zeroaviation's Avatar
 
Join Date: March 1, 2007
Location: Kansas City
Posts: 669
Likes: 0
Received 5 Likes on 2 Posts
Originally Posted by data174
So does ford have written parameter that they can relate to. And how does it relate to the asbuilt code.
I don't understand your question.

-Matt
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Bullitt 3309
5.0L GT Modifications
5
8/2/15 10:20 PM
HMR-TYM
5.0L GT Modifications
19
7/31/15 10:39 AM
dohc97
2010-2014 Mustang
10
7/26/15 09:16 AM
berzerk_1980
2010-2014 Mustang
15
7/23/15 12:35 AM
2015turbostang
Ecoboost
10
7/21/15 11:58 AM



Quick Reply: When you tune your car what your actually changing. An inside look.



All times are GMT -6. The time now is 06:38 AM.