DS2 protocol
The BMS46 speaks BMW DS2 on the K-line: 9600 baud, 8 data bits, even parity, 1 stop bit, ECU address 0x12.
Framing
[ADDR] [LEN] [CMD …] [XOR]LEN is the total frame length including ADDR and XOR. XOR is the XOR of every preceding byte. The line is half-duplex, so every transmitted byte echoes back. The first byte of a response payload is a status:
| Status | Meaning |
|---|---|
0xA0 | OK |
0xA1 | Busy (retry) |
0xA2 | Rejected |
0xB0 | Parameter error |
0xB1 | Function error |
0xB2 | Number error |
0xFF | NACK |
Commands
| Request | Purpose |
|---|---|
12 04 00 | IDENT |
12 xx 07 <seg> AA AA AA NN … | Program / erase / status: boot mode, after unlock only. See Flashing |
12 xx 91 RR RR RR PP | Baud-rate change (boot dispatcher): 24-bit rate 9600…125000. See Flashing |
12 04 0A | Coding checksum (STATUS_CODIER_CHECKSUMME) |
12 04 0D | System addresses (SYSTEM_ADRESSEN_LESEN, see below) |
12 08 90 42 4D 57 NN | Security access (SEED_KEY): 0x90 "BMW" <nonce>, same opcode family as MS42/MS43/GS20 |
12 09 06 00 AA AA AA NN | Read memory (ROM_LESEN / RAM_LESEN): segment 00, 24-bit address, NN bytes. Used to dump the flash (100-byte chunks are known to work) |
12 05 0B 03 | Live-data snapshot (all STATUS_* values in one response, see below) |
12 05 0B A2 | Over-rev statistics (STATUS_UEBERDREH) |
12 07 0C <id> <on/duty> 01 | Actuator test (STEUERN_*): injectors 0x51–0x54, DISA 0x4E, 0x36 SSP, 0x59 E-fan, 0x21 lambda heater |
Example: read 100 bytes from 0x000000:
12 09 06 00 00 00 00 64 79System addresses (0D)
The standard BMW flash "system address" query. The response is built by boot code at 0x1F56 from constants [verified]. Byte offsets are frame offsets, as the SGBD reads them:
| Bytes | SGBD result | BMS46 value | Points at |
|---|---|---|---|
| 3–5 | ADRESSE_UPROG | 0x00373A | programming-voltage word (0: none needed) |
| 48–50 | ADRESSE_DATEN_REFERENZ | 0x008010 | calibration ident |
| 51–53 | ADRESSE_ZIF_BACKUP | 0x0144B0 | ZIF backup slot: the CRC-excluded hole 0x14454–0x144CF |
| 54–56 | ADRESSE_LOESCHDAUER | 0x00373C | erase duration (0x23) |
| 57–59 | ADRESSE_HW_REFERENZ | 0x003FE6 | "01119700" in the boot sector |
| 60–62 | ADRESSE_PRG_REFERENZ | 0x03FCB0 | program ident |
| 63–65 | ADRESSE_AIF | 0x03FD60 | application info field (VIN, dates) |
| 66–68 | ADRESSE_MAX_BLOCK_LAENGE | 0x00373D | max block length (0xFF) |
| 69–71 | ADRESSE_HERST_FERT_DATUM | 0x03FD20 | manufacturing data |
| 72–74 | ADRESSE_EEPROM_SUBSTITUT | 0x003F20 | baud-rate table (below) |
Baud rates
The boot sector holds a baud table at 0x3F20, which suggests the DS2 baud-switch command (0x91) is supported [inferred, untested on hardware]:
| Rate | 9600 | 19200 | 38400 | 50000 | 100000 | 125000 |
|---|---|---|---|---|---|---|
| Table entry | 002580 | 004B00 | 009600 | 00C350 | 0186A0 | 01E848 |
| SCI divisor | 0x34 | 0x1A | 0x0D | 0x0A | 0x05 | 0x04 |
Divisor 52 at 9600 baud implies a ~16 MHz system clock.
Live-data snapshot (0B 03)
Field offsets in the response (response[0] = status), as reconstructed from the development SGBD bms46d15 in Bartek0x00/BMS46-Wiki. The production SGBD is bms46ds1 (rev 1.9, 106 jobs); the command table above was checked against it by decompiling with ediabasx (ediabasx decompile --source bms46ds1.prg).
WARNING
The SGBD decompile is a community reconstruction with visible copy-paste artefacts (e.g. LUT2…LUT4 reuse LUT1's offset). Cross-check before relying on a field.
| Offset | Job | Value | Unit |
|---|---|---|---|
| 3–4 | STATUS_MOTORDREHZAHL | raw × 0.15625 | rpm |
| 5–6 | STATUS_MOTORTEMPERATUR | raw × 0.75 / 256 − 48 | °C |
| 7–8 | STATUS_ANSAUGLUFTTEMPERATUR | raw × 0.75 / 256 − 48 | °C |
| 9 | STATUS_LASTSIGNAL_WRGL | raw × 3 | mg/stroke |
| 10 | STATUS_UBATT | raw × 0.0948 | V |
| 11 | STATUS_GESCHWINDIGKEIT | raw | km/h |
| 12–13 | STATUS_DKWINKEL | raw × 5 / 65472 | V |
| 14–15 | STATUS_LASTSIGNAL_SPG | raw × 5 / 65535 | V |
| 16–17 | STATUS_ZUENDWINKEL | (raw − 30) × 0.75 | °CA |
| 17 | STATUS_LAMBDAREGELFAKTOR | raw / 128 | – |
| 18 | STATUS_TE_TASTVERHAELTNIS | raw × 100 / 256 | % |
| 19–20 | STATUS_EINSPRITZZEIT_P_U | raw × 4 / 1000 | ms |
| 21–22 | STATUS_ML | raw / 5 | kg/h |
| 23–24 | STATUS_LEERLAUFINTEGRATOR | raw × 51.2 / 65536 | kg/h |
| 25–26 | STATUS_LEERLAUFSTELLER_SOLL_LUFTMASSE | raw / 80 | kg/h |
| 27–28 | STATUS_ADAP_LEERLAUFLUFT | raw / 80 | kg/h |
| 29–30 | STATUS_ADAP_GEM_MUL | raw / 32768 | – |
| 31–32 | STATUS_ADAP_GEM_ADD | raw / 78.4 | – |
| 33–34 | STATUS_SOLLDREHZAHL_LLR | raw × 10240 / 65536 | rpm |
| 35 | STATUS_ADAP_DKP | raw × 100 / 256 | % |
| 36–37 | STATUS_BSZ (operating hours) | raw × 0.1 | h |
| 38–39 | STATUS_US (lambda voltage) | raw × 1.25 / 65535 | V |
| 40–41 | STATUS_UDK_REF | raw × 5.5 / 65472 | V |
| 42–43 | STATUS_UHFM_REF | raw × 5.5 / 65472 | V |
| 44–45 | STATUS_TKA | raw × 0.75 / 256 − 48 | °C |
| 46 | STATUS_EL_TV (e-fan duty) | raw × 100 / 256 | % |
| 47 | STATUS_KFK_TV (thermostat duty) | raw | % |
| 48 | STATUS_W_FPDK | raw × 100 / 256 | % |
| 53–54 | STATUS_FTEA | raw / 32768 | – |
| 55–56 | STATUS_LAMBDA_TV (heater duty) | raw × 100 / 3120 | % |
| 57–58 | STATUS_TAU (ICV duty) | raw × 100 / 4092 | % |
| 60 | STATUS_UB_KL15 | raw × 0.0948 | V |
| 61–62 | STATUS_LUT1_W … LUT4_W (running roughness) | raw / 256 | 1/s² |