Paired 2 HM-10's Together but Data is Not Transmitting

Hello, all.

I recently purchased some HM-10's (Amazon.com: AITIAO 3Pcs HM-10 Bluetooth Module CC2540 CC2541 AT-09 Serial Wireless Module BLE 4.0 Bluetooth Compatible : Electronics). I am working on trying to get the modules to transmit data to each other, but am running into an issue where I can connect the modules but cannot transmit data.

My current setup:

  • USB-TTL convertor.
  • Python program that will send commands over the convertor.
  • The Master device is connected to the convertor.
  • The slave device is just connected to a breadboard and powered.
    • I have an LED hooked up to the RX pin so that I can tell if any information has been sent.

I can connect the devices using the following sequence of commands:
Master:
AT+ROLE1

Slave:
AT+ROLE0


AT+INQ
AT+CONNx

After successfully connecting the devices, the STATE LED will remain solid.

My issue is that if I send any data from the Master to the Slave, I do not see the LED light up.

I have confirmed that my phone can send data to HM-10 using the LightBlue app.

I also am able to disconnect the slave by running the AT+DISC command.

I have also tried flashing firmware on the third HM-10 (following these instructions How to flash genuine HM-10 firmware on CC2541 (make genuine HM-10 from CC41)) but after doing so the device would not respond to any AT commands.

I would really appreciate any help that I can get on this.

Please read the pinned post re 'How to get the most from the forum'. We need to SEE what you can see.

Wiring:

I have my master device connected to the USB to TTL converter.
The slave device is simply being powered by an STM32 (I have plans later to make a controller for a pong game)

To keep things simple for now I have a terminal emulator that I made in python so that I can send commands to the master device.
Here is the code for that:

import traceback

import serial
import time
import threading
import sys

PORT = "COM4"
BAUDRATE = 9600

print(f"Opening {PORT} at {BAUDRATE} baud...")
ser = serial.Serial(PORT, BAUDRATE, timeout=5)
time.sleep(1)
print("Connected. Type AT commands and press Enter to send.")
print("Type 'quit' to exit.\n")

def print_data():
    while True:
        try:
            if ser.in_waiting:
                data = ""
                data += ser.readline().decode(errors="ignore")
                if data.strip():
                    for line in data.strip():
                        sys.stdout.write(f"{line}")
                        sys.stdout.flush()
                    print("\n")
            time.sleep(0.05)
        except:
            traceback.print_exc()

threading.Thread(target=print_data, daemon=True).start()

try:
    ending = "\r\n"
    while True:
        cmd = input("").strip()
        time.sleep(0.50)
        if cmd.lower() == "noclrf":
            ending=""
        if cmd.lower() == "nocr":
            ending="\r\n"
        if cmd.lower() == "quit":
            break
        if cmd.lower() == "clrf":
            ending="\r\n"
        if cmd:
            ser.write((cmd+ending).encode())
except (KeyboardInterrupt, EOFError):
    pass


ser.close()
print("\nClosed.")

I would say I am at an intermediate level of understanding of embedded systems so anything UART related I understand. (e.g. I know not to connect tx to tx and rx to rx).

I am able to send commands between through the serial monitor.
for reference here is a list of (mostly) available commands:

AT+HELP
********************************************************************

* Command             Description			           *

* ---------------------------------------------------------------- *

* AT                  Check if the command terminal work normally  *

* AT+RESET            Software reboot				   *

* AT+VERSION          Get firmware, bluetooth, HCI and LMP version *

* AT+HELP             List all the commands		           *

* AT+NAME             Get/Set local device name                    *

* AT+PIN              Get/Set pin code for pairing                 *

* AT+BAUD             Get/Set baud rate		                   *

* AT+LADDR            Get local bluetooth address		   *

* AT+ADDR             Get local bluetooth address		   *

* AT+DEFAULT          Restore factory default			   *

* AT+RENEW            Restore factory default			   *

* AT+STATE            Get current state				   *

* AT+PWRM             Get/Set power on mode(low power) 		   *

* AT+POWE             Get/Set RF transmit power 		   *

* AT+SLEEP            Sleep mode 		                   *

* AT+ROLE             Get/Set current role.	                   *

* AT+PARI             Get/Set UART parity bit.                     *

* AT+STOP             Get/Set UART stop bit.                       *

* AT+INQ              Search slave model                           *

* AT+SHOW             Show the searched slave model.               *

* AT+CONN             Connect the index slave model.               *

* AT+IMME             System wait for command when power on.	   *

* AT+START            System start working.			   *

* AT+UUID             Get/Set system SERVER_UUID .            	   *

* AT+CHAR             Get/Set system CHAR_UUID .            	   *

* -----------------------------------------------------------------*

