Skip to content

Reading and writing an MS43 with nfsx ​

nfsx is an open-source BMW flash toolkit. For the MS43 it supports:

  • directmode: raw DS2 over the K-line in the car. Read (no authentication) and write (seed/key, erase, program, verify), full or calibration-only. Protocol: Flashing.
  • bootmode: C167 bootstrap loader on the bench. Full 512 KB read and write, for recovery.
  • checksum and tune: offline tools for a BIN file (checksum verify/fix, VIN, immobiliser fields).
InterfaceK+DCAN (FTDI) cable in K-line mode, configured through EDIABAS-X (~/.config/ediabasx/config.json)
Detectionautomatic: 0x0D hardware-reference key 111430 → MS43. --variant MS43 forces it
Speedreads and writes switch to 38400 baud by default (--write-baud for writes)
File layout512 KB BIN, the layout the XDFs expect: program at file 0x10000, calibration at 0x70000. A calibration read is a tight 64 KB file
Block sizes123 bytes per read, 118 per write

Install and cable setup: nfsx README. In short: pnpm install && pnpm -r build && pnpm link --global --filter @emdzej/nfsx-cli, then configure EDIABAS-X and run nfsx configure.

Command line (directmode) ​

bash
# identify (IDENT + 0x0D dispatch)
nfsx directmode probe

# back up first: full dump (boot + program + calibration) and calibration only
nfsx directmode read -m full        -o ms43_full.bin
nfsx directmode read -m calibration -o ms43_cal.bin

# write the calibration only (64 KB tight file or a full 512 KB BIN)
nfsx directmode write -m calibration -i ms43_tuned.bin --calculate-checksum

# write program + calibration
nfsx directmode write -m full -i ms43_full.bin --calculate-checksum

Options that are common to all directmode commands: --ediabas-config <path>, --interface <name>, --serial-port <path>, --serial-baud <rate>, --gateway <host:port>, --variant MS43, --json.

write also takes:

OptionDefault
-m, --moderequiredfull (program 0x90000–0xEFFEF + calibration 0x70000–0x7FFEE) or calibration
--calculate-checksumoffrecompute the MS43 checksums before sending (otherwise a stale image is flashed as-is)
--write-baud <rate>384009600, 19200, 38400, 62500 or 125000. Drop to 9600 if writes fail with 0xB0
--nonce <n>7seed/key nonce, 1..23
--skip-verifyoffskip the read-back compare

The boot sector is never written in directmode, and the checksum trailers at the end of each region are skipped.

Offline tools ​

bash
# verify the checksums of a BIN (auto-detects MS42/MS43)
nfsx checksum -f ms43_tuned.bin
# recompute and write them (in place, or to -o)
nfsx checksum -f ms43_tuned.bin --rewrite -o ms43_fixed.bin

# read / change BIN fields (no ECU needed)
nfsx tune read  -f ms43_full.bin --feature vin        # also: immo | isn | ecu-number | software-version | uif
nfsx tune apply -f ms43_full.bin --feature vin --value WBA... -o ms43_vin.bin
nfsx tune apply -f ms43_full.bin --feature virginize -o ms43_virgin.bin

tune apply recomputes the checksums unless --skip-checksum is passed. The algorithms are on the Checksums page.

Bench recovery (bootmode) ​

Wiring and BOOT pin: Flashing → C167 bootmode.

bash
nfsx bootmode verify-bundle                      # check the bundled MiniMon blobs
nfsx bootmode probe -d /dev/cu.usbserial-XXXX    # BSL handshake + flash chip ID
nfsx bootmode read  -d /dev/cu.usbserial-XXXX -o ms43_bsl.bin
nfsx bootmode write -d /dev/cu.usbserial-XXXX -i ms43_bsl.bin --calculate-checksum

Options: --baud (default 19200), --bsl-id (default 0xC5), --loader-delay <ms>, --alt (JMG blob instead of MiniMon), --skip-verify (write). The input must be exactly 524 288 bytes.

Browser ​

The nfsx web app runs the same code over Web Serial (Chrome, Edge or Opera, HTTPS). Under Flashing:

  • Directmode: Connect K-line, then pick Auto-detect or MS43 in the ECU selector and use Probe ECU. Read Flash takes Full or Cal mode and a baud (default 38400). Write Flash takes a .bin, Full or Cal mode, a baud and Skip verify. The web write has no checksum option, so fix the file in the Checksum tab first.
  • Checksum: verify or recompute MS42/MS43 CRC-16 and add-32 checksums of a 512 KB BIN.
  • Tune: the offline field editor.
  • Bootmode: the bench path.
  1. directmode probe, then read -m full and keep the file untouched.
  2. Edit a copy in TunerPro or tunex with the XDF.
  3. nfsx checksum --rewrite, or pass --calculate-checksum to the write.
  4. directmode write -m calibration for map changes. Only use -m full when the program changes.
  5. If the ECU doesn't start afterwards, repeat the write with --variant MS43. It should stay in its boot software and still accept DS2 programming, but the IDENT-based auto-detection may not answer there [inferred, nfsx doc §4.5]. As a last resort, use bootmode on the bench.