Skip to content

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:

StatusMeaning
0xA0OK
0xA1Busy (retry)
0xA2Rejected
0xB0Parameter error
0xB1Function error
0xB2Number error
0xFFNACK

Commands ​

RequestPurpose
12 04 00IDENT
12 xx 07 <seg> AA AA AA NN …Program / erase / status: boot mode, after unlock only. See Flashing
12 xx 91 RR RR RR PPBaud-rate change (boot dispatcher): 24-bit rate 9600…125000. See Flashing
12 04 0ACoding checksum (STATUS_CODIER_CHECKSUMME)
12 04 0DSystem addresses (SYSTEM_ADRESSEN_LESEN, see below)
12 08 90 42 4D 57 NNSecurity access (SEED_KEY): 0x90 "BMW" <nonce>, same opcode family as MS42/MS43/GS20
12 09 06 00 AA AA AA NNRead 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 03Live-data snapshot (all STATUS_* values in one response, see below)
12 05 0B A2Over-rev statistics (STATUS_UEBERDREH)
12 07 0C <id> <on/duty> 01Actuator 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 79

System 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:

BytesSGBD resultBMS46 valuePoints at
3–5ADRESSE_UPROG0x00373Aprogramming-voltage word (0: none needed)
48–50ADRESSE_DATEN_REFERENZ0x008010calibration ident
51–53ADRESSE_ZIF_BACKUP0x0144B0ZIF backup slot: the CRC-excluded hole 0x14454–0x144CF
54–56ADRESSE_LOESCHDAUER0x00373Cerase duration (0x23)
57–59ADRESSE_HW_REFERENZ0x003FE6"01119700" in the boot sector
60–62ADRESSE_PRG_REFERENZ0x03FCB0program ident
63–65ADRESSE_AIF0x03FD60application info field (VIN, dates)
66–68ADRESSE_MAX_BLOCK_LAENGE0x00373Dmax block length (0xFF)
69–71ADRESSE_HERST_FERT_DATUM0x03FD20manufacturing data
72–74ADRESSE_EEPROM_SUBSTITUT0x003F20baud-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]:

Rate9600192003840050000100000125000
Table entry002580004B0000960000C3500186A001E848
SCI divisor0x340x1A0x0D0x0A0x050x04

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.

OffsetJobValueUnit
3–4STATUS_MOTORDREHZAHLraw × 0.15625rpm
5–6STATUS_MOTORTEMPERATURraw × 0.75 / 256 − 48°C
7–8STATUS_ANSAUGLUFTTEMPERATURraw × 0.75 / 256 − 48°C
9STATUS_LASTSIGNAL_WRGLraw × 3mg/stroke
10STATUS_UBATTraw × 0.0948V
11STATUS_GESCHWINDIGKEITrawkm/h
12–13STATUS_DKWINKELraw × 5 / 65472V
14–15STATUS_LASTSIGNAL_SPGraw × 5 / 65535V
16–17STATUS_ZUENDWINKEL(raw − 30) × 0.75°CA
17STATUS_LAMBDAREGELFAKTORraw / 128–
18STATUS_TE_TASTVERHAELTNISraw × 100 / 256%
19–20STATUS_EINSPRITZZEIT_P_Uraw × 4 / 1000ms
21–22STATUS_MLraw / 5kg/h
23–24STATUS_LEERLAUFINTEGRATORraw × 51.2 / 65536kg/h
25–26STATUS_LEERLAUFSTELLER_SOLL_LUFTMASSEraw / 80kg/h
27–28STATUS_ADAP_LEERLAUFLUFTraw / 80kg/h
29–30STATUS_ADAP_GEM_MULraw / 32768–
31–32STATUS_ADAP_GEM_ADDraw / 78.4–
33–34STATUS_SOLLDREHZAHL_LLRraw × 10240 / 65536rpm
35STATUS_ADAP_DKPraw × 100 / 256%
36–37STATUS_BSZ (operating hours)raw × 0.1h
38–39STATUS_US (lambda voltage)raw × 1.25 / 65535V
40–41STATUS_UDK_REFraw × 5.5 / 65472V
42–43STATUS_UHFM_REFraw × 5.5 / 65472V
44–45STATUS_TKAraw × 0.75 / 256 − 48°C
46STATUS_EL_TV (e-fan duty)raw × 100 / 256%
47STATUS_KFK_TV (thermostat duty)raw%
48STATUS_W_FPDKraw × 100 / 256%
53–54STATUS_FTEAraw / 32768–
55–56STATUS_LAMBDA_TV (heater duty)raw × 100 / 3120%
57–58STATUS_TAU (ICV duty)raw × 100 / 4092%
60STATUS_UB_KL15raw × 0.0948V
61–62STATUS_LUT1_W … LUT4_W (running roughness)raw / 2561/s²