Announcement

Collapse
No announcement yet.

CSL '0401' Program Binary Disassembly Notes

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

  • ppm008
    replied
    You are right.
    The bug was also fixed for MSS54 nonHP in 322_1701, but never for CSL

    Leave a comment:


  • karter16
    replied
    Originally posted by ppm008 View Post
    Karter16
    You are amazing
    This bug was fixed in 323_1801 (M3 MY 04 first M3 MSS54HP)
    But thats only a very small bug in SMG clutch learning behaviour
    Interesting! so BMW fixed for the standard M3 when they moved to the MSS54HP, but never bothered publishing a fix for the CSL specifically right? As you say it seems to be a pretty small bug, would be a bit of an edge case I think to cause any issue.

    Leave a comment:


  • ppm008
    replied
    Karter16
    You are amazing
    This bug was fixed in 323_1801 (M3 MY 04 first M3 MSS54HP)
    But thats only a very small bug in SMG clutch learning behaviour

    Leave a comment:


  • karter16
    replied
    Found a bug in the SMG background task:

    Click image for larger version

Name:	Screenshot 2026-08-02 at 5.25.48 PM.png
Views:	137
Size:	200.4 KB
ID:	362708

    The error check conditional checks LA1_ED twice. The second test should be LA2_ED....

    Leave a comment:


  • HARBER07
    replied
    It was more of my curiosity than anything at this stage. I was just wondering if any changes could be made to the safety/operating state when sensors fail…. Eg. MAP, EGT or IAT etc.

    i shall have a read of that document when I get a chance though as I’d missed that one completely.

    Leave a comment:


  • karter16
    replied
    Originally posted by HARBER07 View Post
    Have you looked into how the ‘emergency program’ / limp mode operation works?. I’m wondering what changes it enables when it kicks in and any adjustability
    Yep I have - and this funktionsrahmen document is fairly accurate if you're looking to get an understanding of how it works: https://github.com/karter16/CSL_0401...%20Concept.pdf

    Note that this doc doesn't talk to CSL-specific changes (specifically how rf (filling) errors are detected and escalated to the EGAS emergency program).

    in terms of adjustability what would you be wanting to change?

    Leave a comment:


  • HARBER07
    replied
    Have you looked into how the ‘emergency program’ / limp mode operation works?. I’m wondering what changes it enables when it kicks in and any adjustability

    Leave a comment:


  • terra
    replied
    Originally posted by karter16 View Post
    Something else that I've been looking at is a binary that terra shared with me that came from a brand new CSL DME. This DME in particular was shipped without the tune file programmed to it. In its place is what I believe is a manufacturer test software to test the unit on the (Siemens) assembly line.

    the MSS54 bootloader has provision to jump to this location (there's actually a DS2 call to perform the jump) and treat the region as code.

    The software appears to be a basic main loop that handles communications between the master and slave processors, as well as a very DS2-like communications protocol (literally the only differences seem to be the message ID and length bytes are swapped, the checksum calculation is different and the actual device/command IDs are different) on the same pins as DS2.

    The functions that can be called all test different aspects of the DME and CPU hardware and validate their functionality.

    There are also several functions for reading/writing/wiping the flash memory. Crucially the function that wipes flash sectors includes the ability to wipe and write to the bootsector. You can probably see where I'm going with this...

    1: Load the code into the tune sector in place of the tune
    2: DS2 call to jump to the program
    3: Wipe bootsector
    4: Write new bootsector
    5: Reboot DME
    6: Write new Program for new bootloader
    7: Write new Tune for new bootloader
    8: Fin.


    It would be trivial to extend the MSS54 DS2 Tool to use the modified communication protocol when needed, but this introduces a different risk, which is that when the DME is in the car there are other modules listening on DS2 and the possibility can't be discounted of a packet being seen as valid by one of those other modules and causing unintended havoc. Therefore I think the way to go is a small wrapper that translates standard DS2 calls into the format required by the manufacturer test code. That way comms to the DME stays compliant with the DS2 protocol but also means very minimal change to the test software.

    This will be fun to see if I can make it work, but will need to wait until I get hold of a second DME as don't want to be regularly taking my main DME apart to BDM recover it which will inevitably be required for this project.

    This would enable the following functionalities:

    - Change bootloader over OBDII
    - Clear EWS and perform an initial sync
    - It would also significantly lower the barrier to use should we want to make any bootloader-level changes as part of 0401 Community Patch in the future.
    Great work there! Sometimes my data hoarding is useful ha

    Leave a comment:


  • karter16
    replied
    Well enormous thanks to bmwfnatic and ZiMMie - DME is on its way to me. This means I'll be able to put together a bench setup that will allow for lots more experimentation (and a greater tolerance for failure!). I'm very grateful to you both, this community is amazing!!

    Leave a comment:


  • ZiMMie
    replied
    Originally posted by bmwfnatic View Post

    Just pay me for shipping and I'll give you a DME, as my contribution to this project :P
    I'll pay for shipping for you to ship to to him. Sent you pm.

    Leave a comment:


  • bmwfnatic
    replied
    Originally posted by karter16 View Post
    This will be fun to see if I can make it work, but will need to wait until I get hold of a second DME as don't want to be regularly taking my main DME apart to BDM recover it which will inevitably be required for this project.
    Just pay me for shipping and I'll give you a DME, as my contribution to this project :P

    Leave a comment:


  • karter16
    replied
    Something else that I've been looking at is a binary that terra shared with me that came from a brand new CSL DME. This DME in particular was shipped without the tune file programmed to it. In its place is what I believe is a manufacturer test software to test the unit on the (Siemens) assembly line.

    the MSS54 bootloader has provision to jump to this location (there's actually a DS2 call to perform the jump) and treat the region as code.

    The software appears to be a basic main loop that handles communications between the master and slave processors, as well as a very DS2-like communications protocol (literally the only differences seem to be the message ID and length bytes are swapped, the checksum calculation is different and the actual device/command IDs are different) on the same pins as DS2.

    The functions that can be called all test different aspects of the DME and CPU hardware and validate their functionality.

    There are also several functions for reading/writing/wiping the flash memory. Crucially the function that wipes flash sectors includes the ability to wipe and write to the bootsector. You can probably see where I'm going with this...

    1: Load the code into the tune sector in place of the tune
    2: DS2 call to jump to the program
    3: Wipe bootsector
    4: Write new bootsector
    5: Reboot DME
    6: Write new Program for new bootloader
    7: Write new Tune for new bootloader
    8: Fin.


    It would be trivial to extend the MSS54 DS2 Tool to use the modified communication protocol when needed, but this introduces a different risk, which is that when the DME is in the car there are other modules listening on DS2 and the possibility can't be discounted of a packet being seen as valid by one of those other modules and causing unintended havoc. Therefore I think the way to go is a small wrapper that translates standard DS2 calls into the format required by the manufacturer test code. That way comms to the DME stays compliant with the DS2 protocol but also means very minimal change to the test software.

    This will be fun to see if I can make it work, but will need to wait until I get hold of a second DME as don't want to be regularly taking my main DME apart to BDM recover it which will inevitably be required for this project.

    This would enable the following functionalities:

    - Change bootloader over OBDII
    - Clear EWS and perform an initial sync
    - It would also significantly lower the barrier to use should we want to make any bootloader-level changes as part of 0401 Community Patch in the future.

    Leave a comment:


  • karter16
    replied
    Time for an update!

    After a lot of time, a few attempts, and lots of reference to the EDK/WDK module which is actually similar in some regards and helps with naming conventions etc. I've mapped out the functions for the CSL snorkel flap. Below is my equivalent of a "funktionsrahmen" for this module which, although it no doubt exists for real, I don't have it, so this will have to do. Function names, variable names and parameter names are all mine (with the exception that we know from the DS0 file disassembly that the module is called GKS), but are named logically in line with how equivalent variables and parameters are named in other modules, etc.

    Click image for larger version  Name:	GKS_1.png Views:	0 Size:	237.1 KB ID:	359273
    Click image for larger version  Name:	GKS_2.png Views:	0 Size:	195.8 KB ID:	359274
    Click image for larger version  Name:	GKS_3.png Views:	0 Size:	116.6 KB ID:	359265
    Click image for larger version  Name:	GKS_4.png Views:	0 Size:	122.3 KB ID:	359263
    Click image for larger version  Name:	GKS_5.png Views:	0 Size:	213.5 KB ID:	359271
    Click image for larger version  Name:	GKS_6.png Views:	0 Size:	292.9 KB ID:	359272
    Click image for larger version  Name:	GKS_7.png Views:	0 Size:	191.0 KB ID:	359267
    Click image for larger version  Name:	GKS_8.png Views:	0 Size:	193.3 KB ID:	359268
    Click image for larger version  Name:	GKS_9.png Views:	0 Size:	179.4 KB ID:	359266
    Click image for larger version  Name:	GKS_10.png Views:	0 Size:	107.8 KB ID:	359264
    Click image for larger version  Name:	GKS_11.png Views:	0 Size:	79.8 KB ID:	359275
    Click image for larger version  Name:	GKS_12.png Views:	0 Size:	184.2 KB ID:	359269
    Click image for larger version  Name:	GKS_13.png Views:	0 Size:	255.2 KB ID:	359270

    Leave a comment:


  • terra
    replied
    Cool. I guess 'Address access time = (2.5 + WS) tcyc – tCHAV – tDICL' is probably the relevant formula? Though tCHAV​ has a rather large range in the datasheet so I'm not sure what to enter as a calculation. Seems like BMW is selecting flash memory that should allow for 0 wait states in most scenarios.

    If I assume the target access time would be proportional to the clock speed difference, ~76ns should be acceptable (assuming 20.97MHz for MSS52/4 and 24.76 MHz for MSS54HP which I believe is correct) -- so either way I think you're right in the 70ns likely being acceptable (there are also some ancient 29f400ab's occasionally available that came in 75ns, those may work too)

    Leave a comment:


  • karter16
    replied
    I think this is the right diagram (from page 283 onwards here: https://github.com/karter16/CSL_0401.../MC68376.pdf):

    Click image for larger version

Name:	Screenshot 2026-05-08 at 5.17.10 PM.png
Views:	190
Size:	87.0 KB
ID:	354773

    The whole read cycle is approximately 4 clock cycles, but the data needs to be stable on the bus by the time DSACK is low for sampling. I didn't go through the table and work it out but it looks to me to be somewhere in the region of 1.25 to 1.75 clock cycles between the address being stable and data needing to be read (So as you say, less than 2 clock cycles).

    I would imagine from this that 70ns is probably just fast enough to work, but I don't know whether it's too close to the edge (pun intended) or not. I'd think 90ns would likely be less successful given that's definitely more than 2 clock cycles.

    Leave a comment:

Working...
X