Announcement

Collapse
No announcement yet.

Flashing the MK60 with ZCP software

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Originally posted by Bry5on View Post

    Looks like only the MS43 transmits it on 0x338 (DME3), Byte 2

    (STATE_SOF_CAN):
    • 0 = Sport On (requested by SMG)
    • 1 = Sport Off
    • 2 = Sport On
    • 3 = Error
    ​
    We could add it to the 0401 MSS54HP thanks to karter16 ..

    The more I think about this, the more I like it more than memory. The sport button would finally have a real useful purpose.
    DME3 is not present with MS43 except on the Alpina Roadsters MS430070 firmware. However... We have a Spare input with pullup resistor already in place, so we could easily add that in the code. Even though i don't know what to do with it since Im not a friend of map switching or pops and bangs.

    DSC being stand alone controllable would be my prefered way though.

    As soon as you have a way to dump the firmware more easily, i can call a friend with an MK MK60.

    Comment


      Originally posted by sda2 View Post
      As soon as you have a way to dump the firmware more easily, i can call a friend with an MK MK60.
      Hell yeah! That would be awesome.

      Also, I put Bry5on's non-ZCP M3 module dump through the robot disassembly workflow. It's even more similar to the ZCP image than the non-M image is (no surprise there).

      The non-ZCP image is genuinely missing the M track mode button handler, just like the non-M image is. So a FW reflash is required to use this extra input.

      Other differences include a temperature-aware pressure scaler for the pump on the ZCP and differences in the maps. I haven't dug into the maps to know exactly what changes, but they are different.

      Super dense, LLM-speak analysis in https://github.com/heinzboehmer/MK60...differences.md
      2002 Topasblau M3 - Coupe - 6MT - Karbonius CSL Airbox - SSV1 - HJS - Mullet Tune - MK60 Swap - E86 Front Triangulation - ZCP Rack - Nogaros - AutoSolutions - 996 Brembos - Slon - CMP - VinceBar - Koni - Eibach - BlueBus - Journal

      2012 Alpinweiss 128i - Coupe - 6AT - Slicktop - Manual Seats - Daily - Journal

      Comment


        Originally posted by heinzboehmer View Post

        Hell yeah! That would be awesome.

        Also, I put Bry5on's non-ZCP M3 module dump through the robot disassembly workflow. It's even more similar to the ZCP image than the non-M image is (no surprise there).

        The non-ZCP image is genuinely missing the M track mode button handler, just like the non-M image is. So a FW reflash is required to use this extra input.

        Other differences include a temperature-aware pressure scaler for the pump on the ZCP and differences in the maps. I haven't dug into the maps to know exactly what changes, but they are different.

        Super dense, LLM-speak analysis in https://github.com/heinzboehmer/MK60...differences.md
        Is that dump 813.3 or 818.3?

        Comment


          Originally posted by terra View Post
          Is that dump 813.3 or 818.3?
          Bry5on to confirm, but I think 818.3
          2002 Topasblau M3 - Coupe - 6MT - Karbonius CSL Airbox - SSV1 - HJS - Mullet Tune - MK60 Swap - E86 Front Triangulation - ZCP Rack - Nogaros - AutoSolutions - 996 Brembos - Slon - CMP - VinceBar - Koni - Eibach - BlueBus - Journal

          2012 Alpinweiss 128i - Coupe - 6AT - Slicktop - Manual Seats - Daily - Journal

          Comment


            Originally posted by heinzboehmer View Post

            Bry5on to confirm, but I think 818.3
            It’s not the fancy one.
            ‘02 332iT / 6 | ‘70 Jaguar XJ6 electric conversion

            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
              ​

              Comment


                Originally posted by terra View Post
                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?
                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.

                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.
                2002 Topasblau M3 - Coupe - 6MT - Karbonius CSL Airbox - SSV1 - HJS - Mullet Tune - MK60 Swap - E86 Front Triangulation - ZCP Rack - Nogaros - AutoSolutions - 996 Brembos - Slon - CMP - VinceBar - Koni - Eibach - BlueBus - Journal

                2012 Alpinweiss 128i - Coupe - 6AT - Slicktop - Manual Seats - Daily - Journal

                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.
                  2002 Topasblau M3 - Coupe - 6MT - Karbonius CSL Airbox - SSV1 - HJS - Mullet Tune - MK60 Swap - E86 Front Triangulation - ZCP Rack - Nogaros - AutoSolutions - 996 Brembos - Slon - CMP - VinceBar - Koni - Eibach - BlueBus - Journal

                  2012 Alpinweiss 128i - Coupe - 6AT - Slicktop - Manual Seats - Daily - Journal

                  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:
                    Click image for larger version  Name:	65mph DSC intervention.png Views:	0 Size:	301.2 KB ID:	616026

                    This project is great

                    edit: here's a plot that shows the differences between the two calculations ZCP vs M3+ZCP rack:
                    Click image for larger version

Name:	ZCP v M3 error.png
Views:	11
Size:	272.1 KB
ID:	616034
                    Last edited by Bry5on; Yesterday, 10:36 PM.
                    ‘02 332iT / 6 | ‘70 Jaguar XJ6 electric conversion

                    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:

                      Code:
                      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
                      ...
                      The `...` denote regions that were neither probable nor referenced in the disassembly

                      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.

                      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​
                      This is all coming from the 820.3, btw.
                      2002 Topasblau M3 - Coupe - 6MT - Karbonius CSL Airbox - SSV1 - HJS - Mullet Tune - MK60 Swap - E86 Front Triangulation - ZCP Rack - Nogaros - AutoSolutions - 996 Brembos - Slon - CMP - VinceBar - Koni - Eibach - BlueBus - Journal

                      2012 Alpinweiss 128i - Coupe - 6AT - Slicktop - Manual Seats - Daily - Journal

                      Comment

                      Working...
                      X