The EEPROM is used to store the Multiprotocol Modules's global ID as well as details of bound receivers for certain protocols (AFHDS2A, Bugs, Devo, Walkera).
On an Atmega328p module the EEPROM is a dedicated and persistent data store, separate from the 32KB of flash memory. On the STM32 module there is no dedicated EEPROM, so EEPROM functionality is emulated in the last 2KB of flash memory.
This makes it relatively easy for the STM32 EEPROM data to be accidentally erased.
If the EEPROM is erased a new global ID will be generated (random for Atmega modules; the MCU UUID for STM32 modules) and models will need to be re-bound.
Backups of the EEPROM data can be made so that configuration such as module ID and bound receivers can be moved between modules.
**Note:** Backups can only restored to a module with same MCU type - i.e. an Atmega backup cannot be restored to an STM32 module.
The remainder of this doc is separated into sections for the STM32 and Atmega328p modules.
## STM32 Module
The EEPROM data is stored in the last 2KB of flash memory. It is read using stm32flash with the module in BOOT0 mode.
Again, the `-S 0x801F800:2048` option tells stm32flash to write 2048 bytes starting at 0x801F800. Additionally `-e 0` tells the tool not to erase any other blocks, which will preserve the rest of the data in the module's memory.
By default the EEPROM would be erased every time the module is flashed, but we configure the `EESAVE` bit so that the EEPROM is not erased during flashes. This is one reason is why it is crucial to set the 'fuses' on a new module using the **Burn Bootloader** command in the Arduino IDE, as described in the [documentation](Compiling.md#burn-bootloader-and-set-fuses).
It's not possible to simply erase the EEPROM so instead we write a file which overwrites all of the content with `0xFF`. Download the 'erase.hex' file [here](https://raw.githubusercontent.com/pascallanger/DIY-Multiprotocol-TX-Module/master/docs/erase.hex).