2010-2014 Mustang Information on The S197 {GenII}

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

Old May 2, 2014 | 09:45 AM
  #1  
zeroaviation's Avatar
Thread Starter
Mach 1 Member
 
Joined: March 1, 2007
Posts: 669
Likes: 5
From: Kansas City
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; Apr 16, 2015 at 10:28 AM.
Reply
Old May 2, 2014 | 11:28 AM
  #2  
FromZto5's Avatar
I Have No Life
 
Joined: September 24, 2011
Posts: 10,141
Likes: 172
Whoa that is deep man. Lol. I just plugged my SCT in with the magnuson tune, and voila, magic it works lol
Reply
Old May 2, 2014 | 03:06 PM
  #3  
Stage_3's Avatar
Roush Forum Stalker
 
Joined: March 9, 2013
Posts: 11,140
Likes: 1,749
From: Massachusetts
Great read Matt. Thanks!
Reply
Old May 2, 2014 | 04:24 PM
  #4  
dmichaels's Avatar
Shelby GT350 Member
 
Joined: April 14, 2013
Posts: 2,460
Likes: 111
From: CT
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.
Reply
Old May 2, 2014 | 04:42 PM
  #5  
5.M0NSTER's Avatar
Banned
 
Joined: August 2, 2013
Posts: 3,090
Likes: 254
From: Little north of Stuttgart, Germany
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; May 2, 2014 at 04:49 PM.
Reply
Old May 2, 2014 | 04:49 PM
  #6  
zeroaviation's Avatar
Thread Starter
Mach 1 Member
 
Joined: March 1, 2007
Posts: 669
Likes: 5
From: Kansas City
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
Reply
Old May 3, 2014 | 05:21 AM
  #7  
Navjag96's Avatar
V6 Member
 
Joined: March 22, 2014
Posts: 63
Likes: 0
From: Northern Virginia
Fantastic, detailed info on tuning - thanks for sharing this with us!
Reply
Old May 3, 2014 | 10:16 AM
  #8  
MALWR's Avatar
Member
 
Joined: January 5, 2014
Posts: 26
Likes: 0
From: Katy
This is great info. Thanks for sharing.

Last edited by MALWR; May 20, 2014 at 06:54 PM.
Reply
Old May 3, 2014 | 09:25 PM
  #9  
jim010's Avatar
Legacy TMS Member
 
Joined: November 7, 2006
Posts: 2,792
Likes: 57
From: Alberta
After looking through all that, all I can say is ...

... huh ... ?
Reply
Old May 3, 2014 | 09:43 PM
  #10  
ElkGroveFordGuy's Avatar
Mach 1 Member
 
Joined: February 3, 2014
Posts: 877
Likes: 43
From: Elk Grove, CA
Yup, plug it in!
Push some buttons!
Go faster!
Reply
Old May 4, 2014 | 06:51 AM
  #11  
FromZto5's Avatar
I Have No Life
 
Joined: September 24, 2011
Posts: 10,141
Likes: 172
Originally Posted by ElkGroveFordGuy
Yup, plug it in! Push some buttons! Go faster!
This
Reply
Old May 4, 2014 | 07:21 AM
  #12  
kcoTiger's Avatar
Shelby GT500 Member
 
Joined: December 20, 2011
Posts: 4,326
Likes: 53
From: CenTex...sort of
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.
Reply
Old May 20, 2014 | 06:52 PM
  #13  
madbill1's Avatar
Member
 
Joined: May 9, 2014
Posts: 2
Likes: 0
Great post Matt!! Just a curiosity do you know what RTOS/uC ford uses in their ecu.
Reply
Old May 20, 2014 | 07:14 PM
  #14  
laserred38's Avatar
Legacy TMS Member
 
Joined: January 6, 2006
Posts: 14,053
Likes: 166
From: Bay Area, CA
And when you tune your car, do NOT use an SCT iTSX piece of garbage.
Reply
Old May 21, 2014 | 07:19 AM
  #15  
zeroaviation's Avatar
Thread Starter
Mach 1 Member
 
Joined: March 1, 2007
Posts: 669
Likes: 5
From: Kansas City
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
Reply
Old May 21, 2014 | 06:51 PM
  #16  
InfinibandGT's Avatar
Member
 
Joined: May 21, 2014
Posts: 3
Likes: 0
From: Silicon Valley
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.
Reply
Old May 21, 2014 | 07:28 PM
  #17  
data174's Avatar
Legacy TMS Member
 
Joined: April 7, 2008
Posts: 300
Likes: 2
From: Ocala,Florida
So does ford have written parameter that they can relate to. And how does it relate to the asbuilt code.
Reply
Old May 22, 2014 | 10:25 PM
  #18  
zeroaviation's Avatar
Thread Starter
Mach 1 Member
 
Joined: March 1, 2007
Posts: 669
Likes: 5
From: Kansas City
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
Reply
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Bullitt 3309
5.0L GT Modifications
5
Aug 2, 2015 10:20 PM
HMR-TYM
5.0L GT Modifications
19
Jul 31, 2015 10:39 AM
dohc97
2010-2014 Mustang
10
Jul 26, 2015 09:16 AM
berzerk_1980
2010-2014 Mustang
15
Jul 23, 2015 12:35 AM
2015turbostang
Ecoboost
10
Jul 21, 2015 11:58 AM


Thread Tools
Search this Thread

All times are GMT -6. The time now is 08:02 AM.