This article describes a solution for robust and reliable ‘production’ programming of Silabs based BLHeli ESCs.
The intention is to test and tune the BLHeli configuration, save the configuration in some form, and a scripted solution to programming multiple ESCs now and later replacements with high confidence that they are exactly matching configurations.
There does not appear to be any batch facility for writing flash using the BLHeli bootloader, nor does it appear that BLHeliSuite can save the relevant hex files for later use, so excluding use of the BLHeli bootloader.
The configuration data is held in a block of flash memory labelled EEPROM in the source code. It is not actually EEPROM, the MCU does not have EEPROM, but for consistency the block will be referred to as EEPROM in this article.
Having tested and tuned the configuration using BLHeliSuite, the EEPROM block from the test ESC is read back using Silabs Flash Programming Utility (FPU) and a toolstick attached to the ESC’s C2 interface.
Above, reading the EEPROM block.
The EEPROM block is them merged over the distribution hex file to create a custom hex file for repeated use.
The following Windows script performs this conversion.
@echo off rem this script is specific to BLHeli v14.8 set HEX=TURNIGY_PLUSH_12A_MULTI_REV14_8 cd \src\blheli set srec_cat=C:\src\srecord\srec_cat.exe set HEXPATH=C:\src\BLHeli\SiLabs\Hex files\ set XXD=xxd rem convert the format from Slilabs FPU read to bin %XXD% -r -p eeprom.hh eeprom.bin rem merge dist hex with custom eeprom image %srec_cat% "%HEXPATH%%HEX%.hex" -intel -exclude 0x1a00 0x1a70 eeprom.bin -bin -offset 0x1a00 -o "%HEX%.hex" -intel %srec_cat% "%HEX%.hex" -intel -exclude 0x1a00 0x1a70 eeprom.bin -bin -offset 0x1a00 -o "%HEX%.bin" -bin rem dump files for visual check echo eeprom.bin: %XXD% eeprom.bin echo. echo %HEX%.bin: %XXD% -s 0x1a00 -l 0x70 "%HEX%.bin" echo.
Having created the custom hex file, it can then be written using the command line utility from Silabs (installed in the program tree along with FPU).
Note that programming of ESCs has risks of damage, they should be programmed and tested on a current limited power supply. Be aware also that operation of ESCs using complementary PWM may drive current into the power supply that may disrupt ot damage some electronic regulated power supplies. BLHeli “damped light” mode would seem to be complementary PWM (their explanation is confused).
The following is a Windows script to write and verify the flash.
set FLASHUTILCL="C:\SiLabs\MCU\Utilities\FLASH Programming\Static Programmers\Command-Line\FlashUtilCL.exe" set FILE=TURNIGY_PLUSH_12A_MULTI_REV14_8.HEX %FLASHUTILCL% DownloadUSB "%FILE%" 0 0 1 %FLASHUTILCL% VerifyUSB %FILE% 0 1
Most ESCs do not have a connector on the C2 interface, but provide pads using in production programming. Access to the C2 pads with a bed of nails fixture is one way of reprogramming them.
If reprogramming in service is expected, a cable and connector can be added as in the following example.
Above is a Skywalker 40A with UBEC modified with longer supply and motor side wires, and a permanent C2 interface cable for programming the MCU. The cable has a JST-SH1.0 connector (purchased as HK 258000026) to plug into the after market Tool Stick clone (HK 289000003). The wires from the top down are orange, NC, brown and red. (Orange, Red and Brown wires correspond to Black White and Red dots on BLHeli documentation.) A small dot of hot melt adhesive is applied after soldering the wires to the PCB pads, and the cable folded down into the adhesive (to prevent fatigue and breakage of wires). The whole thing will be served over by clear heat shrink (left of for better pics).
Above the Tool Stick clone connection (see what clear heat shrink serving does for pics).