I am trying to interface with a no-name brand BT device running the "BC417" Chip (HC-05). The board says "SH_BT_BOARD V1.3" on it and I have the following pins connected as so:
I can send the command "AT" to the BT module and get a response of "OK" but any other command I try to send I get back "ERROR:(0)" which means 'AT command error'
Example:
I sent "AT" "AT+VERSION?" "AT+RESET" "AT+ADDR?"
It's a while since I last played with these BT modules but I seem to remember I had to alter/remove the default (CR+LF) line termination in the serial monitor as it read the character and rejected it with an error.
Riva:
It's a while since I last played with these BT modules but I seem to remember I had to alter/remove the default (CR+LF) line termination in the serial monitor as it read the character and rejected it with an error.
So you are saying when sending the other commands they do not use (CR+LF) ending, and it's only used for "AT"?
Helicopter12:
So you are saying when sending the other commands they do not use (CR+LF) ending, and it's only used for "AT"?
It's been a long while since I played with the HC-05 & HC-06 and all I remember is one did not need line termination characters (it would error if they were present) and commands needed entering within 1 second so could not be typed and had to be pasted from clipboard but the other one did need line termination.
Another thing to try is pulling the BT command mode enable pin high using a wire instead of via an Arduino pin as the module needs the pin high on power up to enter command mode and by the time the Arduino has reached setup() to set the pin to output and high the BT module will probably already have booted into user mode.
Riva:
Another thing to try is pulling the BT command mode enable pin high using a wire instead of via an Arduino pin as the module needs the pin high on power up to enter command mode and by the time the Arduino has reached setup() to set the pin to output and high the BT module will probably already have booted into user mode.
I have the VCC pin and EN pin of the BT board connected to pin 2 and A5 on the Arduino, respectively. This way I am giving power to the EN pin before the VCC pin even when the Arduino resets. I know for a fact its in AT mode since the status light on the BT board flashes slowly as it is supposed to.
What command do you have to paste? - I don't understand how pasting a command would work and typing it wouldn't?
Helicopter12:
What command do you have to paste? - I don't understand how pasting a command would work and typing it wouldn't?
I dug out the datasheet I have and although it may or may not be applicable to your device the text is posted below.
It is important to note that EGBT-046S does not
wait for any termination character for each AT com-
mand entry. Instead, it acts to whatever character
you entered after one second. Hence, if you are not
able to complete a command entry within a second,
it will be ignored. Because of this behavior, it may
be extremely difficult to do manual entry configura-
tion using Windows Hyperterminal software. Termi-
nal software that allows batch sending of multiple
characters must be used.
It also does not support the full AT command set, just AT + BAUD + NAME + PIN
Further on the text for the EGBT-045MS says...
Important note: All commands must be terminated
by . If the host controller send a
only, EGBT-045MS will repeatedly send a respond
that will stop only when is issued by the host
controller
The error code implies the command is invalid.
ERROR CODES
0 Command Error/Invalid Command
1 Results in default value
2 PSKEY write error
3 Device name is too long (>32 characters)
4 No device name specified (0 lenght)
5 Bluetooth address NAP is too long
6 Bluetooth address UAP is too long
7 Bluetooth address LAP is too long
8 PIO map not specified (0 lenght)
9 Invalid PIO port Number entered
A Device Class not specified (0 lenght)
B Device Class too long
C Inquire Access Code not Specified (0 lenght)
D Inquire Access Code too long
E Invalid Iquire Access Code entered
F Pairing Password not specified (0 lenght)
10 Pairing Password too long (> 16 characters)
11 Invalid Role entered
12 Invalid Baud Rate entered
13 Invalid Stop Bit entered
14 Invalid Parity Bit entered
15 No device in the Pairing List
16 SPP not initialized
17 SPP already initialized
18 Invalid Inquiry Mode
19 Inquiry Timeout occured
1A Invalid/zero lenght address entered
1B Invalid Security Mode entered
1C Invalid Encryption Mode entered
Riva:
I dug out the datasheet I have and although it may or may not be applicable to your device the text is posted below.It also does not support the full AT command set, just AT + BAUD + NAME + PIN
Further on the text for the EGBT-045MS says...
The error code implies the command is invalid.
Thanks for the info Riva. I found something online that said:
"I had to make sure I slowed the Arduino console baud rate down as well else the terminal would send characters faster than could be parsed. This was causing “ERROR:(0)” to be echoed because letters were being dropped."
I dropped the baud rate for the arduino serial monitor down to 9600 to match the baud rate of the BT module at I was able to send commands other than just "AT".