After numerous reports of failures to flash HM-10 Bluetooth modules with the Arduino CC-Debugger we were lucky enough to get the module for experimentation and troubleshooting.
To our surprise the tool indeed was refusing to communicate with the HM-10. Even 'Info'
button kept reporting 0 Kb of flash memory which was clearly wrong. It has been quickly established that the actual pitfall was in communication protocol between the Arduino and PC application, only one byte was dedicated for that which obviously couldn’t hold the value ‘256’. Fixing this fixed the values retrived by the 'Info'
button but 'Read'
operation kept failing. It turned out the be the similar problem again – as the transmission was packetized into 1 Kb blocks there was only one byte dedicated to a block number and given that the chip has 256 Kb it was destined to fail. The third and final issue was with uploading binary files which were smaller than the total size of a chip and which size was not the exact integer number in kilobytes. In other words, an image of 8192 bytes in size would be flashed correctly while, say, 89751 bytes would not. This has to do with different buffer sizes for the protocol exchange and internal buffer on Arduino which is used for DMA transfers when the actual flashing is performed. So, as a result, the last block of data was incomplete which didn’t trigger DMA operation and remaining portion of the image was simply not flashed. This is why attempts to flash v1_1.bin by bjoerke rendered the module non-functional. This has also been fixed. And finally, the physical interface between CC24XX chip and the debugger has been simplified to just three wires as shown on the picture below:
The HM-10 module wired to Arduino board and ready for flashing is shown on the picture below. Please note that there are only three signal wires now for communication plus VCC and GND, five in total:
The following screenshot below shows CCLibFrontend
app successfully detected HM-10 module
. Note, that the chip ID represents CC2541 with 256Kb of flash memory. No license, BT address or HW revision are retrieved – they are properties of BLE122, BLE113 modules and not applicable to HM-10. IEEE address value in case of HM-10 is the actual Bluetooth address.
Downloads:
1. Arduino CC-Debugger sketch & library Rev1.1
2. Arduino CC-Debugger Frontend Rev1.1
It looks like the avr libraries are too different between the 101 and the Uno. At least to me. So, I pulled out a level shifter and wired everything up with an Arduino Uno.
I was able read the firmware from the chip resulting in a 27k read.bin file, but it’s telling me that the chip only has 16k flash and the chip id is 0x0000.
The firmware I want to flash is 256k, but it won’t let me flash because it can’t identify the chip it’s flashing to. Do you have any ideas what I could look into?
It looks like the avr libraries are too different between the 101 and the Uno. At least to me. So, I pulled out a level shifter and wired everything up with an Arduino Uno.
I was able read the firmware from the chip resulting in a 27k read.bin file, but it’s telling me that the chip only has 16k flash and the chip id is 0x0000.
The firmware I want to flash is 256k, but it won’t let me flash because it can’t identify the chip it’s flashing to. Do you have any ideas what I could look into?
Hi,
1. Yes, 101 is a totally different story. Given that that you already found Arduino Uno, no need to look at 101 at the moment.
2. I thought I accidentally provided links to rev.1.0 but not – just downloaded both rev.1.1 CC-Debugger sketch & lib and the frontend, hooked up HM-10 and ATMega328 based Arduino – everything is exactly the same as on the screenshot here: http://magictale.com/wp-content/uploads/2016/07/ArduinoCC-Debugger_HM-10_Screenshoot.png
It correctly reports 256K. Actually, it sounds like you downloaded rev.1.0 – there was a limitation in protocol so it used to incorrectly detect flash size for chips bigger than 128K. Can you make sure that you are using rev.1.1? What is the chip ID that the tool reports?
Thank you,
Dmitry
Hi,
At first thank you very much, that you give us your work as Open Source !!
But the problem is to compile the Arduino CC-Debugger Frontend Rev1.1 because the C# Framework is very heavy and cost a lot of time for a one time job.
I have a wish : Is is possible for you to generate the Windows exe file ?
It will be very very helpful !!
I wish you and your family a nice day.
With best regards
Sigges
Hi dmitryp,
I am using this software to program a cc2531 USB Dongle using an UNO. At first I got nothing but errors and false Chip id (ffff OR 0000).
After a week testing I got access to a Osciloscope and the signals at the 3.3 side were messy. The 5V side sent square signals but the 3.3 side was getting SAW waves (sorry, I am not used to english but I think that`s what they seem to be, a saw). I changed the resistors to 330 Ohm/680 Ohm and now the signals are both square on 5v and 3.3 side. The chip info is now correct according to it´s datasheet.
The issue I am having now is to correctly open the hex file. At first, the hex file won’t show up at the dialog box, but if I start manually inputing the file name, the correct file is sugested. I choose the file name that I want to write but I end up with “System.IndexOutOfRangeException”. I am working on that right now and I think it will be solved soon.
I did some changes to the visual studio software to include a configuration page so that the software can be conpilled and the serial port con be chosen at runtime execution. I also added some exeption handling. If you are intereted in this changes I will be happy to provide the files.
Thanks a lot for this work!
Hi dmitryp,
I converted my .hex file into a .bin file using a external converter.
Flashing the .bin file worked fine for me for the cc2531 USB Dongle, just the converter is crashing.
I am using the 330 Ohm/ 680 Ohm resistors instead of the ones sugested.
When asked, I chose the HM-10 mode. I didn’t test the other option.
Thanks!