7

Can anyone help me with the AT command to write characteristic value, Or how to send data from arduino to another ble device using Hm10 module.

The HM10 after sending the AT+START, does advertise packets, and can detect the service and characteristic, But the characteristic value is the default 0x00, How can I change that?

Have checked the data sheet multiple times but can not find an AT command that is capable of doing the same.

UPDATE: Similar problem with setting the HM10 in Central Mode:

Central Mode Setup!

1) AT+ROLE1 - Set up to Central Mode

2) AT+IMME1 - Start from RESET

3) AT+SHOW1 - Show discovered devices

4) AT+DISC? - Discover Devices Get Device MAC ID,

5) AT+CON[MAC ID]

RESULT: Always gives OK+CONNA and after 10seconds OK+CONNF

I am confused, Use of "AT+START" before "AT+DISC?" causes AT+START to not work and viceversa. Using AT+START results into a loop of OK+CONN followed by OK+LOST continuously and no more AT commands are accepted. I believe it does result in a

Can you advice on the right order?

Using LightBlue iOS app as the peripheral. How am I to select a service and subscribe to a characteristic to receive data from the application?

Thank You.

Sam Protsenko
  • 14,045
  • 4
  • 59
  • 75
Aakash Thakkar
  • 301
  • 1
  • 3
  • 20

4 Answers4

9

There is no AT command to set a characteristic value.

The HM10 is a serial-port emulation device - whatever serial data you send to the HM10 module (aside from the AT commands) is made available on it's BLE characteristic. Unfortunately the data sheet doesn't document the service and characteristics, but this code suggests that the serial RX/TX characteristic is 0000ffe1-0000-1000-8000-00805f9b34fb

So, data written to the serial port should appear as the value of that characteristic. Data written to that characteristic should be delivered out of the TX serial port pin on the HM10 module.

Paulw11
  • 108,386
  • 14
  • 159
  • 186
5

This thread is a bit dated. But the HM-1X firmware now supports changing the characteristics of a module.

"AT+CHAR?" Will get the current characteristic setting for RX/TX "AT+CHAR0xFFFF" will set the TX/RX characteristics to 0xFFFF

Send: AT+CHAR0xAAA0 Recv: OK+Set:0xAAA0

These features were added v518.

If you need to update your firmware,

Link to Huamao's download site.

C. Thomas Brittain
  • 376
  • 1
  • 5
  • 12
2

I don't have enough reputation to comment on Ladvien's answer, but...

Just a word of warning regarding updating the firmware with a new version from Huamao's download site. http://www.jnhuamao.cn/download_rom_en.asp?id=83

In my experience there were issues with V539, which prevented the firmware operating as an iBeacon - and there may be other problems. I was fortunately enough to find someone emailed me a copy of the V538 firmware and was able to downgrade again.

Huamao doesn't have old versions of the firmware available for download and AFIK there is no way to backup your current firmware version.

But it was possible to downgrade from V539 back to V538 if you have the bin file for V538 etc. i.e At least up as far as V539 the firmware does allow downgrades and was not checking version numbers to only allow upgrades.

RogerClark
  • 51
  • 3
  • Wow, you're exactly right. I did not thoroughly test v539 before posting. It is not allowing me to connect an HM11 and HM10 now. Same for v538; I'm trying to find someone with v528 for both the 2541 and 2540--for the HM10 – C. Thomas Brittain Apr 05 '15 at 21:44
  • When you say "not allowing to connect", do you mean connect on Bluetooth or by serial to the pins on the module. V538 works OK as a BLE Beacon, but I have not tried it as a normal BLE Serial device. Sorry. I don't have any other version than 539 and 538. – RogerClark Apr 06 '15 at 23:01
  • It'll allow me to connect my iOS Apps; but my HM-10 (CC2540) will not connect with my HM-11 (CC2541). I've not tried connect two HM-10s, but I'm sure it'll be the same result. – C. Thomas Brittain Apr 06 '15 at 23:13
  • You'd need to check the spec's but the CC2540 and CC2541 appear to be very similar except the size of flash and ram. But this may effect the firmware if the ram location or flash location is different between these two devices - hence you may not be able to install HM10 firmware onto the HM11. Whats more likely is that the firmware in the HM11 is a different version. Do you try getting the version using the AT command. I think its AT+VERS? and compare between the two modules. CC2540 & 41 modules and they both work ok on Android. – RogerClark Apr 07 '15 at 23:45
  • 2541 and 2540 are very similar, but the firmware is different. If you load the firmware for a 41 onto a 40 it'll brick it (unless of course you have a CCDebugger). And forgive me I wasn't clear. I have no problem connecting to v539 with iOS or Android, but they won't connect with each other. I've requested help from Huamao, but their response was pretty flippant. Could you test a serial connection between your v539s for me? Want to make sure it's not just me. – C. Thomas Brittain Apr 08 '15 at 00:59
0

No need to use any AT-commands to send data as it works like transparent serial. Currently it works good to upload sketches from iOS devices to Arduino. Check out http://www.apploader.info

4ntoine
  • 19,816
  • 21
  • 96
  • 220
  • Can you share your source for iOS to compile a sketch ? have you built a compiler for iOS or is it an online compiler ? – Curnelious Aug 07 '16 at 09:32