Modern washing machines, refrigerators and even water heaters are equipped with electronic control modules that monitor the temperature and regulate heating, count drum rotation speeds, check the serviceability of all components and inform the user or technician about malfunctions. At the center of this entire process is a microcontroller (processor) that executes a specific set of instructions (firmware).
Microcontroller or processor
The difference between a microcontroller and a microprocessor (nowadays all devices are micro, but sometimes this prefix is omitted for simplicity) is that the microcontroller executes program code, like a processor, but also contains peripheral devices, timers, input-output devices ( see fig.).
Those. in household appliances, all central microcircuits of the control module are microcontrollers, not processors, but in the colloquial slang of craftsmen they are usually called processors.
Schematic representation of the firmware
This is a very simplified and simple example for understanding the contents of an instruction or program for a washing machine microcontroller; in reality, this entire cycle is much more complicated and has a bunch of branches and conditions, but the principle is exactly the same.
Separation of the firmware into config and sw
Over time, people began to understand that only certain parameters can be changed in the program and, thus, improved or customized for other models, for example, you can change the waiting time for the lock signal from 1 minute to 30 seconds in order to quickly inform the user about the need to close the hatch or change the number of spin speeds so that the laundry is drier or reduce them by one revolution so that the bearings do not fail after 1-2 years of operation.
Replacing these parameters with variables, we get two files
software.bin (shown schematically in the figure)
config.bin contents ( X=50rpm Y=2 minutes Z=1 minutes )
The difference between SOFTWARE and CONFIG
Now you can change individual parameters in the config.bin file without having to rewrite the entire program. Thus, we have separated the configuration data (config) from the main program.
software (SW) – a program for a microcontroller that describes the order of operations and process control.
config – part of SW with settings and parameters necessary for program execution.
We specifically separated these two parameters and gave them two different definitions in order to bring greater clarity to understanding the programming process, although we understand that such a division is not entirely correct. Both the first and second files can be called firmware; in addition, the process of replacing these processor memory files can also be called firmware.
What is a compiler?
The concept of “firmware” dates back to the 1960s, when they used magnetic cores through which wires were threaded in a certain way, this was done manually and was very similar to firmware. Since then, this term has remained with us and is now sometimes used to describe completely different things. Unfortunately, only people can exchange words, machines (microcontrollers) do not understand Russian or any other human language, so how can you tell them about the instructions (program) that they need to carry out?
For this, there are special translator programs (compilers) that translate a “human-readable” program into machine code, which our processor executes; for the most part, this translator is built into the development environment and is part of it. Those. a person types a program using approximately the same algorithm as we said earlier, only using valid words and symbols in English, and the development environment produces an output file that our microcontroller understands and can execute it.
The reverse translation process (decompiling) is often either impossible at all or very labor-intensive, but if you look carefully, you can identify patterns and display them in an understandable form. As with any program or cycle, failures can occur in the firmware caused by external factors or errors (flaws) within the program, and the contents of the program may be damaged and lead to improper operation of the device. To control this process, developers began to count bytes (information inside the firmware) and write this amount into the firmware itself, and technicians (for example: washing machine repairs) can use special programs to recalculate this amount and draw a conclusion about the serviceability or malfunction of the firmware.
A checksum is a certain value necessary to determine the serviceability of the firmware by comparing the original and calculated results; it is calculated by various algorithms and, as a rule, consists of a four-digit number in hexadecimal code.
Changeable and immutable areas
Also, the firmware can consist of two areas:
The immutable data area is the area that is taken into account when calculating the checksum and which cannot be changed during program storage and execution.
The variable data area is a part of the firmware data that is not taken into account when calculating the checksum and, as a rule, stores the current position of controls or error statistics. These areas can be located together in one config file (for example, EVO1 or EVO2 firmware from Ariston/Indesit) or separately (as in Arcadia, statistics are separate from config)