Useful resources for getting started
Background information
Modern engines for dummies
- Understanding the torque-based ECU control strategy: https://www.motorsport-developments.co.uk/Understanding_Ford_Ecoboost_Torque_Control.html. This is a good high-level look at the control strategy of an ECU.
- Bosch's marketing video about their GDI components: https://youtu.be/LjJSbHxIvnM. This includes a gentle introduction to exhaust scavenging and it's impact on turbo lag. If you are thinking about tuning VANOS and wondering where to start, this and MHD's VANOS tuning guide are your goto places (https://github.com/dmacpro91/BMW-XDFs/blob/master/N54/N5X%20tuning%20spreadsheet%2003082016.xlsx).
N54 and N55 Tuning
There are a lot of similarities but N54 tuning is simpler.
- Anjuna's N55 tuning thread: https://www.e90post.com/forums/showthread.php?t=1693922
- Cobb guide to N55 tuning: https://cobbtuning.atlassian.net/wiki/spaces/PRS/pages/828866941/BMW+N55+Tuning+Guide
- Marshall Hesse-Dreville's N54 tuning spreadsheet: https://github.com/dmacpro91/BMW-XDFs/blob/master/N54/N5X%20tuning%20spreadsheet%2003082016.xlsx. This is especially useful for the description of Vanos.
PID control
Dialling in boost control requires a familiarity with PID error control. If you are new to this, these introductions are highly recommended and enough to get you started.
- Motec's video on PID control: https://www.youtube.com/watch?v=16Clfh5eBzg
- MatLab's video series on PID control: https://youtu.be/wkfEZmsQqiA
Other B58 tuning resources
- ECUTek's B58 tuning guide: https://ecutek.atlassian.net/wiki/spaces/SUPPORT/pages/170557464/BMW+B58+Tuning+Guide
- RFP Tuning's B58 tuning videos: https://www.youtube.com/watch?v=zzqAQwAJrdw
- MHD's excellent repo of tuner pro XDFs: https://github.com/dmacpro91/BMW-XDFs
- MHD+ tuning guide: https://github.com/dmacpro91/BMW-XDFs/blob/master/MHD+_Suite_Tuning_Guide.pdf
- Garrett's article on turbo tech, including pressure ratio: https://www.garrettmotion.com/news/newsroom/article/how-to-select-a-turbo-part-2-understanding-calculations-to-turbo-any-engine/#calculating-pressure-ratio
Tools for tuning
A2L file for your car
Having an A2L file that corresponds to your car is the resource for tuning because it describes every value, curve and map in the (stock) ECU. The A2L also describes all the units of these quantities and BMW's A2L are fairly well commented which helps with understanding.
As well as maps, the A2L describes every function and measurement in the ECU and the relationships they have to the maps. This provides a black-box view of what the ECU is doing and, although this does not describe the calculations taking place inside each function, for tuning purposes it is often enough to see the inputs and outputs.
It is worth remembering that, inside each function, the ECU only performs map lookups, simple arithmetic and logic operations. It is a real-time system so any complex calculations, and even square roots, are loaded into maps. This means the implementation is often somewhat guessable from inspection of the inputs and outputs, their units and BMW's comments.
By way of example, the graph below was generated from a gen 1 A2L (using tools at https://github.com/jtownson/xdfbinext) and shows the ECU considering pressure across the cat. From this and graphs like it, one can often work out which maps need inspecting and changing.
Finding the A2L for you car
Inside A2L there is an identifier called the EPK. This is hardcoded inside the A2L and, in addition, there is an EPK_ADDR property which provides a memory location for the EPK in calibration data files. This allows people and software tools to match up EPKs in an A2L and a bin.
Here is an example:
/begin MOD_PAR "MG1CS003" VERSION "R1C2J8B3B" ADDR_EPK 0x96C5AE8 EPK "53/1/MG1CS003/11/MG1CS003_BX8_R1C2J8B3B//R1C2J8B3B///" ...
A technical issue is that if we start with a (stock) bin taken from a car, we do not know the EPK_ADDR. Nonetheless we can use a command like the linux strings command to scan the bin and find the EPK string. Alternatively tools like WinOLS will search for and find it (including the demo version).
$ strings 00003076501103_original.bin | grep MG1CS003 #DME__861#D1#BTL#MDG1G_LK-CB_011_253.5_1.A#MG1CS003_LK______________________________________________________________________________________________________________________________________________________________ 53/1/MG1CS003/11/MG1CS003_BX8_R1C2J8B3B//R1C2J8B3B/// 53/1/MG1CS003/11/MG1CS003_BX8_R1C2J8B3B//R1C2J8B3B///
Clearly this bin corresponds to A2L version R1C2J8B3B.
By running this query for all bins in the BMW-XDF repo provides the following:
Gen | Bin File | A2L Version | Full EPK |
---|---|---|---|
Gen1 | 00003076501103_original.bin | R1C2J8B3B | 53/1/MG1CS003/11/MG1CS003_BX8_R1C2J8B3B//R1C2J8B3B/// |
Gen1 | 00003076501D02_original.bin | R1C2J8I2B | 53/1/MG1CS003/11/MG1CS003_BX8_R1C2J8I2B//R1C2J8I2B/// |
Gen1 | 000030765A3C06_original.bin | R1C2JD06B | 53/1/MG1CS003/11/MG1CS003_BX8_R1C2JD06B//R1C2JD06B/// |
Gen1 | 00003081501102_original.bin | R0C2J8B2B | 53/1/MG1CS003/11/MG1CS003_BX8_R0C2J8B2B//R0C2J8B2B/// |
Gen1 | 00003081501D04_original.bin | R0C2J8I4B | 53/1/MG1CS003/11/MG1CS003_BX8_R0C2J8I4B//R0C2J8I4B/// |
Gen2 | 00005D55289606_original.bin | R4C2F4E6B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2F4E6B//R4C2F4E6B/// |
Gen2 | 00005D5528AA06_original.bin | R4C2F4K6B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2F4K6B//R4C2F4K6B/// |
Gen2 | 00005D5528B405_original.bin | R4C2F4N5B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2F4N5B//R4C2F4N5B/// |
Gen2 | 00005D5528BE07_original.bin | R4C2F4P7B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2F4P7B//R4C2F4P7B/// |
Gen2 | 00005D5528BE09_original.bin | R4C2F4P9B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2F4P9B//R4C2F4P9B/// |
Gen2 | 00005D55327806_original.bin | R4C2H596B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2H596B//R4C2H596B/// |
Gen2 | 00005D55328C05_original.bin | R4C2H5C5B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2H5C5B//R4C2H5C5B/// |
Gen2 | 00005D55329606_original.bin | R4C2H5E6B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2H5E6B//R4C2H5E6B/// |
Gen2 | 00005D5532BE07_original.bin | R4C2H5P7B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2H5P7B//R4C2H5P7B/// |
Gen2 | 00005D5532BE09_original.bin | R4C2H5P9B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2H5P9B//R4C2H5P9B/// |
Gen2 | 00005D5532C808_original.bin | R4C2H5S8B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2H5S8B//R4C2H5S8B/// |
Gen2 | 00005D5532DC05_original.bin | R4C2H5V5B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2H5V5B//R4C2H5V5B/// |
Gen2 | 00005D553C6405_b58o1_original.bin | R4C2H695B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2H695B//R4C2H695B/// |
Gen2 | 00005D553C6405_original.bin | R4C2H695B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2H695B//R4C2H695B/// |
Gen2 | 00005D553C6E05_b58o1_original.bin | R4C2H6B5B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2H6B5B//R4C2H6B5B/// |
Gen2 | 00005D553C6E05_original.bin | R4C2H6B5B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2H6B5B//R4C2H6B5B/// |
Gen2 | 00005D553C7805_original.bin | R4C2H6D5B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2H6D5B//R4C2H6D5B/// |
Gen2 | 00005D553C7807_b58o1_original.bin | R4C2H6D7B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2H6D7B//R4C2H6D7B/// |
Gen2 | 00005D553C7807_original.bin | R4C2H6D7B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2H6D7B//R4C2H6D7B/// |
Gen2 | 00005D553C8207_b58o1_original.bin | R4C2H6H7B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2H6H7B//R4C2H6H7B/// |
Gen2 | 00005D553C8207_original.bin | R4C2H6H7B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2H6H7B//R4C2H6H7B/// |
Gen2 | 00005D553C8C05_b58o1_original.bin | R4C2H6K5B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2H6K5B//R4C2H6K5B/// |
Gen2 | 00005D553C8C05_original.bin | R4C2H6K5B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2H6K5B//R4C2H6K5B/// |
Gen2 | 00005D553C9607_b58o1_original.bin | R4C2H6N7B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2H6N7B//R4C2H6N7B/// |
Gen2 | 00005D553C9607_original.bin | R4C2H6N7B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2H6N7B//R4C2H6N7B/// |
Gen2 | 00005D553CA007_b58o1_original.bin | R4C2H6P7B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2H6P7B//R4C2H6P7B/// |
Gen2 | 00005D553CA007_original.bin | R4C2H6P7B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2H6P7B//R4C2H6P7B/// |
Gen2 | 00005D553CA009_b58o1_original.bin | R4C2H6P9B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2H6P9B//R4C2H6P9B/// |
Gen2 | 00005D553CA009_original.bin | R4C2H6P9B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2H6P9B//R4C2H6P9B/// |
Gen2 | 00005D553CAA08_b58o1_original.bin | R4C2H6S8B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2H6S8B//R4C2H6S8B/// |
Gen2 | 00005D553CAA08_original.bin | R4C2H6S8B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2H6S8B//R4C2H6S8B/// |
Gen2 | 00005D553CBE05_b58o1_original.bin | R4C2H6V5B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2H6V5B//R4C2H6V5B/// |
Gen2 | 00005D55461E08_b58o1_original.bin | R4C2J718B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2J718B//R4C2J718B/// |
Gen2 | 00005D55461E08_original.bin | R4C2J718B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2J718B//R4C2J718B/// |
Gen2 | 00005D55463208_b58o1_original.bin | R4C2J758B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2J758B//R4C2J758B/// |
Gen2 | 00005D55463208_original.bin | R4C2J758B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2J758B//R4C2J758B/// |
Gen2 | 00005D55463C07_b58o1_original.bin | R4C2J797B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2J797B//R4C2J797B/// |
Gen2 | 00005D55463C07_original.bin | R4C2J797B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2J797B//R4C2J797B/// |
Gen2 | 00005D55464605_b58o1_original.bin | R4C2J7A5B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2J7A5B//R4C2J7A5B/// |
Gen2 | 00005D55464605_original.bin | R4C2J7A5B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2J7A5B//R4C2J7A5B/// |
Gen2 | 00005D55465005_b58o1_original.bin | R4C2J7N5B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2J7N5B//R4C2J7N5B/// |
Gen2 | 00005D55465005_original.bin | R4C2J7N5B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2J7N5B//R4C2J7N5B/// |
Gen2 | 00005D55465A07_b58o1_original.bin | R4C2J7P7B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2J7P7B//R4C2J7P7B/// |
Gen2 | 00005D55465A07_original.bin | R4C2J7P7B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2J7P7B//R4C2J7P7B/// |
Gen2 | 00005D55465A09_b58o1_original.bin | R4C2J7P9B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2J7P9B//R4C2J7P9B/// |
Gen2 | 00005D55465A09_original.bin | R4C2J7P9B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2J7P9B//R4C2J7P9B/// |
Gen2 | 00005D55466408_b58o1_original.bin | R4C2J7S8B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2J7S8B//R4C2J7S8B/// |
Gen2 | 00005D55466408_original.bin | R4C2J7S8B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2J7S8B//R4C2J7S8B/// |
Gen2 | 00005D55467805_b58o1_original.bin | R4C2J7V5B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2J7V5B//R4C2J7V5B/// |
Gen2 | 00005D55467805_original.bin | R4C2J7V5B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2J7V5B//R4C2J7V5B/// |
Gen2 | 00005D55502807_b58o1_original.bin | R4C2L857B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2L857B//R4C2L857B/// |
Gen2 | 00005D55503705_b58o1_original.bin | R4C2L875B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2L875B//R4C2L875B/// |
Gen2 | 00005D55503C05_b58o1_original.bin | R4C2L8N5B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2L8N5B//R4C2L8N5B/// |
Gen2 | 00005D55504807_b58o1_original.bin | R4C2L8P7B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2L8P7B//R4C2L8P7B/// |
Gen2 | 00005D55504809_b58o1_original.bin | R4C2L8P9B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2L8P9B//R4C2L8P9B/// |
Gen2 | 00005D5550480C_b58o1_original.bin | R4C2L8PCB | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2L8PCB//R4C2L8PCB/// |
Gen2 | 00005D55505008_b58o1_original.bin | R4C2L8S8B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2L8S8B//R4C2L8S8B/// |
Gen2 | 00005D55506406_b58o1_original.bin | R4C2L8V6B | 56/1/MG1CS201/11/MG1CS201_BX8TUE_R4C2L8V6B//R4C2L8V6B/// |
BMW software versioning side-note
Apparently, the format of BMW software versions is composed from PREFIX + C2|C9 + VERSION1 + VERSION2 where
- Prefix denotes a specific engine as noted in the table below.
- C9 denotes a development build
- C2 denotes a release build
- VERSION 1 and 2 appear to be major/minor versions (although I was not able to confirm this).
Version prefix | Engine code | DME | App software |
---|---|---|---|
R0 | Early BX8 | MG1CS003 | DME8.? |
R1 | B58 | MG1CS003 | DME8.6 |
R2 | ? | ? | ? |
R4 | B58TU | MG1CS201 | DME8.6T0 |
F4 | S58 | MG1CS049 | DME8.6.S |
H4 | S63TU | MG1CS202 | DME II |
Application documentation (aka Funktionsrahmen)
Unfortunately, functions described in the A2L are not always simple, can have dozens of inputs and outputs and what is happening inside them is not guessable. In this case, and for more specialist tuning goals, you need a Funktionsrahmen (FR or FRM), which is a PDF export of the computation paths in the DME generated from the (Matlab Simulink) code. Important sections might also contain text and diagrams that help to explain the strategies.
For any given software version, the DME code consists of two levels, each with its own FR:
- A supplier layer provided by Bosch. In general, this is focused on low-level support functions. It can be somewhat useful for tuning, for example, knock detection is covered in this document.
- A BMW application layer. This has a lot of useful information about timing, lambda control, fuel injection and turbo control.
Unfortunately, FRs can be hard to obtain, especially in the software version of your choosing and many people work from FRs that relate to versions only somewhat related to their car.
ASAP2 Demo
This is an awesome tool from https://jnachbaur.de/ASAP2Demo/ASAP2.html which lets you browse through A2L files and the calibration bins based on those.
A2Ls are loaded through the file-->open menu option and bins are loaded via the file-->load data file menu option.
Because it is based on the A2L, you can use it to glance quickly at any ECU object without having to import or convert (a common impediment with WinOLS and TunerPro). So, for example, if you see a map called KF_AUSY_TURB with an axis representing MAF, in the A2L, ASAP2Demo let's you see the map quickly and determine if you want to import it into tunerpro or other tool (more on this below).
One specific and important use for ASAP2Demo is to check the verion number of a bin file. This is held in a value called CustDiag_dDatasetVer_C:
Finally, ASAP2Demo supports all the characteristic types and axis types in the A2L standard, which makes it good for looking at non-numeric data.
QTranslate
QTranslate, from https://qtranslate-app.web.app/, is a very useful app that allows quick and easy translation of German text without having to switch to google translate.
Getting tunes off of your car
If you have a dialled-in tune on your car, it can be useful to read it off the ECU.
For gen 1 cars using Bosch MG1 with the SPC5777M chipset I have had success with ECU Bench tool. This is an inexpensive tool which works for reading ECUs without bricking them.
That said, a more effective workflow is to use the bench tool to read the DME but then write with the common flashing platforms like MHD since they support burbles, switchable fuel pumps, downpipes, etc. In order to do this, bear in mind that the bench reader reads a wider ROM segment off the chipset while the calibration space used for tunerpro bins are at an offset within this (e.g. 0x40001).
There are other more expensive professional options available, like autotuner and bitbox.
Tuning with MHD
Jobs involving antilag, flexfuel and map switching require editing of custom MHD tables which are not in any BMW A2L. MHD's approach here is to use tuner pro and they provide a well organized repo of tuner pro XDFs to support this. The XDF can be found at https://github.com/dmacpro91/BMW-XDFs.
The XDFs include table definitions for some but not all tables you might want to modify and they only include a small subset of tables you might want to inspect when trying to understand DME objects in context. For that reason, a good workflow with MHD is to
- Use the A2L and ASAP2Demo (or WinOLS if you have a licence) to browse and understand DME settings in the large.
- Import objects into XDF if needed and complete edits there.
- Flash with MHD Flasher.
TunerPro itself is available from https://www.tunerpro.net/. Generally, you want the TunerPro RT version. Consider registering the software at https://www.tunerpro.net/registration.htm, especially if you use the software to develop a working tune for your car.