This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
ble_mqtt_gateway [08.01.2019 00:40]
Pascal Suter [Flashing]
ble_mqtt_gateway [09.01.2019 07:31]
Pascal Suter [Flashing]
Line 13: Line 13:
 | VCC | 5V | | VCC | 5V |
 | GND | G |  | GND | G | 
 +====== HM-10 Module ======
 +If you've purchased your HM-10 modules for less than $2 most likely you where sold a knock-off, as was I. This means that you most probably need to flash the HM-10 firmware first, otherwise the whole AT-Commands won't work and you can't use it for this project. ​
 +in order to do so, i had do solder some wires onto my HM-10. There are different ways to flash the firmware onto one of these copies. They all involve a software called CCLoader and most of them require an arduino of some sorts to connect to the HM-10. Now here comes an issue: with most HM-10 modules on the market, you will need to use some Logic Level Converter to convert from the 5V logic level of the arduino to the 3.3V logic level of the HM-10 board. On the back of my module it says "​Power:​3.6V-6V"​ and "​Level:​3.3V"​ which means i can feed it with 5V as supply power, but the logic levels are only 3.3V compatible, so DON'T connect it directly to your arduino one for example! ​
 +since i did not have some logic level converters at hand and neither did I have an arduino that uses 3.3V logic levels, i needed another option. There is a port of CCLoader to the raspberry pi. the raspberry pi uses 3.3v logic levels, i had an old one laying around and most importantly it makes for a nice integrated system with no dependencies on any other computer. so if you hae an old raspberry you can't use for other stuff this is the perfect application to put on there.. like this whenever you have an additional HM-10 to flash, you take your raspberry, connect it to the HM-10 and flash it.. no long preparations after the first one is done :) 
 +here is how i wired the three pins that i had to solder onto the HM-10 .. forget holding them in place, the flashing process takes about 10 minutes (with the checking enabled that is). 
 +sorry, this will have to follow later on.. basically i connected the DD,DC and RESET pins to the raspberry GPIO14,15 and 18. 
 +for the power supply i connected the +5V pin of the traspberry to the AH-9 board'​s VCC and the ground of the raspberry also to the AH-9's ground. ​
 +i then downloaded the latest version of [[https://​github.com/​AustinHaigh/​CCLoader-RPi|CCLoader-RPi]] to my raspberry and compiled it: 
 +  gcc src/​CCLoader.c -std=c99 -lm -o CCLoader
 +now for the firmware you can't download the original HM-10 firmware form the manufacturers webpage because they don't include the bootloader which we also need for our module. but there is a version out there in the web which contains also that. google for ''​CC2541hm10v540.bin''​ to find a copy. there should be one available [[http://​www.hangar42.nl/​ccloader|on this site]]. ​
 +now copy that binary into the same folder as your compiled CCLoader and run the software. it should look like that: 
 +pi@raspberrypi:​~/​CCLoader-RPi-master $ sudo ./CCLoader --RESET=14 --DD=15 --DC=18 CC2541hm10v540.bin ​
 +RESET: pin 14
 +DD: pin 15
 +DC: pin 18
 +Firmware loaded, 256 kB
 +Chip ID = 0x41
 +Erasing chip...
 +Chip erased.
 +XOSC has stabilized.
 +Flashing firmware... (511 blocks written, 99% done)
 +Flashing has completed successfully.
 +as i said, the flashing took an estimated 10 minutes, it shows you a progress where you will see the first blocks reported after a few seconds. ​
 ===== Flashing ===== ===== Flashing =====