|
RomRaider
Documentation
Community
Developers
|
| Author |
Message |
|
terraphantm
|
Post subject: MS43 CAN Bus Posted: Fri Feb 19, 2016 11:29 pm |
|
 |
| Newbie |
Joined: Fri Jan 23, 2015 4:15 am Posts: 9
|
Hello, I'm new here, but not new to BMWs. Until now I've mostly been interested in the MSS54/HP (E46 M3) DME, but I've recently acquired a 330i which I plan on converting to MS43, so I thought it's about time I start learning a thing or two about this DME. I do find the C167 code to be rather unintuitive to follow, but I'm sure I'll eventually figure it out. For now I'm interested in seeing how the MS43 deals with the CAN-bus. I'm looking at this for a coupe reasons: 1) The E46 CAN-bus is well documented and I have a complete disassembly of the analogous MSS54 code - might make it easier to identify certain variables. 2) I'd like to see if it's possible to broadcast some things that over CAN that the MS43 normally doesn't. For example, the RPM warning field messages found on the E46 M3 and E39 M5
To start off, the DMEs of this generation BMW broadcasts messages on 3 arbitration IDs (ARBIDs). They are: ARBID 0x316 ("DME1") ARBID 0x329 ("DME2") ARBID 0x545 ("DME4") With my own logs and disassembly, and the help of some work done by members on bfc, I was able to figure out the following about those DME messages 0x316 Quote: byte 0 Bit 0 - Some status DBW related, set to 0 if everything is running normally Bit 1 - Unused (in MSS54) Bit 2 - Set to 0 if ASC/DSC error, 1 otherwise Bit 3 - Set to 0 if manual, Set to 1 if SMG (on this DME, others may be different) Bit 4 - Set to bit 0 of md_st_eingriff (torque intervention status) Bit 5 - Set to bit 1 of md_st_eingriff Bit 6 - Set to 1 AC driver error Bit 7 - Set to 1 if MAF error byte 1 - md_ind_ne_ist -- current engine torque after interventions (in %) byte 4 - md_ind_ist -- current engine torque before interventions (in %) byte 5 - md_reib -- torque loss of consumers (alternator, ac, oil pump, etc.) (in %) byte 7 - md_ind_lm_ist -- theoretical engine torque from air mass, excluding igntion angle (in %) 0x329 Quote: Byte 0: On my DME, that byte 0 constantly cycles between 0x11, 0x40, 0x80, and 0xDF. It looks like that 4th value is what can vary from engine to engine. On the MSS54, that 4th value is determined by ORing 0xC0 with a variable BMW calls "md_norm_can" which is taken directly from scalar called "K_MD_NORM" which is set to 0x1F on my DME. The math works out -- 0x1F OR 0xC0 = 0xDF. On a 330i, this 4th value is 0xD9 (so the OR'd value is 0x19). We'll get back to this for the MS43 Byte 1 - Coolant Temp (ºC = 0.75*X - 48) Byte 2 - atmospheric pressure (mbar = 2x + 597) Byte 3 bit 0 - Clutch switch (0 = engaged, 1 = disengage/neutral); bit 2 - Hardcoded to 1 (on MSS54, could be used on other DMEs) bit 4 - Possibly Motor Status (0 = on, 1 = off) bits 5, 6, 7 - Tank Evap duty cycle Byte 4 - Driver desired torque, relative (00 - FE) Byte 5 - Throttle position (00-FE). Byte 6 bit 0 - Brake pedal depressed (0 = off, 1 = on) bit 1 - Brake LIght Switch Error (0 = off, 1 = error) bit 2 kickdown switch depressed (0 = off, 1 = kickdown) Byte 7 - unused 0x545 Quote: Byte 0 Bit 0 - unused Bit 1 - Check Engine light (0 = off, 1 = on) Bit 3 - Cruise Control Light (0 = off, 1 = on) Bit 4 - EML Light (0 = off, 1 = on) Bit 7 - Check Gas Cap light (0 = off, 1 = on) Byte 1 - Fuel Consumption LSB Byte 2 - Fuel Consumption MSB (Values just cycle from 0 to FFFF then start over at zero. Fuel consumiption is the rate of change.) Byte 3 bit 0 - Oil level error if motortype = S62 bit 1 - Oil Level Warning bit 2 - Oil Level Error bit 3 - Overheat Light bit 4, 5, 6 - M3/M5 RPM Warning Field (refer to tables below)
Byte 4 - Oil Temperature (ºC = X - 48) Byte 5 - Charge Light (0 = off, 1 = on; only used on some DMEs) Byte 6 - CSL Oil Level (format unclear) Byte 7 - Possibly MSS54 TPM Trigger RPM Warning Field Table (E46 M3 Cluster) Code: LED Value (dec) Value (bin) Left shift 7500 0 0 #000#### 7000 1 1 #001#### 6500 2 10 #010#### 6000 3 11 #011#### 5500 4 100 #100#### 5000 5 101 #101#### 4500 6 110 #110#### 4000 7 111 #111#### So getting back to the MS43, I decided to focus on finding ARBID 329 for now since that cycle of numbers is kinda noticeable. I believe I found the sub routine for this ARBID. In MS430056, I believe it's sub_D43F4, largely because I see a value C0 being OR'd, and c_tq_stnd (standard torque?) being right shifted 4 bits. On the 330i, c_tq_stnd is set to 400, which when right shifted by 4 = 25 = 0x19; this matches what I found when logging the MS43 CAN bus. If I am correct, it seems like this subroutine is significantly more convoluted than the analogous code on the MSS54. Anyway, that's where I'm at for now. I'm going to keep exploring. And if any of the rest of you have an interest in figuring out the CAN-bus stuff, I hope this information helps you. Edit: Upon farther examination, it looks like that subroutine handles all the CAN messages, rather than a single ARBID per subroutine like on the MSS5x
|
|
| Top |
|
 |
|
hobbit382
|
Post subject: Re: MS43 CAN Bus Posted: Sat Feb 20, 2016 2:23 pm |
|
 |
| Experienced |
Joined: Thu Dec 04, 2014 6:37 pm Posts: 139
|
terraphantm wrote: Hello, I'm new here, but not new to BMWs. Until now I've mostly been interested in the MSS54/HP (E46 M3) DME, but I've recently acquired a 330i which I plan on converting to MS43, so I thought it's about time I start learning a thing or two about this DME. I do find the C167 code to be rather unintuitive to follow, but I'm sure I'll eventually figure it out. For now I'm interested in seeing how the MS43 deals with the CAN-bus. I'm looking at this for a coupe reasons: 1) The E46 CAN-bus is well documented and I have a complete disassembly of the analogous MSS54 code - might make it easier to identify certain variables. 2) I'd like to see if it's possible to broadcast some things that over CAN that the MS43 normally doesn't. For example, the RPM warning field messages found on the E46 M3 and E39 M5
To start off, the DMEs of this generation BMW broadcasts messages on 3 arbitration IDs (ARBIDs). They are: ARBID 0x316 ("DME1") ARBID 0x329 ("DME2") ARBID 0x545 ("DME4") With my own logs and disassembly, and the help of some work done by members on bfc, I was able to figure out the following about those DME messages 0x316 Quote: byte 0 Bit 0 - Some status DBW related, set to 0 if everything is running normally Bit 1 - Unused (in MSS54) Bit 2 - Set to 0 if ASC/DSC error, 1 otherwise Bit 3 - Set to 0 if manual, Set to 1 if SMG (on this DME, others may be different) Bit 4 - Set to bit 0 of md_st_eingriff (torque intervention status) Bit 5 - Set to bit 1 of md_st_eingriff Bit 6 - Set to 1 AC driver error Bit 7 - Set to 1 if MAF error byte 1 - md_ind_ne_ist -- current engine torque after interventions (in %) byte 4 - md_ind_ist -- current engine torque before interventions (in %) byte 5 - md_reib -- torque loss of consumers (alternator, ac, oil pump, etc.) (in %) byte 7 - md_ind_lm_ist -- theoretical engine torque from air mass, excluding igntion angle (in %) 0x329 Quote: Byte 0: On my DME, that byte 0 constantly cycles between 0x11, 0x40, 0x80, and 0xDF. It looks like that 4th value is what can vary from engine to engine. On the MSS54, that 4th value is determined by ORing 0xC0 with a variable BMW calls "md_norm_can" which is taken directly from scalar called "K_MD_NORM" which is set to 0x1F on my DME. The math works out -- 0x1F OR 0xC0 = 0xDF. On a 330i, this 4th value is 0xD9 (so the OR'd value is 0x19). We'll get back to this for the MS43 Byte 1 - Coolant Temp (ºC = 0.75*X - 48) Byte 2 - atmospheric pressure (mbar = 2x + 597) Byte 3 bit 0 - Clutch switch (0 = engaged, 1 = disengage/neutral); bit 2 - Hardcoded to 1 (on MSS54, could be used on other DMEs) bit 4 - Possibly Motor Status (0 = on, 1 = off) bits 5, 6, 7 - Tank Evap duty cycle Byte 4 - Driver desired torque, relative (00 - FE) Byte 5 - Throttle position (00-FE). Byte 6 bit 0 - Brake pedal depressed (0 = off, 1 = on) bit 1 - Brake LIght Switch Error (0 = off, 1 = error) bit 2 kickdown switch depressed (0 = off, 1 = kickdown) Byte 7 - unused 0x545 Quote: Byte 0 Bit 0 - unused Bit 1 - Check Engine light (0 = off, 1 = on) Bit 3 - Cruise Control Light (0 = off, 1 = on) Bit 4 - EML Light (0 = off, 1 = on) Bit 7 - Check Gas Cap light (0 = off, 1 = on) Byte 1 - Fuel Consumption LSB Byte 2 - Fuel Consumption MSB (Values just cycle from 0 to FFFF then start over at zero. Fuel consumiption is the rate of change.) Byte 3 bit 0 - Oil level error if motortype = S62 bit 1 - Oil Level Warning bit 2 - Oil Level Error bit 3 - Overheat Light bit 4, 5, 6 - M3/M5 RPM Warning Field (refer to tables below)
Byte 4 - Oil Temperature (ºC = X - 48) Byte 5 - Charge Light (0 = off, 1 = on; only used on some DMEs) Byte 6 - CSL Oil Level (format unclear) Byte 7 - Possibly MSS54 TPM Trigger RPM Warning Field Table (E46 M3 Cluster) Code: LED Value (dec) Value (bin) Left shift 7500 0 0 #000#### 7000 1 1 #001#### 6500 2 10 #010#### 6000 3 11 #011#### 5500 4 100 #100#### 5000 5 101 #101#### 4500 6 110 #110#### 4000 7 111 #111#### So getting back to the MS43, I decided to focus on finding ARBID 329 for now since that cycle of numbers is kinda noticeable. I believe I found the sub routine for this ARBID. In MS430056, I believe it's sub_D43F4, largely because I see a value C0 being OR'd, and c_tq_stnd (standard torque?) being right shifted 4 bits. On the 330i, c_tq_stnd is set to 400, which when right shifted by 4 = 25 = 0x19; this matches what I found when logging the MS43 CAN bus. If I am correct, it seems like this subroutine is significantly more convoluted than the analogous code on the MSS54. Anyway, that's where I'm at for now. I'm going to keep exploring. And if any of the rest of you have an interest in figuring out the CAN-bus stuff, I hope this information helps you. Edit: Upon farther examination, it looks like that subroutine handles all the CAN messages, rather than a single ARBID per subroutine like on the MSS5x It's nice to have another smart mind on ms43! It would be nice to be able to program ms43 to use the s54 cluster properly.
|
|
| Top |
|
 |
|
terraphantm
|
Post subject: Re: MS43 CAN Bus Posted: Sun Feb 21, 2016 1:51 am |
|
 |
| Newbie |
Joined: Fri Jan 23, 2015 4:15 am Posts: 9
|
hobbit382 wrote: It's nice to have another smart mind on ms43! It would be nice to be able to program ms43 to use the s54 cluster properly.
Well I think I figured out where that particular byte of the CAN reply is dealt with: Attachment: 8GOPW4B.png (byte_EFCA being what's pushed to with the CAN message) Going back to the information in my original post, here's how ARBID 0x545 byte 3 is deciphered: Code: bit 0 - Oil level error if motortype = S62 bit 1 - Oil Level Warning bit 2 - Oil Level Error bit 3 - Overheat Light bit 4, 5, 6 - M3/M5 RPM Warning Field (refer to tables below) Looks like the MS43 (at least MS430056) only uses bit 3. As you can see, it looks like some checks are done against the coolant temperature, and depending on how those checks go, bit 3 can be set or cleared (which corresponds to the overheat light as per previous investigation). Based on NCS Dummy definitions for the instrument cluster, it does look like it's only the MSS54, MS45, and ME9 that deal with the oil level errors via the CAN-bus, so bit 3 being the only one used on the MS43 matches known behavior. So to get the oil warmup LEDs to work, you'd have to manipulate bits 4, 5, and 6 of 0xFDAA/0xEFCA. One can write code to OR 0x20 with it (set bit 5) so that the 6500 RPM and below LEDs will be constantly illuminated (that way at least the M3 cluster will display an appropriate redline, especially if you change the LED colors). Or one can implement some code that checks the oil temperature, and sets the RPM lights to be somewhere between 4000 and 6500 RPM based on what the oil temperature currently is (ideally with a hysteresis of at least 5ºC). Frankly doing either modification is a bit beyond my skill, at least for now.
You do not have the required permissions to view the files attached to this post.
|
|
| Top |
|
 |
|
Cloudforce
|
Post subject: Re: MS43 CAN Bus Posted: Sun Feb 21, 2016 11:48 am |
|
 |
| Experienced |
Joined: Wed Aug 27, 2014 7:57 am Posts: 259
|
word_FD1E.6 is the boolean for lv_teng_state  i think its a bad abbreviation for state_engine_temperature. FDAA.* is used from 0-14  These bits are used for diagnostic handling and error calculation as far as i see.
_________________ MS43 wiki
MS42 wiki
|
|
| Top |
|
 |
|
terraphantm
|
Post subject: Re: MS43 CAN Bus Posted: Sun Feb 21, 2016 1:16 pm |
|
 |
| Newbie |
Joined: Fri Jan 23, 2015 4:15 am Posts: 9
|
|
To me it looks FDAA doesn't store anything permanently, it's just temporarily manipulated before being copied to the target address, like a data register would be used. Notice it is zero'd out before being used in this section of the subroutine. FD1E.6 being the engine temperature status does make sense give how it's used here. 1 = overheat and 0 = no error from what I can tell
|
|
| Top |
|
 |
|
Cloudforce
|
Post subject: Re: MS43 CAN Bus Posted: Sun Feb 21, 2016 6:07 pm |
|
 |
| Experienced |
Joined: Wed Aug 27, 2014 7:57 am Posts: 259
|
|
Well, we could maipulate EFCA directly without messing with FDAA
_________________ MS43 wiki
MS42 wiki
|
|
| Top |
|
 |
|
terraphantm
|
Post subject: Re: MS43 CAN Bus Posted: Sun Feb 21, 2016 7:28 pm |
|
 |
| Newbie |
Joined: Fri Jan 23, 2015 4:15 am Posts: 9
|
Cloudforce wrote: Well, we could maipulate EFCA directly without messing with FDAA Should work. Edit: I just did a quick and dirty test by modifying the code to move "ONES" (rather than rl4) to EFCA, and it worked as I predicted; all the lights turned on (along with the oil error light and coolant overheat light). So that proves EFCA is definitely what gets sent on ARBID 0x545 byte 3.
|
|
| Top |
|
 |
|
Cloudforce
|
Post subject: Re: MS43 CAN Bus Posted: Mon Feb 22, 2016 3:36 am |
|
 |
| Experienced |
Joined: Wed Aug 27, 2014 7:57 am Posts: 259
|
So only code is missing?  Do you know the exact meaning of bit 4-6 in MSS54 and how its interpreted? I think i should be able to write you the code. (edit) checked at MS430066 and its the very same!
_________________ MS43 wiki
MS42 wiki
|
|
| Top |
|
 |
|
terraphantm
|
Post subject: Re: MS43 CAN Bus Posted: Mon Feb 22, 2016 11:20 am |
|
 |
| Newbie |
Joined: Fri Jan 23, 2015 4:15 am Posts: 9
|
For E46 M3 cluster: Attachment: jEC69Sg.png For E39 M5 cluster: Attachment: 5eq3khM.png
You do not have the required permissions to view the files attached to this post.
|
|
| Top |
|
 |
|
jcsbanks
|
Post subject: Re: MS43 CAN Bus Posted: Tue Feb 23, 2016 12:10 pm |
|
|
|
|
EFx7 is the start of the CAN message 8 byte area for CAN mailbox x where x is in the range 1 to F. The 7 bytes before are the control registers for each mailbox.
I want to use a few unused mailboxes to continuously spit out relevant engine logging data at high speed. Would need to check where the are initialised and then just do the appropriate control register writes each time.
Would also like to use them to do memory read and write much faster than DS2.
terra, what kind of frequency are these packets arriving on the bus on MSS54 and MS43?
|
|
| Top |
|
 |
|
jcsbanks
|
Post subject: Re: MS43 CAN Bus Posted: Tue Feb 23, 2016 1:58 pm |
|
|
|
|
Message box - CAN ID 1 - 43F 2 - 613 3 - 615 4 - 153 5 - 1F3 6 - 43D 7 - 1F5 8 - unused 9 - unused A - unused B - unused C - 545 D - 329 E - 316 F - unused
There is a data section at EC430 that is not referenced in my disasm by code but it has a clear CAN bus configuration layout that matches what code and info above is available. It will be copied on setup, the routine Terra mentioned checks some of these. D43B2 D43DE copy.
Will edit with any info I find re transmit or receive.
|
|
| Top |
|
 |
|
terraphantm
|
Post subject: Re: MS43 CAN Bus Posted: Tue Feb 23, 2016 3:46 pm |
|
 |
| Newbie |
Joined: Fri Jan 23, 2015 4:15 am Posts: 9
|
jcsbanks wrote: EFx7 is the start of the CAN message 8 byte area for CAN mailbox x where x is in the range 1 to F. The 7 bytes before are the control registers for each mailbox.
I want to use a few unused mailboxes to continuously spit out relevant engine logging data at high speed. Would need to check where the are initialised and then just do the appropriate control register writes each time.
Would also like to use them to do memory read and write much faster than DS2.
terra, what kind of frequency are these packets arriving on the bus on MSS54 and MS43? IIRC the E46 CAN-bus operates at 500 kbit/s jcsbanks wrote: Message box - CAN ID 1 - 43F 2 - 613 3 - 615 4 - 153 5 - 1F3 6 - 43D 7 - 1F5 8 - unused 9 - unused A - unused B - unused C - 545 D - 329 E - 316 F - unused
There is a data section at EC430 that is not referenced in my disasm by code but it has a clear CAN bus configuration layout that matches what code and info above is available. It will be copied on setup, the routine Terra mentioned checks some of these.
Will edit with any info I find re transmit or receive. 1 - 7 in your list are messages that are sent by other devices (43F and 43D come from the auto/SMG transmission, 613 and 615 from the instrument cluster, 153 I believe is the steering angle sensor, 1F3 and 1F5 from the DSC module). 545, 329, and 316 are the messages sent by the DME.
|
|
| Top |
|
 |
|
jcsbanks
|
Post subject: Re: MS43 CAN Bus Posted: Tue Feb 23, 2016 4:31 pm |
|
|
|
|
Thanks. What I was meaning by frequency, was not the frequency of the bus, but how often these packets are transmitted. Need to get my CAN bus wired to my OBD II and break out my trusty Innovate OT2 and get it to do a dump.
|
|
| Top |
|
 |
|
terraphantm
|
Post subject: Re: MS43 CAN Bus Posted: Tue Feb 23, 2016 6:15 pm |
|
 |
| Newbie |
Joined: Fri Jan 23, 2015 4:15 am Posts: 9
|
jcsbanks wrote: Thanks. What I was meaning by frequency, was not the frequency of the bus, but how often these packets are transmitted. Need to get my CAN bus wired to my OBD II and break out my trusty Innovate OT2 and get it to do a dump. Oh gotcha. I have some wireshark logs of my M3 somewhere on my other laptop. I'll check it out and get back to you. I don't have any logs of an MS43 car (my 330i won't be MS43 until next month probably).
|
|
| Top |
|
 |
|
jcsbanks
|
Post subject: Re: MS43 CAN Bus Posted: Tue Feb 23, 2016 6:31 pm |
|
|
|
|
The transmit and receive match the info above. The only things of note is that two of the receivers are 5 byte (1f3 DSC and 615 cluster). Everything else is 8 byte.
|
|
| Top |
|
 |
Who is online |
Users browsing this forum: No registered users and 0 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|