0

I was trying to use my HC-05 module as a central node to scan nearby bluetooth devices. but I faced an issue with following commands: AT+INQ gives response ERROR:(1F) and AT+INIT gives response ERROR:(17) but later I found that ERROR:(17) is due to SPP repeated initialization, and I assume it is not a serious one. But I don't know what is ERROR:(1F).

I'm following this procedure: AT+INIT AT+IAC=9E8B33 AT+INIT AT+IAC=9E8B33 AT+CLASS=0 AT+INQM=1,9,48 AT+INQ
every command except AT+INIT and AT+INQ works fine. The document I referred is https://cdn.instructables.com/ORIG/FKY/Z0UT/HX7OYY7I/FKYZ0UTHX7OYY7I.pdf and ERROR code 1F is not mentioned here also. I tried with other websites, but I didn't got any solution.

I also tried with holding small button on my module (no KEY pin) and then passing AT+INQ, that also gave same error response. all other AT commands are working fine, and there is no issue in switching between master and slave mode.

firmware version: 3.0-20170601

if anyone faced same issue, or found any solution please help me..

Rakesh
  • 1
  • 3

1 Answers1

2

I have a HC-05 with 3.0-20170601 that I managed to bind to a slave last night. It turns out that the v3 has two AT-modes.

The first is when you hold the button while you connect power. The led will blink slowly and you can connect at 38400 baud. But this is like a configuration mode, where AT+INQ is not available.

In this mode I did these commands:

AT
AT+UART
AT+RMAAD
AT+ROLE=1

(Press and hold the button)

AT+RESET

(Release the button after device restarts and led is slowly blinking)

AT+CMODE=1
AT+INQM=0,5,5
AT+PSWD="9999"

AT should give OK as answer to know connection is working

AT+UART will show configured baudrate. Default is 9600.

AT+RMAAD clears all saved connections

AT+ROLE=1 sets it as master

AT+RESET restarts the device to change to master

AT+CMODE=1 accepts all kinds of devices

AT+INQM=0,5,5 inquires in standard mode, with 5 max connections or 5 secs

AT+PSWD="9999" sets the pin code 9999, change to the pin you need

After this it is time to update the arudino code. In your case you should update line 4 from

const long baudRate = 38400;

to

const long baudRate = 9600;

...or what ever value you might have set the baud rate to. Then reflash your arduino.

Now enter the very irritating second AT command mode.

Power up without holding the button. You will get the fast blink speed. When its powered up, press and hold the button. The led will continue blinking fast, but while the button is pressed you can now connect to the device on the configured baud rate. So open the serial monitor and type AT to verify. Remember that the mode is only active while the button is pressed. So keep it pressed. I had a small clamp I put on there.

Then I entered these commands:

AT+STATE

AT+STATE will show current state, should be inquiring

Then power up the slave device and the adress should start popping up. It will be something like xyz:xy:xyzw,931F00,7FFF

The first part is the address you want (xyz:xy:xyzw)

Change : to , and get xyz,xy,xyzw

Check that you connecting to the correct device

AT+RNAME?xyz,xy,xyzw

Then bind

AT+PAIR=xyz,xy,xyzw,5
AT+BIND=xyz,xy,xyzw
AT+LINK=xyz,xy,xyzw

The AT+LINK command gave me FAIL as output. But it did not matter. I restarted and did not press any button before or after. Just normal start.

After 5-10s serial data showed up in my serial monitor.

Modules are bound. And will automatically connect at power up. If not you might have the wrong pincode. Make sure to change 9999 above to 0000 or 1234 or what ever it may be. When I hade the wrong pin I still got OK from the AT+PAIR and AT+BIND commands... It didnt work for me until I entered the correct pin.

Sorry for long post, but I wanted to be thorough since info about HC-05 v3 is very scarce on the internet right now.

A reference to all commands can be found here: http://www.electronicaestudio.com/docs/istd016A.pdf (Link valid 2018-08-13)

NOTRICA
  • 21
  • 3