Simulate BLHeli ESC firmware upgrade to realize air upgrade of ESC

ESC supplier: Feiying Jiale 15A 4in1 multi-axis ESC BLHeli-S 

The process of flashing the firmware with the host computer:

When using BLHeli to flash the ESC firmware normally, you need to use the arduino nano adapter board, and then flash the firmware of the adapter board

 

 

 After flashing the firmware of the adapter board, connect the ESC normally, click connect and after successful connection, click falsh other to flash the APP firmware of the ESC, and falsh BLHeli to flash the bootload firmware

Note that D3 of the arduino nano adapter board is connected to S1~S4 of the ESC, a single connection, the connection is as shown in the figure below

 Normal connection, and the parameter information of the ESC can be read

 

 The above process of brushing the ESC firmware with the host computer is ESC firmware 1> PC 1> arduino nano adapter board 1> ESC

Referring to the above operation, if you want to upgrade the ESC firmware in the air, you need to add code in the flight control code to replace the role of the arduino nano adapter board. The process is: ESC firmware 1> Host computer 1> Server 1> Flight control external falsh 1 > ESC, here ignore the process of the firmware from the host computer to the external falsh of the flight control, which means that the firmware has been stored in the external falsh of the flight control, we only need to take it out and write it according to the requirements of the ESC BootLoader.

In principle, it is the same as reading and writing flash operations, it just simulates the code of the adapter board, and reads and writes flash according to the interactive protocol.

The baud rate of this ESC is 19200. The interaction between the BootLoader and the arduino nano adapter board is a software analog serial port with a single bus. The IO on the software needs to be configured with a general open-drain mode, and the IO on the hardware needs to be connected to a pull-up resistor. The ESC is controlled by 4 51 MCUs EFM8BB21F16G from Xinke, which is actually an IAP air upgrade for this chip.

Regarding the BootLoader of the ESC, according to what I know, the supplier will modify the initial value of the CRC16 check and the value of the polynomial according to each customer. As for the instructions in the BootLoader protocol, I don’t know whether it is universal or not. It is best to use the upper bit first. Upgrade the computer software, and then use the serial port to capture data and judge the protocol instructions.

For example, the following is the data captured by the analysis:

 Then get the interactive command of the ESC:

 Data format for reading and writing ESC flash:

Notes for this ESC:

1. The erasing area is 0X00~0X1BFF, after 0X1C00 is the address of BootLoader.

2. There may be failures during the upgrade process, mainly due to data errors or power failure during the erasing process, which will cause the 51 chip flash of the ESC to be erased and cannot be accessed again. It is necessary to flash the firmware on an IC pin, or return the supply Commercial flash firmware

3. The interactive data uses a single bus, and the IO port is configured as a general-purpose open-drain output, and the hardware needs to be pulled up

 

 

Guess you like

Origin blog.csdn.net/cuncun666/article/details/129387572