This is a quick tutorial on flashing firmware onto CC2540/CC2541 chips using a Mac. Usually you would need a CC Debugger device (Windows-only) to do update the flash memory, but this method only requires an Arduino Uno board and is multiplatform on top of that. I have written an app for macOS to speed up the process even more, hence this tutorial.

Note that this is not the same as updating the HM10 firmware with JNHuamao’s application, which relies on the bootloader already flashed to their HM10’s. Lucky for us someone made available a binary that includes this bootloader, meaning we can flash official firmware to fake HM10’s.

CCLoader

We’ll be using CCLoader from ReadBearLab to flash the chip. Download the sketch and upload it to your Arduino board (I used an Uno, but similar ones will work too).

Connect the Arduino to the CC254x:

  • Arduino D4 to P18 (Reset)
  • Arduino D5 to P21 (DD – Debug Data)
  • Arduino D6 to P22 (DC – Debug Clock)

Also connect VCC to the 3.3V pin and GND to GND.

Windows users should use CCLoader.exe, Linux users will have to compile the command line script themselves. Alternatively you can use a Raspberry Pi with CCLoader-RPi.

macOS 10.12+ users can use CCLoaderX, an app I wrote to simplify the process. Download the latest release on GitHub.

Flashing the firmware

Open up CCLoaderX and drag-and-drop your .bin file to the window. Select the serial port of the Arduino (e.g. /dev/cu.usbmodemFD141) and press ‘Upload’. It might take a minute, but all else should be going automatically.

If the serial port doesn’t show up, try connecting the Arduino to a different USB port and hitting ‘Reload’. You can verify it’s the right port with the Arduino IDE (check Menu > Tools > Port).

If you get the message ‘No chip detected!’ the Arduino is not making contact with the HM10. Double check the connections and make sure the power supply is reliable.

I have experimented a bit with (incompatible) firmwares and was not able to brick the HM10. Even if the sequence gets interrupted or the HM10 seems unresponsive, just start over and you should be fine.

Flash Genuine Firmware on Fake HM10’s

The binaries JNHuamao provides will not work because they don’t include the bootloader. However there circulates one copy of version 540 that does:

→ CC2541hm10v540.bin

If you use this firmware on a clone (e.g. CC41-A or JDY-08) you’ll unlock all AT commands and features the official HM10 firmware provides — up to V540 that is.

The missing crystal on some counterfeits does not seem to be a problem. The HM10 firmware checks if it is available and uses the internal oscillator if it’s not there.

BlueBasic

I wrote CCLoaderX so that I could flash BlueBasic on my HM10s. I wanted to create a bluetooth MIDI module for my Stein;Way project that is supported by iOS natively.

However I still have not gotten BlueBasic to work. I have tried both genuine and fake HM10s with no luck… In case you are here to do the same, you’ve been warned!

More Resources