Announcement

Collapse
No announcement yet.

CSL '0401' Program Binary Disassembly Notes

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

    #61
    Thanks karter16

    I know you are focusing on the MAP sensor at the moment but do you know how much influence the exhaust temperature sensor has on the cold start routine?

    Comment


      #62
      Originally posted by ac427 View Post
      Thanks karter16

      I know you are focusing on the MAP sensor at the moment but do you know how much influence the exhaust temperature sensor has on the cold start routine?
      No worries - with the caveat that I haven't been through every reference to TABG (exhaust gas temp) I believe it is mostly used for calculating cat heating (including TKATM which is the cat temperature model) and the cat protection factor. Most of cold start factors that I have come across reference TMOT (and from memory TOEL in a couple of places, although I might be wrong). When I get a chance I'll look into this more and give you a more definitive answer.
      2005 ///M3 SMG Coupe Silbergrau Metallic/CSL bucket seats
      Build Thread:
      https://nam3forum.com/forums/forum/m...e46-m3-journal

      Comment


        #63
        It occurred to me that it may or may not be immediately apparent to everyone as to why the program code contains so many scaling factors and offsets hardcoded into the program flow.

        The reason for this is that the MSS54 CPU does not have an FPU (floating point unit). This means that the CPU is unable to natively perform floating point calculations and therefore all calculations are done with integer values. This is where all the bitshifts (multiplication/division by powers of 2) multiplication/division/addition/subtraction of parameters and consts comes in.

        Say for example you have a filtered pressure reading from your MAP sensor of 800mbar. You now need to apply a correction factor of 1.03 (e.g. 800 * 1.03 = 824). The problem is that you can't represent 1.03 as floating point value, so you need to store it as a value that can be represented as an integer.We can't just round 1.03 to 1 because then we'll get 800 * 1 = 800, which isn't what we want. What we can do is represent 1.03 as 103 in an integer just fine, so we do that, we add a parameter into the partial binary and give it a value of DEC 103. Now we can apply our correction factor (e.g. 800 * 103 =82400). However now our result is 100 times too big. So what we do is modify the code to multiply our pressure by our correction factor and then divide the result by 100. This gives us (800 * 103 = 82400) and then we divide that by 100 to get 824. We've managed to get to the right end result without having to use floating point numbers.

        This is a simple example, but you can easily envisage calculations which require lots of these scenarios and it can quickly get complicated, like this:


        Click image for larger version  Name:	Screenshot 2025-02-27 at 4.02.25 PM.png Views:	0 Size:	71.1 KB ID:	295889
        Last edited by karter16; 02-26-2025, 06:09 PM.
        2005 ///M3 SMG Coupe Silbergrau Metallic/CSL bucket seats
        Build Thread:
        https://nam3forum.com/forums/forum/m...e46-m3-journal

        Comment


          #64
          And no overflows! Impressive .

          In my other car, I wrote my own motor controller code and found a sneaky overflow bug that commanded full throttle when a calculation overflowed above 55mph. I’d missed ONE mathematical operation in my giant excel sheet that hunted for overflows. Sure was freaky when that electric motor all of a sudden took off on my drive to work, and I was glad to have good brakes.
          ‘02 332iT / 6 | ‘70 Jaguar XJ6 electric conversion

          Comment


            #65
            Have published the XDF - figured it was worth it's own post so you can find that, along with the download link, here: https://nam3forum.com/forums/forum/s...p-csl-0401-xdf
            2005 ///M3 SMG Coupe Silbergrau Metallic/CSL bucket seats
            Build Thread:
            https://nam3forum.com/forums/forum/m...e46-m3-journal

            Comment


              #66
              Have identified the curve at 0xD002 - it describes the maximum torque to be applied by the Moment Manager in the event of a CAN SMG error state being stored in CAN_ED_SMG. The x axis is V (in km/h) and the y axis is torque (in Nm).

              I've named the curve kl_md_can_ed_smg_max.

              Click image for larger version

Name:	Screenshot 2025-03-03 at 5.40.06 PM.png
Views:	95
Size:	13.8 KB
ID:	296446

              The curve is referenced in the function at 0x0001b0c2 which I have named md_can_ed_smg_max_calc()

              Click image for larger version

