CN / EN
Doc Feedback
Thanks for your interest, welcome to contact us.
Thanks for your feedback

DFU Working Mode

  • DFU schemes are categorized into background DFU mode and non-background DFU mode which are applicable to both wireless and wired communication modes.
    • Background DFU mode: The firmware is received by the application which can perform other tasks at the same time.
    • Non-background DFU mode: The firmware is received by Bootloader which cannot perform other tasks at the same time.
  • According to the occupied storage area, DFU can also be divided into dual-bank DFU and single-bank DFU.
    • Dual-bank DFU: The received firmware is first cached in a designated area; once firmware check passes, it will be copied to the target area.
    • Single-bank DFU: The received firmware is written to the target area, directly overwriting the original firmware.

For background DFU, only the dual-bank mode can be used to store the original and new firmware, whereas for non-background DFU, either single-bank mode or dual-bank mode can be used. Based on this, common DFU working modes include

  • Background dual-bank DFU mode
  • Non-background dual-bank DFU mode
  • Non-background single-bank DFU mode

Details are as follows:

  • The schematic diagram of the background dual-bank DFU mode is shown in Figure 1. The upgrade process mainly consists of the following steps:

    1. The application receives the firmware from the host.
    2. The application writes the received firmware to the Bank1 area.
    3. After the firmware is written, check the new firmware in the Bank1 area. After the check passes, jump to and run the bootloader firmware.
    4. Bootloader copies the new firmware to the Bank0 area, and checks the new firmware. After the check passes, jump to and run the new firmware.
    Note:

    The device refers to the firmware, and the host refers to the mobile App if a mobile App is used.

    Figure 1 Schematic diagram of background dual-bank DFU mode
  • The schematic diagram of the non-background dual-bank DFU mode is shown in Figure 2. The upgrade process mainly consists of the following steps:
    1. Bootloader receives the firmware from the host.
    2. Bootloader writes the received firmware to the Bank1 area.
    3. After the firmware is written, check the new firmware in the Bank1 area. After the check passes, bootloader copies the new firmware to the Bank0 area and then checks the new firmware. After the second check passes, jump to and run the new firmware.
    Figure 2 Schematic diagram of non-background dual-bank DFU mode
  • The schematic diagram of the non-background single-bank DFU mode is shown in Figure 3. Bootloader receives the firmware from the host and writes the new firmware to the Bank0 area. After writing, check the new firmware. After the check passes, jump to and run the Bank0 application.
    Figure 3 Schematic diagram of non-background single-bank DFU mode

Differences between the three DFU working modes are listed below.

Table 2 Differences between three DFU working modes
DFU Mode Flash Size Required for Upgrading the Same Firmware Backup Mechanism Bootloader Firmware Size Performing Other Tasks During DFU
Background dual-bank DFU mode Large Supported Small Supported
Non-background single-bank DFU mode Small Not supported Large Not supported
Non-background dual-bank DFU mode Large Supported Large Not supported
Note:
  • When the same firmware is upgraded in either background dual-bank DFU mode or non-background dual-bank DFU mode, a large amount of Flash memory is required because two Flash areas are needed to store the new firmware and the original firmware, respectively.
  • Backup mechanism means that when the received new firmware is damaged, the system continues running the original firmware.
  • The Bootloader firmware in non-background single-bank DFU mode is smaller in size than that of the other two modes, because only the copying and jumping functionalities are needed in this mode and no data interaction with the host is required.
  • In non-background single-bank DFU mode and non-background dual-bank DFU mode, jumping to bootloader firmware is required and performing other tasks during upgrade is not supported. In contrast, the background dual-bank DFU mode allows performing other tasks during upgrade, improving the user experience.

As listed in Table 2, the advantage of the non-background dual-bank DFU mode is also available in background dual-bank DFU mode, whereas the non-background single-bank DFU mode has a unique advantage when compared with other two modes. Based on this, GR5xx provides two DFU working modes: background dual-bank DFU mode and non-background single-bank DFU mode.

In applications, you can choose an appropriate DFU working mode according to the Flash size and the size of the firmware to be upgraded. If (Flash size–Bootloader firmware size–Parameter storage space)/2 ≥ Size of the firmware to be upgraded, the background dual-bank DFU mode is recommended; if (Flash size–Bootloader firmware size–Parameter storage space)/2 < Size of the firmware to be upgraded, the non-background single-bank DFU mode is recommended.

Note:

The parameter storage space refers to an area in Flash for storing non-volatile data.

Scan to follow

Open WeChat, use "Scan" to follow.