* Note: (M) = The command support master mode only. 	           *

Some commands do not work, and some are not listed. For example when connected to another device AT+DISC will disconnect.
AT+MODEx is also a command, I'm honestly not to sure what it does but I've experimented with different modes and the command seems to do nothing.

Right now my goal is pretty simple. Confirm that I am seeing data come through when I connect my two HM-10's together.

Here is what I have been trying with my python program:

Opening COM4 at 9600 baud...
Connected. Type AT commands and press Enter to send.
Type 'quit' to exit.

AT+ROLE1
+ROLE=1

AT+INQ
+INQS

Scanning...

+INQ:1 0x5DE841771F71

+INQ:2 0x0E48FFB575C7

+INQ:3 0xF082C0761589

+INQ:4 0x7C010A391308

+INQ:5 0x4940FBAC4E18

AT+CONN4
+CONN:4

Connected

SENDING THIS MESSAGE SHOULD FLICKER THE LED ON THE RX PIN OF THE SLAVE

My issue now is that the LED will not flicker.
I also know the SLAVE is connected as the STATE LED is on.
I know the LED works as shown by this picture:

I also have tried using my oscilloscope (not that it would change anything) to see if I get any signal and again nothing.

Tools I have available:

  • 3 STM32F411's
  • Oscilloscope
  • Multimeter
  • CCLoader if I wanted to try flashing new firmware (Already bricked one board this way so I'd prefer another route)
  • Logic Analyzer

Hi, @joelschell

Does that blue LED on the protoboard need a series current limit resistor?

Tom.... :smiley: :+1: :coffee: :australia:

No, they have an SMD resistor on board.

Hopefully this helps you find the problem. The parts you are using are somewhat sensitive to power supply issues. Try separating the Tx and Rx by a meter or more.

Put a scope on VCC at the module and look for dips below about 3.0 V during activity. Anything more than about 100 mV ripple during TX bursts is suspect.

Check the following common failure modes from supply problems.

Voltage dip during transmit (TX bursts can spike 40 to 50 mA). This is a common trouble point. You may see module resets or disconnects that appear as random dropouts.

A noisy supply can cause reduced range, erratic behavior, or missed data.

Poor grounding or long leads can make the RF section unstable and may also introduce UART data errors.

Try the following:

Provide local decoupling at the module:
0.1 uF ceramic
4.7 to 10 uF bulk

Use a low impedance supply:
do not run through long thin wires
avoid weak 3.3 V pins on some boards

Use a clean regulator:
an LDO is preferred
if using a switching regulator, be sure it is well filtered

@gilshultz
I’m willing to believe that there could definitely, be power supply issues. I’m just not super convinced that it’s the cause of what I’m experiencing right now. Remember, my goal is to see the LED on the RX line of the slave flicker. If I was already receiving data on that line but it was noisy and prone to UART errors, implementing your suggestions would be a different story. I also have been able to receive responses from the slave module on the breadboard. By this I mean if I wire up the USB to TTL converter to the HM-10 without changing anything else I can send and receive data from it. I also am able to read data sent from my phone using LightBlue with the HM-10 wired as such on the board.

I appreciate your suggestions though!

My understanding is that the Rx pin on the HM10 is an input pin typically connected to a Tx pin from a serial source. I do not think it is supposed to light up when the BLE unit is receiving wireless data.

Duh!! Yeah, I'm not sure what I was thinking when testing that setup. Unfortunately, the issue still persists after connecting the LED to the TX pin :cry:. The LED remains always on as UART keeps lines IDLE at VCC.

stepping back a bit

  • what is the project?
  • what is the environment?
  • what is the distance between transmitter and receiver?
  • is the HM-10 the best solution?
  • is there a better wireless solution?

@hora

  • what is the project?
    • I am going to be making a wireless controller to play pong.
    • This is for my final project for my embedded systems class.
  • what is the environment?
    • The final project's environment will consist of 3 STM32F411's
    • I will use the USART peripherals to communicate with the HM-10's there will be two HM-10 on the "console" and one HM-10 on the "controller"
    • The control will only be sending data from a joystick to the console.
  • what is the distance between transmitter and receiver?
    • No more than 10-feet. Typically 3-5 feet.
  • is the HM-10 the best solution?
    • At this point probably not. However, I've dropped enough money onto this project and don't really have a whole lot of time left to be ordering new parts.
  • is there a better wireless solution?
    • Definitely, but time constraints above don't really allow me ordering a new wireless solution and learning how to use it.

Honestly, I'm kinda at the point where I'm just gonna cut my losses. I was mostly posting as a last hope.

how will the three HM-10s interact?

sounds like an application suited to using ESP-NOW which is simple to use