Pages

23/05/2020

Flashing a HM-10 (CC254X) Bluetooth Module from OSX with an ESP8266 NodeMCU

I recently experimented with a HM-10 Bluetooth Module and Tasmota, and the advice is to flash the module to with a native CC2541 Binary (V707 at the time of writing) to ensure proper operation.

The official Tasmota documentation includes a link to a repo that includes the source for an ESP8266 and a windows application. The sources for OSX but there's no pre-compiled application or instructions. I'm lazy, too lazy to even grab my Windows laptop, so I figured out how to do it with OSX.

HM-10 Bluetooth Module

Disclaimer


As usual there's no guarantees this is the best way or even the sensible way to do this. I've not reviewed the code for the NodeMCU or the CCLoader OSX app, so for all I know it's sending your data to China and killing you with Radio Waves. Hopefully not.

Prerequisites


  • An ESP8266 / NodeMCU
  • A HM-10 Module
  • Jumper Wires ("Dupont" Connectors")
  • Soldering Iron, Solder, Standard Electronics Tools
  • A working platformio environment - I won't cover this in the tutorial! (sorry...)

Connecting the HM-10



HM-10 Modules don't usually expose the required programming pins to headers, so you need to solder some wires to the board. Despite the fine pitch it's not terribly difficult, so don't be put off.

Pins ( Click to expand )

Use the diagram above in conjunction with the table below to connect up the wires between the HM-10 and the NodeMCU.

Note: Different HM-10 Modules appear to have VCC and GND in different positions - check before connecting

HM10NodeMCU
VCCVCC3.3V
GNDGNDGND
Reset11D1
DC7D2
DD8D5

The image below shows my completed module. I use Capton tape when soldering near dense SMD components to prevent any... accidents.

Programming Pins broken out on HM-10


HM-10 Module connected to the MCU

Flashing the NodeMCU


This flashing method uses a NodeMCU to act as a dumb programmer. To do, it needs to be flashed with the specific firmware. I used a version from Jason2866 available on github

To do so I used VSCode and PlatformIO. Instructions on this are out of the scope of this tutorial (sorry) so it' assumed you're familiar with it or can find a tutorial on getting it setup.

Before flashing I had to edit the platformio.ini file by adding the following in the [common] section:
platform_packages =

And editing the upload port to reflect the correct port for your system:
upload_port = /dev/tty.wchusbserial1430

I then compiled and uploaded the firmware using Platformio.

Flashing the HM-10


To flash the HM-10 you need to use the CCLoader application inconjunction with the flashed NodeMCU. I got the compiled OSX App from the releases page hoiberg's Github repository.  I unzipped it and ran the application without needing to copy it to the Applications directory. I had to jump through the usual hoops of going to System Preferences > Security and acknowledging the risk of opening an unknown application.

Once opened, you're presented with a simple interface to flash the HM-10

CCLoader Application
 Select the correct Serial Port from the dropdown, and the path to the Binary. You want to use the  CC2541hm10v707.bin file from the CCLoader repository you cloned earlier, something like $PathTo/CCLoader/Bin/CC2541hm10v707.bin

You can then hit upload. On the first attempt it failed early on the in process with the error "Verification Failed" but it worked fine on the second attempt:

Mid-flash
Once completed, you'll see the following screen:


And that's it, you've now flashed the HM-10 to the suggested firmware version. You can unplug everything and unsolder the wires from the bluetooth module and start using it!

 



No comments:

Post a comment