PETRONE / BLE / Protocol / FirmwareUpdate
Modified : 2017.10.18


How to update PETRONE firmware



PETRONE Firmware

PETRONE is configured with Controll Firmware(Main) and Communication Firmware(Sub). Each firmware divides the internal flash space into two areas ( ImageA, ImageB). When updating firmware, proceed from ImageA to ImageB, ImageB to ImageA. So current running firmware is ImageA than send ImageB.

Firmware header structure

The first 16 bytes of the firmware file are configured as below. You can read this section for information about the firmware file.

Updater::Header

namespace Updater
{
    struct Header
    {
        u16     reserve;        // reserve [2byte]

        u32     length;         // firmware length( Length of actual firmware except header 16 bytes)[4byte]

        u8      year;           // firmware build year[2byte]
        u8      month;          // firmware build month[1byte]
        u8      day;            // firmware build day[1byte

        u16     version;        // firmware version[2byte]
        u8      imageType;      // firmware image type[1byte]
        u32     deviceType;     // target device type[4byte]
    };
}



Firmware update process

  1. Download the 4 firmware file from the server before starting the firmware update.(Main A/B and Sub A/B)를 받습니다.

  2. Read the first 16 bytes of the firmware file to determine information about each file. (Updater::Header)

  3. Request current running firmware information. (Protocol::UpdateLookupTarget)

  4. Response Protocol::UpdateInformation structure from drone.

  5. Compare the firmware on the drone with the information on the firmware received from the server to send the appropriate firmware. (Protocol::Update)
    • When updating the firmware, the file transfers data that is truncated to 16 bytes. 1 block size is 16byte.
    • Current running firmware type is ImageA send RawImageB or EncryptedImageB. On the contrary ImageB, send RawImageA or EncryptedImageA인.
    • If there is no problem transferring firmware data via BLE, drone does not respond. If you lose or encounter problems with the data being transmitted, send a firmware update location correction(Protocol::UpdateLocationCorrect). If you receive this structure, you must start sending again from that location.
    • When firmware data is transmitted via serial communication, the firmware update location correction is response every block(Protocol::UpdateLocationCorrect).
  6. Processing Petron Firmware Update
    • Boots to the new image only when the firmware update has completed successfully. In most cases, failure to update the firmware is not a major problem, because the older firmware is preserved even if it fails in the middle.
    • If you have updated the control firmware, restart the control program immediately after the firmware update is complete. If the communication firmware has been updated, disconnect BLE and restart the communication program.

Precautions for Firmware update

  • It is not recommended to return to the old firmware when updating the firmware. Most updates are provided to troubleshoot problems with older firmware, so changing to an older firmware might cause unexpected problems. In addition, some updates might add new hardware support. In such cases, if you change to an older firmware, the hardware might not work.

  • If the protocol changes with the firmware update, the changes are reflects in the current document. If you change to existing firmware, you may experience problems with the protocol not matching the document, resulting in failure to perform the desired action, or dangerous malfunction.

  • Firmware updates are recommended through an app provided by the robot or via a PC program.



Request data example

  • Request control firmware(serial communication)
0
1
2
3
4
5
6
7
8
9
Start code
Header
Data
CRC16
DataType
Length
0A
55
90
04
01
00
00
00
16
31
  • Request communication Firmware(serial communication)
0
1
2
3
4
5
6
7
8
9
Start code
Header
Data
CRC16
DataType
Length
0A
55
90
04
02
00
00
00
CA
AA



PETRONE

  1. Intro
  2. Typedef
  3. DataType
  4. Definitions
  5. Base Structs
  6. Structs
  7. Structs - Light
  8. Firmware Update
  1. Intro
  2. DataType
  3. Definitions
  4. Structs
  5. Examples


Index