Bosch dishwasher board SWS4118: the board, its memory, and copies of the EEPROM and firmware (part 1)
Contents 11
We take apart the motor control board from a Bosch dishwasher, 702168823.01GA / SWS4118 Rev.4. The goal is to run the dishwasher pump from its own original board and turn it into an instantaneous water heater. This is part one:
- what useful parts are left from the dishwasher and what is on the board, with a photo of each area;
- what this board is in the dishwasher and who it talks to;
- which of it is needed to run the pump, and why we are writing our own firmware;
- a copy of the 24C08WP EEPROM with a CH341B programmer: where to put the probes, which software to read with, what is in the dump;
- a copy of the STM32 firmware with an ST-Link V2: the SWD pins on the X20 pads, the software, checking the protection, reading, what you may and may not do;
- what the original firmware consists of: the bootloader, the main program, the self-test.
What the firmware switches on in the chip and the board map are in part two; our own firmware is in part three.
draft — under discussion and being expanded
⚠ This board runs straight off 230 V mains with no isolation: the large capacitor charges to ~325 V and holds that charge after the plug is pulled, and the board's ground is tied to the mains. Both copies in this part are made off the mains, with the board powered only by 3.3 V from the programmer or a separate supply. Why the board must never be plugged in with a programmer connected is explained in part three.
Why we are doing this
The old dishwasher left us its circulation pump with a built-in heating element, which is in effect a ready-made instantaneous water heater: the pump moves the water and the element wrapped around the pump chamber heats it. The pump motor is three-phase with a permanent-magnet rotor and will not run straight from a socket: it needs an inverter. The dishwasher's own board already has one. So first we find out what is on the board and copy everything it stores, and only then change anything.
What useful parts are left
| Part | What it is | Will we use it? |
|---|---|---|
| circulation pump with heating element | three-phase motor with a permanent-magnet rotor (9-coil stator) and an element around the chamber | yes: the core of the water heater, pump and heating in one |
| heating element (in the pump housing) | 20.5 Ω cold → ≈ 11 A and ≈ 2.6 kW at 230 V | yes; switch it on only while the pump moves water, or it will overheat |
| temperature sensor on the element (3 wires) | two 10 kΩ NTC thermistors with a common middle wire | yes: temperature control and independent overheat protection |
| CoPECi BLP3 drain pump | also three-phase with a permanent-magnet rotor, 54 V / 55 Hz | possibly, for pumping water elsewhere; runs from the same inverter |
| motor control board (this article) | STM32 microcontroller, FSB50550AB inverter, power supply, 16 A relays | yes: a ready inverter for the pump and relays for the element |
| control panel board with an MC9S08AC32 | 8-bit NXP microcontroller, buttons and display | unlikely |
The board at a glance
702168823.01GA, SWS4118 Rev.4. The numbers are the areas in the table below. The sticker with the board's code and number is blurred.| No. | What | Section |
|---|---|---|
| 1 | STM32 microcontroller | The brain |
| 2 | X20 test pads at the edge | The brain |
| 3 | FSB50550AB inverter | Inverter |
| 4 | ~325 V bus capacitor | Power supply |
| 5 | TNY274GN power supply with transformer | Power supply |
| 6 | JW2SN relay (switches between motors) | Relays |
| 7 | two 16 A ALZ51B12T relays | Relays |
| 8 | mains filter | Mains input |
| 9 | fuse | Mains input |
| 10 | mains connector | Mains input |
| 11 | connectors to the motors, valves and sensors | Connectors |
Markings on the board itself: 702168823.01GA is the printed circuit board number, SWS4118 Rev.4 the board designation and revision, and 888172 looks like a batch number. Most chips carry the date code 1339, which looks like week 39 of 2013.
The brain: STM32, EEPROM and programming pads
| In the photo | What | Marking | What it does on the board |
|---|---|---|---|
| A | microcontroller | STM32F301 VCT6, LQFP100 | drives the inverter (six PWM signals) and the relays, reads the sensors; the firmware lives here |
| B | EEPROM | 24C08WP (ST) | 8 kbit (1 KB) I²C memory: settings and "learned" values (below) |
| C | SEN013DG | Power Integrations | SENZero: disconnects the mains-voltage sensing resistors while the board is on standby |
| D | X20 pads | six pads at the edge | a debug connector: SWD, reset, ground and 3.3 V (pinout) |
| E | rectangular pads (2 × 3) | no marking | another group of test pads |
- The marking on the package does not match the chip inside; what is really there was shown by reading over SWD (below).
- The orange paint stroke on the package looks like a factory mark.
- The clock comes from an 8 MHz
80.Kceramic resonator next to the microcontroller (pins 12 and 13); the original firmware, like ours, multiplies it up to 72 MHz.
The FSB50550AB inverter
| In the photo | What | Marking | What it does on the board |
|---|---|---|---|
| A | inverter | FSB50550AB | three phases for the pump motor from the ~300 V DC bus |
| B | resistors | R820 (0.82 Ω) | current shunts: two in parallel in each phase (we measured 0.41 Ω); the microcontroller measures current here |
| C | relay | Panasonic JW2SN-B-DC12V | switches the inverter's outputs between the circulation pump with the heating element (off) and the drain pump (on) |
| D | components in SOT-223 packages | — | look like small triacs for the valves and dispenser; the water heater does not need them, so we did not trace them |
| E | connectors | X2, X3, X4 | to the valves, sensors and motors |
The FSB50550AB (Fairchild, now onsemi) is a three-phase inverter in one package: six MOSFET switches, their gate drivers and the diodes that supply the high-side switches. It turns the DC bus into three phases for the pump motor. The manufacturer's datasheet: FSB50550AB-D.pdf · 1.5 MB
| Parameter | Value (from the datasheet) |
|---|---|
| bus voltage, operating | 300 V typical, up to 400 V |
| bus voltage, absolute maximum | 500 V |
| continuous switch current | 2 A at 25 °C case, 1.5 A at 80 °C |
| on-resistance | ≈ 1 Ω |
| driver supply | 15 V |
| input logic | 3.3 or 5 V |
- The bus is rectified 230 V mains (√2 × 230 ≈ 325 V); on our board, running from the mains, we measured 296–300 V. So the board powers the motors straight from the mains, with no transformer.
- The signals from shunts B go to the microcontroller's comparators, which shut the inverter down on overload. How we worked out the trip level in amps is in part three.
- The driver supply on this board is 13.5 V rather than 15 V, and it is not on all the time: the microcontroller switches it on with pulses on pin 92 (PB6). Without them the module will not turn on a single switch; the details are in part three.
- One inverter for two motors. The two pumps share one phase, and the JW2SN relay (C) switches the other two between them. With the relay off the circulation pump with the heating element is connected, with it on the drain pump. The continuity check showed that the relay switches the phases; the original firmware confirms that "off" means the circulation pump: it releases the relay when it starts that pump. A dishwasher either washes or drains; the two never run together.
- Next to the module there is an empty footprint for a second one just like it; the board seems to be made for several models (part two).
Board power supply: TNY274GN
| In the photo | What | Marking | What it does on the board |
|---|---|---|---|
| A | power supply chip | TNY274GN | Power Integrations TinySwitch-III, the heart of a small switch-mode supply |
| B | transformer | TDK 8220 X 363 | steps the voltage down for the board itself |
| C | large capacitor HB 105°C | — | the ~325 V bus capacitor for the inverter; holds a charge after switch-off |
| D | small capacitor | — | looks like the filter for one of the low voltages |
What we measured with the board running from the mains:
| Rail | Value | What it feeds |
|---|---|---|
| power bus | 296–300 V | the inverter |
| low-voltage rail | 13.46 V | the inverter driver supply is switched on from here (13.48 V at the module) |
| 3.3 V | 3.35 V | the microcontroller, the EEPROM; X20 pad 6 |
All three relay coils are rated for 12 V.
⚠ The power supply keeps running from the mains only while the microcontroller holds pin 7 (PC13) at "1". Through a diode, a 47 kΩ resistor and a transistor next to the supply, this pin keeps it switched on; without it the board shuts down about a second after it is plugged in. The original firmware keeps PC13 at "1" the whole time, and replacement firmware must set it as its very first action after start-up; how we found this is in part three.
Mains input: filter, fuse, capacitor discharge
| In the photo | What | Marking | What it is for |
|---|---|---|---|
| A | common-mode choke | copper winding on a core | keeps the inverter's interference out of the mains |
| B | X2 capacitor | 0.22 µF M 305 V~ (blue) | between live and neutral: suppresses interference from the inverter |
| C | Y2 capacitors | 22 nF M 300 V~ (blue) | between the mains and earth: the same for common-mode interference |
| D | CAP005DG | Power Integrations, CAPZero | discharges the X2 capacitors when the plug is pulled, so no voltage is left on the plug pins |
| E | fuse | BUSS SR-5H T4A 250V | time-delay, 4 A: protects the board itself |
| F | mains connector | — | live and neutral come in here |
A 4 A fuse would not survive an 11 A heating element, so the element most likely bypasses it; we have not traced the path from the element relays to the fuse.
| In the photo | What | Marking | What it is for |
|---|---|---|---|
| A | thermistor | NTC 22 1340 | appears to limit the inrush current as the bus capacitor charges at switch-on |
| B | common-mode choke | — | the same as A in the previous photo |
| C | relay | Panasonic ALZ51B12T | one of the two 16 A relays (section below) |
Relays
| In the photo | What | Marking / rating | What it switches or does |
|---|---|---|---|
| A, B | two relays | Panasonic ALZ51B12T, 16 A 250 V, 12 V | the heating element (≈ 11 A); driven by pins 91 (PB5) and 68 (PA9), as we traced |
| C | mains connector | — | the same as F in the mains input photo |
| D | connector | MTOP, PIN 1 | most likely to the heating element and pump; not traced yet |
| E | fuse | BUSS SR-5H T4A 250V | protects the board |
| F | CAP005DG | Power Integrations | discharges the X2 capacitors |
The third relay, a Panasonic JW2SN-B-DC12V (5 A 250 V, 12 V coil), sits next to the inverter (C in the inverter photo) and switches the phases between the pumps; it is driven by pin 60 (PD13).
For the water heater the element relays are already in place and rated with headroom: 16 A versus 11 A. The original firmware switches them on one after the other, pulls them in at full current and then holds them at 70 % PWM duty; how and why is in part three.
Connectors
The board marks its connectors X2, X3, X4, X5, X5_1, X7_1, X12, X13, X17, X20 and MTOP (with PIN 1). The water heater needs only a few of them, and those we have traced:
| Connector | What goes to it |
|---|---|
| X5_1 | the pump phases from the inverter, through the JW2SN relay |
| X13 | the element temperature sensor: pins 3, 4, 5 (all three wires grey); 4, the middle one, is ground |
| X20 | debug pads: SWD, reset, ground, 3.3 V (pinout) |
| mains connector | live and neutral (C in the relay photo) |
What we do not know yet:
- which connector and pins the heating element uses (most likely
MTOPnext to the relays); - which pin of the mains connector is live and which is neutral;
- where the link to the control panel (the D-Bus) goes;
- what is on
X2,X3,X4,X7_1,X12andX17: probably the valves, level sensors and dispenser; the water heater does not need them, so they stay disconnected.
What this board is in the dishwasher
The hn/bsh-home-appliances project describes Bosch dishwasher power modules of the EPG700xx series: the same microcontroller in a 100-pin package, on some boards the same FSB50550AB inverter, an X20 debug connector. Our board looks like one of that family.
According to that description, this is the washing control unit (address 1 on the bus): it runs the wash program and drives the heating element, pumps and valves. The button panel is a separate node (address 2) that only sends it commands: which program is selected, which options. They talk over the internal D-Bus, described in part two.
What is needed to run the pump
| Board area | What it does | Needed for the pump? |
|---|---|---|
| mains input and filter | protection and less interference | yes |
| bus capacitor | ~300 V for the inverter | yes |
| TNY274GN power supply | 13.5 V and 3.3 V for the relays, drivers and STM32 | yes; held on by pin PC13 |
| FSB50550AB inverter | three phases for the motor | yes |
| microcontroller and firmware | drives the inverter, works out the rotor position from the currents | yes: the inverter does nothing without it |
| ALZ51B12T relays | the heating element | yes, for the water heater |
| JW2SN relay | selects the pump | stays off: then our pump is the one that runs |
Why our own firmware. The original firmware is the whole washing control unit: the "run the pump" command is generated inside it while it runs a wash program, and the program waits for level sensors, valves and the door lock; without the rest of the dishwasher it stops with an error. Patching a few bytes of it will not work either, because the firmware checks its own flash (below). So we write our own firmware for the same STM32: the hardware is now known down to the pin, and we take the motor parameters, sensor tables and heating rules from the original. The factory copy sits alongside, so the board can be returned to its factory state at any time. How it is done is in part three. But first, copies of everything the board stores.
A copy of the 24C08WP EEPROM
The easiest and safest first step: read the small settings memory without desoldering or writing anything. The 24C08WP holds 8 kbit, i.e. 1024 bytes, and talks over the I²C bus. Inside are four 256-byte blocks; on the bus they respond at addresses 0x50…0x53, but the reading software takes care of that.
This is where the board keeps its settings. Among them is the "no water" threshold, which the machine learns by itself: it remembers how much current the pump draws when it is moving water and then compares the current against it during a wash. So the EEPROM of a particular machine differs from the factory one, and erasing it means losing these values.
How many probes and where
| Pin | Name | Connect to the programmer | Why |
|---|---|---|---|
| 8 | VCC | yes, 3.3 V | chip supply |
| 4 | GND | yes, GND | common ground |
| 5 | SDA | yes, SDA | data |
| 6 | SCL | yes, SCL | clock |
| 7 | WP | no | write protect; does not affect reading |
| 1, 2, 3 | A0, A1, A2 | no | address select; on a 24C08 only A2 is used, and the board already ties it as needed |
Four probes. The most convenient is a SOIC-8 clip: it clamps onto the chip and touches all eight pins at once, and its adapter plugs into the programmer's "24xx" socket, red wire (pin 1) to the "1" mark on the socket. Without a clip, use four thin wires soldered to pins 8, 4, 5 and 6 (or to nearby pads connected to them).
A fifth wire only if needed. The programmer powers pin 8, which is also the whole board's 3.3 V rail, so the STM32 microcontroller wakes up too and may access the EEPROM itself while you read. If two reads in a row give different files, hold the microcontroller in reset by tying its NRST to GND. NRST is brought out to pad 3 of the X20 connector (through 220 Ω, pinout).
Check the orientation with a multimeter before connecting anything:
- pins 8 and 4 must not be shorted;
- pin 5 to pin 8 and pin 6 to pin 8 should each read ≈ 4.7 kΩ: these are the "472" resistors next to the chip that pull SDA and SCL up to the supply. If that matches, pin 1 is identified correctly.
Wiring diagram
⚠ Keep the board off the mains the whole time. It has no mains isolation, and the USB programmer ties its ground to the computer. Plugging such a board into a socket with the programmer connected puts mains voltage on the computer.
⚠ Set the programmer to 3.3 V. Most CH341B boards have a 3.3 / 5 V switch: set 3.3 V and measure the voltage on the socket's VCC pin before connecting. Old black CH341A boards without a switch put 5 V on the data lines, which is a risk for a board with a 3.3 V microcontroller.
Can the programmer power the board? The 3.3 V regulator on a programmer is usually small, and it feeds the board's whole 3.3 V rail including the STM32. If the voltage on pin 8 drops below ≈ 3 V once connected, power the 3.3 V rail from a separate supply (sharing GND with the programmer) and leave the programmer's VCC unconnected.
Which software to read with
| System | Software | What to choose |
|---|---|---|
| Windows | CH341A Programmer (the software sellers ship with the programmer) | type "24 EEPROM", chip 24C08, "Read", then "Save" |
| Windows | AsProgrammer (open source) | I²C, 24C08, "Read", save the file |
| Linux | IMSProg (graphical) or ch341eeprom (command line) | 24C08 |
On Windows, first install the CH341PAR driver from WCH, the chip's maker (download page); how we did it is described below. On Linux, from the command line:
ch341eeprom -v -s 24c08 -r eeprom_1.bin
ch341eeprom -v -s 24c08 -r eeprom_2.bin
cmp eeprom_1.bin eeprom_2.bin && echo "copies match"
Command-line options may differ between builds of ch341eeprom; check them with ch341eeprom -h.
On Windows, fc /b eeprom_1.bin eeprom_2.bin compares the two copies and should report no differences. The file must be exactly 1024 bytes.
- Read only. Do not press "Erase", "Write" or "Auto": an erased EEPROM means erased board settings.
- Two identical copies mean the read is reliable. If they differ, check the clip contact and add the fifth wire (NRST to GND).
flashromwill not help here: with a CH341 it works only over SPI, and the 24C08 is I²C.
How we read it
We read it on Windows with our own short Python script through the WCH driver library (CH341DLLA64.DLL, installed with the driver). The script only reads (it contains no write functions at all): it reads the chip twice at a slow 20 kHz bus speed and compares the copies.
- The driver: CH341PAR on the WCH website, the file
CH341PAR.EXE. Check its digital signature before running it (file properties → "Digital Signatures": Nanjing Qinheng Microelectronics). Silent install, as administrator:CH341PAR.EXE /S. - After installation, Device Manager should list the programmer as "USB-EPP/I2C… CH341A" with no warning icon. If it shows as "USB-SERIAL", the jumper on the programmer is in UART mode; move it.
- The script: read_eeprom_ch341.py · 4.2 KB, which needs 64-bit Python 3. Run it with:
python -I read_eeprom_ch341.py
It saves two copies into a dumps folder next to the script (you can pass another folder as an argument: python -I read_eeprom_ch341.py D:\my_dumps) and reports whether they match.
What is in the dump
We read 1024 bytes, and the two copies read back to back match. The file: eeprom_24c08_sws4118.bin · 1.0 KB. It holds no board numbers: none from the sticker, no batch number, no PCB number; we searched for them in decimal, BCD and binary form.
| Block (addresses) | FF / 00 bytes | What is inside |
|---|---|---|
| 0 (0x000–0x0FF) | 15 / 210 | a table of 15 records with the same layout (below) |
| 1 (0x100–0x1FF) | 15 / 113 | the most data: settings and calibration |
| 2 (0x200–0x2FF) | 133 / 91 | probably more settings, a smaller area |
| 3 (0x300–0x3FF) | 256 / 0 | empty, all 0xFF |
Block 0: a table of 16-byte records. Each record is FF, a code byte, 13 zeros, and a final byte equal to the sum of bytes 1–14, which looks like a checksum (while the other bytes are zero it equals the code). The codes rise from record to record: 1B, 1F, 2E, 30, 53, 54, 55, 56, 57, 58, 5A, 61, 62, 63, 64. Address 0x0F0 holds a single number, 08. What the table is (an error log, a list of enabled features or something else) we have not yet looked up in the firmware.
Block 1: settings. What stands out:
- the value
1A 23appears three times (0x126, 0x140, 0x181), possibly a data version ID; - at 0x1B8–0x1DF there are 40 bytes, almost all
64(= 100), including two58(= 88) and one00: looks like a table of percentages or coefficients; - at 0x1EE–0x1EF,
41 8Fright after a run ofFF: looks like a checksum for the block. It is not a plain sum of the block's bytes; the algorithm is not known yet.
Block 2. At 0x214–0x215, again right after a run of FF, there is BF 41 (which also looks like a checksum), then repeating pairs 0E 74 0E 74 and 2B 0E 2B 0E, and a few dozen more bytes of values; the last one is at 0x268. From 0x269 to 0x290 there are zeros, and from 0x291 to the end of the block only FF.
There is no text, no model name or version: the contents are entirely binary.
A factory image in the firmware. The microcontroller's flash holds a factory image of this EEPROM, and the firmware copies it into the EEPROM if the EEPROM is blank. Block 1 of our EEPROM matches it in 198 of 256 bytes; the other 58 are changed settings and learned values, the "no water" threshold among them.
What this means for us:
- the memory holds the settings of this particular machine; we have a copy, and it is worth keeping even if the board goes back to the original firmware;
- we have not looked for run-time counters (hours or cycles): they can only be found by comparing copies taken before and after the board runs on the original firmware.
The STM32 microcontroller: a copy of the firmware
The aim of this step is to find out exactly which chip this is, whether the firmware is protected against reading, and if not, to save a copy. Nothing is written or erased. The CH341B programmer will not help here: an STM32 is read over SWD, which the CH341 does not have. We read it with an ST-Link V2 (a cheap clone); how to do the same with a Raspberry Pi 3B+ is in the collapsible block below.
Where to find the pins
| Pin | Signal | What for | Needed for reading |
|---|---|---|---|
| 72 | PA13, SWDIO | debugger data | yes |
| 76 | PA14, SWCLK | debugger clock | yes |
| 14 | NRST | reset | advisable: helps if the link will not come up |
| 99, 74 | VSS | GND | yes (any GND point on the board) |
| 100, 75 | VDD | 3.3 V | board power |
| 94 | BOOT0 | boot mode select | no, leave it alone |
| 68, 69 | PA9, PA10 | USART1: ST's built-in bootloader | no (a fallback route: needs BOOT0 = 1, and read protection applies here too); on this board PA9 drives a heating element relay |
- The pin numbers are ST's standard 100-pin layout (as on the STM32F303VC). Before connecting anything, check the orientation with a multimeter: pins 99 and 74 should ring through to GND (for example, to EEPROM pin 4), and 100 and 75 to the 3.3 V rail (EEPROM pin 8). If they match, the numbers are right.
- Do not solder to the pins: at 0.5 mm pitch it is easy to bridge neighbours.
What the X20 pads carry (D in the microcontroller photo; counted left to right as in the photo, along the bottom edge of the board), traced with a continuity tester:
| X20 pad | Goes to | What it is |
|---|---|---|
| 1 | pin 76 | SWCLK (PA14) |
| 2 | pin 72 | SWDIO (PA13) |
| 3 | pin 14 | NRST (reset), not direct but through a 220 Ω resistor (marked 221) |
| 4 | pin 90 | PB4 (NJTRST in JTAG); the firmware keeps it as an input, and on the live board it reads logic 1 |
| 5 | GND | common ground |
| 6 | 3.3 V | the 3.3 V supply rail |
So X20 is a debug connector: SWD and reset are already on it, and the X20 pads are a convenient place for probes or soldered wires.
221 (220 Ω) → pin 14, NRST, on the bottom side of the package. Green: pad 4 → pin 90 on the left side of the package.- The 220 Ω resistor in the reset line does no harm: the ST-Link pulls NRST to ground, and 220 Ω only limits the current, most likely in case the pad is shorted to the supply by accident.
- Pad 4 (PB4) is not needed for reading. The firmware sets it up as an input without an internal pull resistor, and on the live board it reads 1, so there is probably an external pull-up. It may be a factory service-mode input; what it does has not yet been found in the firmware. Do not short it to ground on a working board until we know what it is.
Compared with a public write-up. The hn/bsh-home-appliances project describes Bosch dishwasher power modules with the same STM32F301VCT6 marking and gives this X20 order: SWCLK, SWDIO, BOOT0, RESET, GND, 3.3 V. The first two and the last two pads match what we traced. Pads 3 and 4 are different on our board: 3 is NRST (pin 14), 4 is PB4 (pin 90), and BOOT0 is not brought out to X20. So either hn's boards are a different revision or that description has the order mixed up: trust the continuity check on your own board.
Connecting an ST-Link V2
| ST-Link V2 | X20 pad | On the board |
|---|---|---|
| SWCLK | 1 | pin 76 (PA14) |
| SWDIO | 2 | pin 72 (PA13) |
| GND | 5 | GND |
| 3.3 V | 6 | 3.3 V rail |
| RST | 3 | NRST, pin 14 (through 220 Ω), if needed |
- Power. On cheap ST-Link clones the 3.3 V pin is an output: it powers the board, so no separate supply is needed, and none should be connected: two sources on one rail fight each other. On a genuine ST-Link this pin only senses the voltage: then a separate 3.3 V supply powers the board, and pad 6 is wired to the ST-Link's 3.3 V pin for sensing. Once connected, measure the voltage on pad 6: it should be ≈ 3.3 V. If a clone gives less than about 3 V, its regulator cannot carry the board: disconnect its 3.3 V pin and power the board from a separate supply (shared GND).
- Keep the board off the mains the whole time (see Safety).
- Keep the wires short (15–20 cm at most).
- If the clone only connects now and then, wire up RST as well: make the first connection after plugging into USB with a reset (
mode=URinstead ofmode=HOTPLUGin the commands below), and carry on as usual after that. This helped us later, when we were flashing our own firmware; the first read needed no reset. - Software: ST's STM32CubeProgrammer (Windows, Linux, macOS) or OpenOCD. On Windows, the ST-Link driver is installed together with STM32CubeProgrammer.
How to connect a Raspberry Pi 3B+ instead of an ST-Link
| Raspberry Pi 3B+ pin | Pi signal | On the board |
|---|---|---|
| 22 | GPIO25 | SWCLK, X20 pad 1, pin 76 |
| 18 | GPIO24 | SWDIO, X20 pad 2, pin 72 |
| 20 | GND | GND, X20 pad 5 |
| 12 | GPIO18 | NRST, X20 pad 3, pin 14 |
Power the board with 3.3 V from a separate supply (X20 pad 6), with GND shared with the Pi: better not to load the Pi's own 3.3 V pin with the board. The software is OpenOCD:
sudo apt install openocd telnet
sudo openocd -f interface/raspberrypi2-native.cfg -c "transport select swd" -f target/stm32f3x.cfg -c "adapter speed 100"
If OpenOCD reports that raspberrypi2-native.cfg does not exist, your version has merged it into interface/raspberrypi-native.cfg. After that, use the same commands in telnet localhost 4444 as for the ST-Link below.
Software and drivers
| What | Where to get it | What for |
|---|---|---|
| STM32CubeProgrammer | st.com: STM32CubeProg, free; downloading needs an ST account | reading the flash and option bytes; it has both a window and a command-line STM32_Programmer_CLI |
| ST-Link driver for Windows | installed together with STM32CubeProgrammer; separately as STSW-LINK009 | so that Windows can see the ST-Link |
| OpenOCD | Linux: sudo apt install openocd; Windows: xPack OpenOCD builds | a free alternative; works with both an ST-Link and a Raspberry Pi |
| Ghidra | ghidra-sre.org | analysing the firmware copy on a computer |
On Windows the command-line program ends up here after installation:
C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin\STM32_Programmer_CLI.exe
Below we simply write STM32_Programmer_CLI: either add the bin folder to PATH or run the commands from it.
The steps in short:
- The board stays off the mains. Wire the ST-Link to X20 as in the diagram above, then plug it into USB.
- Check that the computer sees the ST-Link:
STM32_Programmer_CLI -l st. It lists the ST-Link, its firmware version and its serial number (if you publish the output, it is best to remove the number). - Check the protection:
STM32_Programmer_CLI -c port=SWD mode=HOTPLUG freq=100 -ob displ. AnRDPline reading0xAA (Level 0, no protection)means there is no protection and the firmware can be read. The other values are explained in the next section. - Read the firmware twice and compare the copies: see If there is no protection: a copy.
Can the firmware be saved?
An STM32 has read protection, the RDP level (0, 1 or 2), and whether the firmware can be read depends on it.
STM32CubeProgrammer (the easiest way). Choose ST-LINK, connection mode "Normal" (or "Hot plug", to connect without resetting the microcontroller), and press Connect. The software shows the chip name and flash size, and the OB (Option bytes) tab shows RDP: AA is level 0, CC is level 2, BB or anything else is level 1. Do not change anything on the OB tab and do not press Apply. If the software offers to update the ST-Link's own firmware, decline: clones sometimes stop working after such an update.
OpenOCD (Windows, Linux):
openocd -f interface/stlink.cfg -f target/stm32f3x.cfg -c "adapter speed 100"
Once OpenOCD has found the microcontroller, in a second window:
telnet localhost 4444
and there, one at a time (each command only reads):
mdw 0xE0042000
mdh 0x1FFFF7CC
mdw 0x4002201C
mdb 0x1FFFF800 16
| Command | What it shows | How to read it |
|---|---|---|
mdw 0xE0042000 | the device ID | the last three hex digits: 422 is the F302/F303 family with 128–256 KB; 439 is F301/F302 with 32–64 KB; 446 is F302/F303 with 384–512 KB |
mdh 0x1FFFF7CC | flash size in KB | 0x0100 = 256 KB, 0x0040 = 64 KB |
mdw 0x4002201C | the FLASH_OBR register | bits 2–1: 00 is level 0, 01 is level 1 (a last hex digit of 0 or 1 means level 0; 2 or 3 means level 1) |
mdb 0x1FFFF800 16 | option bytes, the chip settings | a first byte of aa means level 0 |
| Result | Level | What it means | What we do |
|---|---|---|---|
bits 2–1 = 00, first option byte aa | 0 | no protection | save the whole flash (below) |
bits 2–1 = 01, first byte something else (not aa) | 1 | the flash cannot be read over SWD | the firmware cannot be copied. Protection can only be removed together with erasing all the firmware, and we do not do that |
| the software cannot see the microcontroller although the wiring has been checked | possibly 2 | debugging is disabled for good | the firmware can be neither read nor replaced; first check the wires, power and NRST again |
If there is no protection: a copy
In STM32CubeProgrammer: the "Memory & File editing" tab (the pencil icon), address 0x08000000, size 0x40000 (256 KB; if the software showed a different flash size after Connect, use that), Read, then Save As… to a file. Do it twice and compare the files.
From the STM32CubeProgrammer command line (this is how we read it; every command only reads):
STM32_Programmer_CLI -c port=SWD mode=HOTPLUG freq=100 -ob displ
STM32_Programmer_CLI -c port=SWD mode=HOTPLUG freq=100 -u 0x08000000 0x40000 flash_1.bin
STM32_Programmer_CLI -c port=SWD mode=HOTPLUG freq=100 -u 0x08000000 0x40000 flash_2.bin
STM32_Programmer_CLI -c port=SWD mode=HOTPLUG freq=100 -u 0x1FFFF800 0x10 optbytes.bin
mode=HOTPLUGconnects without resetting the microcontroller: its program keeps running.freq=100means 100 kHz: slow (one 256 KB copy takes ≈ 33 s), but reliable even with probe wires.-u(upload) means reading from the microcontroller into a file, confusing as the name is. Writing to the microcontroller is done by-dand-w, erasing by-e; we do not use those here.- To compare the copies: on Windows
fc /b flash_1.bin flash_2.bin("FC: no differences encountered" means identical), on Linuxcmp flash_1.bin flash_2.bin(no output means identical). Or compare checksums:certutil -hashfile flash_1.bin SHA256on Windows,sha256sum flash_*.binon Linux.
In OpenOCD, in the same telnet window:
halt
dump_image flash_1.bin 0x08000000 0x40000
dump_image flash_2.bin 0x08000000 0x40000
dump_image optbytes.bin 0x1FFFF800 16
resume
0x40000is 256 KB. Ifmdh 0x1FFFF7CCshowed a different size, use that instead: the size in KB × 1024, in hex.haltonly stops the program running andresumecontinues it; nothing is written.- The files appear in the folder OpenOCD was started from. The two copies must be identical (
cmp flash_1.bin flash_2.bin) and must not be allFFor all00.
What else to save
| What | Where | Why | In the article |
|---|---|---|---|
| the firmware (flash) | 0x08000000, 256 KB | the master copy, so we can always go back | no: it is the manufacturer's program |
| option bytes | 0x1FFFF800, 16 bytes | the protection level and chip settings | yes, the values and what they mean |
| device ID, flash size | 0xE0042000, 0x1FFFF7CC | the exact model | yes |
| the chip's unique ID | 0x1FFFF7AC, 12 bytes | identifies this particular chip | no, it is private |
| the 24C08WP EEPROM | above | settings and learned values | yes: it holds no board numbers |
| ST's built-in bootloader | system memory | the same on every such chip, no need to save it | — |
What you can do without breaking anything
| Allowed (read only) | Why |
|---|---|
| read the device ID, flash size and option bytes | to know what the chip is and how it is configured |
| read the flash and RAM | a copy of the firmware; the state of variables while running |
| read peripheral registers (GPIO, timers, UART settings; not the UART and SPI data registers, as reading them clears their flags) | to learn which pins drive the inverter PWM and which UART goes to the panel |
halt / resume | stop the program to look at its state, then carry on |
analyse the firmware copy on a computer (Ghidra: ARM Cortex-M, base 0x08000000) | to find how the firmware drives the motor, relays and sensors |
| Not allowed: it breaks something, or breaks it for good | What happens |
|---|---|
removing level 1 protection (stm32f1x unlock, setting RDP to 0) | all the firmware is erased |
| setting level 2 | debugging is disabled for good; there is no way back |
flash erase…, flash write…, program, "Erase", "Program", "Download" | the firmware is erased or replaced |
changing the option bytes (stm32f1x options_write) | can turn on protection or change how the chip behaves |
| connecting the board to the mains while a Pi or programmer is connected | mains voltage on the Pi and the computer |
The rule for this step: every command here only reads. If any software offers to erase, write or "unlock" anything, the answer is no.
What we read
We read it with an ST-Link V2 clone connected to the X20 pads: pad 1 SWCLK, pad 2 SWDIO, pad 5 GND, pad 6 3.3 V. The ST-Link itself powered the board. Pads 3 (NRST) and 4 were left unconnected: no reset was needed. The commands are the ones in the copy section, run from the STM32CubeProgrammer v2.23 command line.
| What | Result |
|---|---|
| board voltage (from the ST-Link) | 3.26 V |
| device ID | 0x422, revision Y: the STM32F302xB/xC and F303xB/xC family, Cortex-M4 core |
| flash | 256 KB (0x1FFFF7CC = 0x0100) |
| read protection (RDP) | 0xAA: level 0, no protection |
| write protection | off on all areas |
| option bytes | aa 55 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00: factory values |
| firmware copy | saved: two 256 KB copies, byte-for-byte identical; ≈ 33 s each |
| option bytes copy | saved, 16 bytes |
The marking does not match the chip. The package says STM32F301 VCT6, but the chip identifies as an STM32F302/F303 with 256 KB (the F301 line has ID 0x439 and at most 64 KB). The chip looks like it was marked to order for the board maker. Judging by the blocks the firmware uses (the TIM8 timer, six comparators, four op-amps; the F302 has no TIM8), it is most likely an STM32F303xC, so we work from the STM32F303VC documentation. The pinout agrees: SWD really is on pins 72 and 76, as on the F303VC.
What we saved besides the firmware: the option bytes (16 bytes), the device ID and flash size, and the chip's unique ID (0x1FFFF7AC, 12 bytes). The unique number stays in private notes only: it identifies this one chip. It can be read like this:
STM32_Programmer_CLI -c port=SWD mode=HOTPLUG freq=100 -r32 0x1FFFF7AC 12
The EEPROM copy is published above: it does not contain the board number. We do not publish the firmware itself: it is the manufacturer's program.
What the firmware consists of
Everything here was worked out from the copy on a computer, without writing anything to the board. The 256 KB of flash is laid out like this:
| Flash area | Size | What is there |
|---|---|---|
| the first page (2 KB) | ≈ 1 KB | the bootloader |
| next | ≈ 118 KB | the main program: interrupt table, code, tables |
| a separate area in the upper half | 32 KB | data: settings, including a factory EEPROM image |
| one more small area | ≈ 200 bytes | a little more data |
| the rest | ≈ 100 KB | empty (FF) |
The bootloader
Right at the start sits the string EDS_ST_STM32F3_02_210313, which looks like a build name and date (13 March 2021). What the bootloader does at power-on:
- It starts the external oscillator (on our board the 8 MHz
80.Kceramic resonator) and a ×3 frequency multiplier: 24 MHz. - It sets up the USART1 serial port on PE0/PE1 (pins 97 and 98): 9600 baud, 8 bits with parity (at 24 MHz a divider of 2500 gives exactly 9600).
- It sends the byte
0x54and waits ≈ 30 ms for a reply (up to 1 s if the previous start asked for longer). - If there is no reply, it leaves a
55 AAmarker in RAM and restarts the chip with the watchdog. The next start sees the marker and hands over straight to the main program. - If there is a reply, it accepts commands:
| Command byte | What it does (from our analysis) |
|---|---|
0x0A | link check, answers 0x8A |
0x5B | returns the version string (EDS_ST_…, 32 bytes) |
0x77 | sets an address (most likely where to receive data) |
0x04 | changes the port speed |
0x1A | runs code from the given address |
The bootloader itself does not write to flash: updating apparently works by receiving a flashing program into RAM, which then rewrites the main program. In other words, the firmware can be updated over the same serial port the board uses to talk to the panel (only the format differs: the bootloader uses parity, 8E1, the main program does not, 8N1). We are not doing that, but it explains why the bootloader is there.
The main program
The main program starts with its interrupt table right after the bootloader. Apart from the standard ones, only seven handlers are in use, and they show straight away what the program is about:
| Interrupt | What it is |
|---|---|
| ADC1_2 | the vector-control tick: as soon as ADC1 has measured the bus voltage, the firmware computes the motor control; the U and V phase currents are measured by ADC3 and ADC4 through the built-in op-amps |
| TIM1_UP | every PWM period of the inverter |
| TIM1_BRK, TIM8_BRK | emergency shutdown of the inverters (the firmware is built for two inverters; our board has one) |
| USART1 | receiving and sending on the D-Bus |
| UART5 | another serial port: transmit only, not brought out to any pin; purpose unknown |
| EXTI9_5 | an event on pin 93 (PB7), most likely from something that pulses |
The program can write to its own flash (it contains the flash unlock sequence), most likely to keep some of its settings in the data area. What the firmware switches on in the chip and which pins it reads is in part two.
Flash self-test
While running, the program uses the hardware CRC unit to checksum areas of its own flash, following a table of ranges. Household appliances commonly do this so that corrupted memory never ends up driving the heating element and the motor.
The consequence for us: you cannot patch even one byte of the original firmware, because the self-test will notice (hence our own firmware).
Next
- The board map: what the original firmware switches on in the chip, which pins go where, the temperature sensors and the D-Bus are in part two.
- Our own firmware: relays, sensors, the pump and the heating element are in part three.
Safety
- Do not plug the board into the mains while a programmer, ST-Link or Raspberry Pi is connected. The board's ground is tied to the mains, so mains voltage would end up on the computer. How to check this with a meter and how to work on the mains is in part three.
- The bus capacitor holds ~325 V for anything from a few seconds to a few minutes after switch-off. Before touching a board that has been on the mains, measure the voltage across it; if needed, discharge it through a 10 kΩ 5 W resistor, not a screwdriver.
- The motor wires are at mains potential: the inverter has no isolation, and each output pulses up to ~325 V relative to earth. The "54 V" on the drain pump is only the rated winding voltage that the inverter produces by PWM.
- A permanent-magnet motor generates voltage by itself when its shaft turns (by hand or from water flow), even with the board switched off.
- Run the heating element only with water flowing, on its own circuit with a 16 A breaker and a 30 mA RCD, with the pump housing earthed.
🔒 Identifiers and original copies: hidden, only the author can see this.
Article changelog
- 2026-11-18 — the series was restructured from five parts into three. This part now brings together the board, the EEPROM copy, the STM32 firmware copy (formerly part two) and the layout of the original firmware (from the former part three). Updated from measurements and the firmware analysis: the supply voltages, the PC13 pin holding the supply on, the inverter driver supply switched on by pulses, the 0.41 Ω shunts, the element relays and the JW2SN, the 8 MHz resonator, the known connectors, the "no water" threshold in the EEPROM; the pump section now records the decision to write our own firmware.
- 2026-11-15 — firmware layout: the EXTI9_5 interrupt comes from pin 93 (PB7).
- 2026-11-12 — photo of the X20 pads labelled with where to connect the ST-Link; the JW2SN relay stated as a fact, not a guess.
- 2026-11-10 — X20 pads 3 and 4 traced: 3 is NRST through 220 Ω, 4 is pin 90 (PB4); a tracing photo; the ST-Link and Raspberry Pi diagrams updated.
- 2026-11-10 — firmware analysis: layout, the bootloader, the main program, the self-test.
- 2026-11-10 — the STM32 firmware copy: software and drivers, the steps in short, command-line commands, the results from our board, a check of X20 against an open description.
- 2026-11-10 — first draft: useful parts left from the dishwasher, a description of the board from photos, what the pump needs, the EEPROM copy.