Name:	Screenshot 2025-03-03 at 5.40.13 PM.png
Views:	78
Size:	54.8 KB
ID:	296447

              This function in turn is run in one of the timed tasks (pretty sure it's the 20ms task but not 100% sure yet) if the gearbox type is SMGII.

              Click image for larger version

Name:	Screenshot 2025-03-03 at 5.40.25 PM.png
Views:	73
Size:	112.4 KB
ID:	296448

              and md_can_ed_smg_max itself is used in the Torque Limitation function of the Moment Manager.

              Click image for larger version

Name:	Screenshot 2025-03-03 at 5.40.40 PM.png
Views:	77
Size:	178.4 KB
ID:	296449
              2005 ///M3 SMG Coupe Silbergrau Metallic/CSL bucket seats
              Build Thread:
              https://nam3forum.com/forums/forum/m...e46-m3-journal

              Comment


                #67
                Fun fact (which other people may already know, I just didn't) - the final RF calculation function in 0401 actually has provision for use of an HFM (MAF) sensor. The HFM sensor is assumed to to be plugged in to HFM1 (which in 0401 default config is the potentiometer for the CSL flap), but there are a number of parameters which can be set which configures the HFM1 A/D converter and ring buffer for a MAF sensor and derives the final RF from the ML value from HFM1. This is interesting as the final RF function in 0401 is not a copy/paste job from the standard MSS54HP code (e.g. it's an intentional inclusion, not a failure to omit). What I haven't looked into yet is whether any of the HFM tables differ from MSS54HP. I'm presuming that it would be calibrated for the standard M3 HFM sensor and cross-sectional area.

                Here's the relevant line from the final RF calc function which I've posted before:

                Click image for larger version  Name:	Screenshot 2025-03-06 at 5.44.34 PM.png Views:	0 Size:	13.5 KB ID:	296828

                And here's the function which reads the A/D converter ring buffer:

                Click image for larger version  Name:	Screenshot 2025-03-06 at 5.55.14 PM.png Views:	0 Size:	82.8 KB ID:	296829
                2005 ///M3 SMG Coupe Silbergrau Metallic/CSL bucket seats
                Build Thread:
                https://nam3forum.com/forums/forum/m...e46-m3-journal

                Comment


                  #68
                  I'll bet they tuned the car with an HFM in the loop at some point to get the cam baselines
                  ‘02 332iT / 6 | ‘70 Jaguar XJ6 electric conversion

                  Comment


                    #69
                    Originally posted by Bry5on View Post
                    I'll bet they tuned the car with an HFM in the loop at some point to get the cam baselines
                    Good call - that makes a lot of sense.


                    Sent from my iPhone using Tapatalk
                    2005 ///M3 SMG Coupe Silbergrau Metallic/CSL bucket seats
                    Build Thread:
                    https://nam3forum.com/forums/forum/m...e46-m3-journal

                    Comment


                      #70
                      karter16

                      Is there anything that would suggest BMW used some of the code to develop the one-off E46 M3 CSL V8? I think that Terra said that the MSS54/HP has spots on the circuit board to drive two extra cylinders. Also, the S62 did run on MAFs.

                      Click image for larger version  Name:	6be625c603ea7802677d0e9057b52a4a.png Views:	4 Size:	565.4 KB ID:	296837
                      Last edited by Slideways; 03-05-2025, 08:56 PM.

                      Comment


                        #71
                        Originally posted by Slideways View Post
                        karter16

                        Is there anything that would suggest BMW used some of the code to develop the one-off E46 M3 CSL V8? I think that Terra said that the MSS54/HP has spots on the circuit board to drive two extra cylinders.

                        Click image for larger version

Name:	6be625c603ea7802677d0e9057b52a4a.png
Views:	44
Size:	565.4 KB
ID:	296837
                        Dream E46 M3 right there and it was SMG too. LOVE IT!

                        Comment


                          #72
                          Originally posted by Slideways View Post
                          karter16

                          Is there anything that would suggest BMW used some of the code to develop the one-off E46 M3 CSL V8? I think that Terra said that the MSS54/HP has spots on the circuit board to drive two extra cylinders. Also, the S62 did run on MAFs.

                          Click image for larger version  Name:	6be625c603ea7802677d0e9057b52a4a.png Views:	4 Size:	565.4 KB ID:	296837
                          I can't say for sure but all the code I've seen is capable of handling 8 cylinders (eg all the TZ and TI arrays are for 8 cyl etc), plus has 2x HFM A/D converters. Standard M3 just uses HFM1 (pin 1 on X60003), HFM2 is pin 18 and 0401 uses this for the MAP sensor and HFM1 for flap pot. As it stands 0401 as is wouldn't run it because HFM2 is assumed to be MAP sensor, but certainly could have been a derivative I would imagine.

                          Pretty sure a lot of the code is fairly common across MSS54 and MSS52, plus funktionsrahmen suggests at least some fmodules are ported to/from MSS60 project.


                          Edit: to be clear, MSS54 software in general has provision for 8 cylinders, which I presume is due to similarity with MSS52 software.
                          Last edited by karter16; 03-05-2025, 09:47 PM.
                          2005 ///M3 SMG Coupe Silbergrau Metallic/CSL bucket seats
                          Build Thread:
                          https://nam3forum.com/forums/forum/m...e46-m3-journal

                          Comment


                            #73
                            What year did the E46 M3 GTR come out?

                            It was a V8. I'm not sure which ECU it used though.

                            Also, which DME did the E39 M5 have, probably a previous generation MSS5x ECU.

                            Comment


                              #74
                              Are MAF's available in the CSL snorkel diameter?

                              It would interesting to implement an MAF for part throttle quality research.

                              Apologies, i could have put these these as one post but i was using the phone on the train home.
                              Last edited by ac427; 03-06-2025, 10:41 AM.

                              Comment


                                #75
                                Originally posted by ac427 View Post
                                Are MAF's available in the CSL snorkel diameter?

                                It would interesting to implement an MAF for part throttle quality research.

                                Apologies, i could have put these these as one post but i was using the phone on the train home.
                                Easy enough to make an adapter for the non-CSL MAF to the lower snorkel, then just leave the flap closed.
                                ‘02 332iT / 6 | ‘70 Jaguar XJ6 electric conversion

                                Comment

                                Working...
                                X