Originally posted by Bry5on
View Post
Announcement
Collapse
No announcement yet.
Flashing the MK60 with ZCP software
Collapse
X
-
*should* .. interestingly, if it does then the ZCP technically has the looser oversteer limits due to the taller tires and the way the yaw prediction (and therefore threshold limit) is calculated.Originally posted by heinzboehmer View Post
CSL shares the same part number with the ZCP, so it should have the 817.3
813.3 came in late model normal M3s (I think). Annoyingly, I was looking through pictures and the MK60 module I took out of my car to replace with the 817.3 was an 813.3...
Well in that case, someone with an 06 M3 then? Man, what a bummer about the swap. Is the car still local?
- Likes 1
Leave a comment:
-
CSL shares the same part number with the ZCP, so it should have the 817.3Originally posted by Bry5on View PostAnyone with an actual CSL willing to connect their computer for 20 minutes to pull down a dump of (presumably) an 813.3?
813.3 came in late model normal M3s (I think). Annoyingly, I was looking through pictures and the MK60 module I took out of my car to replace with the 817.3 was an 813.3...
Leave a comment:
-
Anyone with an actual CSL willing to connect their computer for 20 minutes to pull down a dump of (presumably) an 813.3?
Leave a comment:
-
Yep! That's the goal, at least.Originally posted by liam821 View Post
100000% follow you. Wow! This is huge. Sounds like designing a program that you can upload into ram, then execute, which can then handle rewriting the firmware is plausible.
Hardest part so far has been finding the flash controller. Been referencing the E5 disassembly, but the peripherals aren't laid out exactly the same.
As expected, a routine in RAM is not allowed to write to the program region, so we're gonna have to go through the flash controller.
Bonus from all of this is that, since we're running our own code, we can theoretically read/write over CAN! Haven't even started messing with that, but it would be nice to make this process faster.
- Likes 3
Leave a comment:
-
100000% follow you. Wow! This is huge. Sounds like designing a program that you can upload into ram, then execute, which can then handle rewriting the firmware is plausible.Originally posted by heinzboehmer View PostSuper unreadable logs, I know, but basically, I've gotten arbitrary code execution working!
This is part of the manufacturer diag protocol, btw, not something custom. There's a certain sequence of commands that allow you to upload arbitrary routines into RAM, then execute.
The test above writes a byte in RAM then checks it was written successfully.
I think many of you can probably guess where this is going!
- Likes 3
Leave a comment:
-
Update from me too:
Super unreadable logs, I know, but basically, I've gotten arbitrary code execution working!Code:mfg exec: build descriptor via 0xA6 K/L/K, trigger 'O', expect marker 0x5A @0x00401400. SRAM only, nothing hits flash. mfg exec (K/L/K/O long-frame): upload stub 33 64 61 45 3C 85 1E 54 65 A3 B3 04 00 CF -> desc+6, finalize (P1=0x04FE0010), trigger 0xA6 'O', expect marker 0x5A @0x00401400. SRAM only, nothing hits flash. mfg entry: relay (bench) path - cycling KL15 via the wired relay, up to 4 attempt(s). (Check "Cycle Ignition Manually" for the on-car A5-edge knock instead.) 06 A3 33 00 00 31 36 43 -> 03 E4 66 33 80 (..f3.) level raise: level 3 0B A5 54 30 30 34 30 31 34 30 30 00 8D -> 01 E4 E5 (...) K-init (claim descriptor): 12 A6 4B 30 30 30 30 30 30 30 30 31 30 30 32 30 30 30 30 06 -> 02 E4 01 E7 (....) reply tag 0x01 ('.') () L-append (upload stub): 12 A6 4C 00 00 33 64 61 45 3C 85 1E 54 65 A3 B3 04 00 CF 02 -> 02 E4 01 E7 (....) reply tag 0x01 ('.') () descriptor read-back @0x004011AA: 00 00 00 03 7B A0 33 64 61 45 3C 85 1E 54 65 A3 B3 04 00 CF K-finalize (arm exec): 12 A6 4B 30 34 46 45 30 30 31 30 30 30 30 30 30 30 30 30 33 -> 02 E4 01 E7 (....) reply tag 0x01 ('.') () control byte @0x004011A7: 80 (0x80 exec-ready) O-exec (trigger jsr): 02 A6 4F F7 -> 04 E4 72 80 D9 B3 (..r...) marker before: 00 EXEC PROVEN: marker 0x5A appeared at 0x00401400 - the stub ran.
This is part of the manufacturer diag protocol, btw, not something custom. There's a certain sequence of commands that allow you to upload arbitrary routines into RAM, then execute.
The test above writes a byte in RAM then checks it was written successfully.
I think many of you can probably guess where this is going!
- Likes 6
Leave a comment:
-
Update: I’m now able to predict DSC interventions with a high degree of accuracy after decompiling the vehicle model and oversteer (and understeer) intervention paths. These graphics are just the oversteer intervention path, including visuals showing how it changes with m-track mode. I also think we’ve got all the variables that need changing to incorporate the ZCP vehicle yaw model completely - it’s 5 numbers. There are other things that the ZCP model changes a bit but for the purposes of my annoyance, these are the big ones.
edit: worth noting that I was harder with the steering wheel increasingly in these tests. First one was smooth. And this forum’s image handling bites again, sorry you can’t read the text :/
Last edited by Bry5on; 11-20-2026, 05:23 PM.
- Likes 2
Leave a comment:
-
I also did some learning today. Spent some time trying to comprehensively map the memory on this thing.
We can guess the rough bounds of some regions (e.g. RAM, MMIO) based on addresses in the disassembly, but a concrete map requires direct probing.
First region I found is the FW region (what we already know how to dump), which ranges from 0x00000 to 0x5FFFF. Then there's a mysterious region from 0x100000 to 0x15FFFF, which is suspiciously the same size as the FW region. After that there's RAM from 0x400000 to 0x4017FF.
I dumped the mysterious region and found it full of just 0x0000 and 0x0001. Some of you probably already know where this is going, but let's do a quick sanity check with a random address (and some horrible python):
Code:$ xxd -s 0x4030 -l 16 820.3_e46_non_m_mk60_full_dump.bin 00004030: c707 0177 0d76 e8a4 c43e 0174 37f4 e883 ...w.v...>.t7... $ xxd -s 0x4030 -l 16 820.3_mystery_dump.bin 00004030: 0000 0001 0000 0001 0000 0001 0000 0001 ................ $ python3 >>> def even_parity_fold(halfword: int) -> int: ... x = halfword & 0xFFFF ... x ^= x >> 8 ... x ^= x >> 4 ... x ^= x >> 2 ... x ^= x >> 1 ... return x & 1 ... >>> parities = [] >>> for halfword in "c707 0177 0d76 e8a4 c43e 0174 37f4 e883".split(): ... parities.append(f"{even_parity_fold(int(halfword, 16)):04d}") ... >>> print (parities) ['0000', '0001', '0000', '0001', '0000', '0001', '0000', '0001']
So yes, suspicions confirmed, this is just the ECC region, likely written by the flash controller. It's single bit parity per 16 bit halfword, not the most advanced thing in the world. I don't know if runtime single bit correction is actually implemented or if this is just a check.
I used fairly coarse block sizes for the rough probes, then narrowed down the boundaries. This strategy worked well for the above regions, but did not work well at all for finding MMIO blocks. So, I threw a robot at the disassembly and had it find me guesses for said registers, based on ADC reads, button inputs, clock init, etc. I then confirmed those by probing byte by byte.
With all that, here's the memory map I have:
The `...` denote regions that were neither probable nor referenced in the disassemblyCode:0x0000_0000..0x0005_FFFF - FW region (unused tail is filled with 0xFF) ... 0x0010_0000..0x0015_FFFF - ECC region ... 0x0040_0000..0x0040_17FF - RAM ... 0x007F_8010..0x007F_803D - Timer B (mirror of timer A below) ... 0x00E6_004D..0x00E6_015B - System/Clock Config (not probable, read from disassembly) ... 0x00EF_8200..0x00EF_8503 - Watchdog/Clock-enable/CRC (avoid probing, see below) ... 0x00EF_FF20..0x00EF_FF3F - Digital IO ... 0x00FF_8010..0x00FF_803D - Timer A (for wheel speed capture) ... 0x00FF_FA08..0x00FF_FB3F - QSPI/ASIC Link ... 0x00FF_FC86..0x00FF_FDFD - CAN Controller ...
Fun thing about the watchdog block is that my probing triggered some pretty serious fault. The module completely stopped responding to UART and to the ignition signal. Only way to get it back was to cycle the constant 12V feed. On a car, this means disconnecting the battery!
Also, the MMIO block bases are likely intended to be something like what's below, but I figured writing out the granular probe results in the map will be useful in the future.
This is all coming from the 820.3, btw.Code:0x007F_8000 - Timer B 0x00E6_0000 - System/Clock Config 0x00EF_8000 - Watchdog/Clock-enable/CRC 0x00EF_FF00 - Digital IO 0x00FF_8000 - Timer A 0x00FF_FA00 - QSPI/ASIC Link 0x00FF_FC80 - CAN Controller
- Likes 3
Leave a comment:
-
Today I learned:
1) The steering model is not just a ratio model, it is built alongside the vehicle cornering model
2) The ZCP model has very few changes from the M3 model
3) The ZCP model has a significant change to the expected yaw calculation at around 65mph that *goes with the steering ratio model that we set in NCS* - and this change is to a table that is not editable with NCS Expert
4) My too-early DSC interventions all happen about 65mph where the calculated expected yaw and actual yaw values differ by ~4deg/s
5) The DSC intervention threshold in normal DSC mode is ~4deg/s (variable and above 15deg/s in m-track mode)
Why is this significant? In my build thread I've been chasing (and datalogging) DSC interventions and trying to figure out why I have this issue with the non-m (same ratio as ZCP) steering rack even though I'd coded the rack's ratio. The learnings above explain why Heinz, who has a ZCP MK60, has not been able to reproduce these symptoms.
Here is a graphic to help tell the story (snippet of my datalogs here, pulled from CAN MK60 datalogs of expected and measured yaw). ZCP calculation in red, M3+ZCP rack calculation in blue, actual value in black, DSC trigger threshold in dotted blue:
This project is great
edit: here's a plot that shows the differences between the two calculations ZCP vs M3+ZCP rack:
Last edited by Bry5on; 11-18-2026, 10:36 PM.
- Likes 3
Leave a comment:
-
820.3:
Code:JOB_STATUS = OKAY ID_BMW_NR = 6765452 ID_HW_NR = 0.1 ...
817.3:
Code:JOB_STATUS = OKAY ID_BMW_NR = 2282420 ID_HW_NR = 0.0 ...
So it lines up with that claim, if it turns out that the 820.3 isn't flashable.
- Likes 1
Leave a comment:
-
I've seen no routines that read/write the FW itself on any of the E46 modules (except for in the manufacturer diag protocol). There are EEPROM read/write routines present, though. I'd have to go double check, but I think all the EEPROM logic is identical across modules.Originally posted by terra View PostSo re: flashable modules -- in the past I have been told "ID_HW_NR" (from the 'ident' job --output reproduced below) being 0.0 indicates a flashable module while 0.1 indicates not-flashable (i.e fixed rom). Anything in the disassembly to indicate that could be a real marker of onboard flash vs ROM?
Long story short, there isn't anything I've seen in the FW to indicate whether the claim is true or not.
I do have both supposedly non-flashable and supposedly flashable modules here with me, so let me see what the ident job says for both.
- Likes 1
Leave a comment:
-
So re: flashable modules -- in the past I have been told "ID_HW_NR" (from the 'ident' job --output reproduced below) being 0.0 indicates a flashable module while 0.1 indicates not-flashable (i.e fixed rom). Anything in the disassembly to indicate that could be a real marker of onboard flash vs ROM?
Code:JOB_STATUS = OKAY ID_BMW_NR = 2282250 [B]ID_HW_NR = 0.1[/B] ID_COD_INDEX = 6 00 06 .. ID_DIAG_INDEX = 6 00 06 .. ID_VAR_INDEX = 22 00 16 .. ID_DATUM_JAHR = 2004 07 D4 .Ô ID_DATUM_MONAT = 9 00 09 .. ID_DATUM_TAG = 11 00 0B .. ID_DATUM = 11.09.2004 ID_LIEF_NR = 24 00 18 .. ID_LIEF_TEXT = Temic ID_SW_NR_FSV = 0.0.129 ID_SW_NR_OSV = 0.0.0 ID_SW_NR_MCV = 0.0.0 ID_SW_NR_RES = 0.0.0 _TEL_AUFTRAG = 6 Bytes 0000 : B8 29 F1 02 1A 80 ¸)ñ..? _TEL_ANTWORT = 36 Bytes 0000 : B8 F1 29 1F 5A 80 00 00 02 28 22 50 [B]01 [/B]06 00 06 ¸ñ).Z?.. .("P.... 0020 : 00 00 00 73 ...s
Leave a comment:
-

Leave a comment: