Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

bluetooth - 使用HC05 [STM32]连接到ELM327 BT(不像看起来那样简单)(Connecting to ELM327 BT with HC05 [STM32] (Not as simply as look like))

i would like to connect STM32F4 with ELM327 via bluetooth using HC-05.

(我想使用HC-05通过蓝牙将STM32F4与ELM327连接。)

I've got some specifc problem.

(我有一些特定的问题。)

Everytime when i try to use "AT+LINK", the HC-05 responds "FAIL".

(每当我尝试使用“ AT + LINK”时,HC-05都会响应“失败”。)

Hardware:

(硬件:)

  • STM32F411V + HC-05

    (STM32F411V + HC-05)

  • iCar2 Vgate elm327 BT v3.0

    (iCar2 Vgate elm327 BT v3.0)

I've already done:

(我已经做了:)

  1. I've tested ELM327 with commercial Apps, terminals etc. - it connected, and worked well.

    (我已经使用商业应用程序,终端等测试了ELM327-它已连接并且运行良好。)

  2. I've tested HC-05 - configured, worked very well with BT terminals

    (我已经测试了HC-05,并且与BT终端配合使用时效果很好)

  3. Tried to use diffrent configuration of AT Commands to get autoconnection between Elm327 and HC - everytime "FAIL".

    (试图使用AT命令的不同配置来获得Elm327和HC之间的自动连接-每次“失败”。)

This is part of code, which i used:

(这是我使用的代码的一部分:)

HAL_UART_Receive_IT(&huart2, BufforMsg, 1);

  HAL_Delay(10000);

  HAL_UART_Transmit(&huart2, (uint8_t *)"AT+ORGL
", strlen("AT+ORGL
"), 100); //HC-05:OK

  HAL_Delay(1000);

  HAL_UART_Transmit(&huart2, (uint8_t *)"AT+NAME=MASTER
", strlen("AT+NAME=MASTER
"), 100); //HC-05:OK

  HAL_Delay(1000);

  HAL_UART_Transmit(&huart2, (uint8_t *)"AT+UART=9600,1,0
", strlen("AT+UART=9600,1,0
"), 100); //HC-05:OK

  HAL_Delay(1000);

  HAL_UART_Transmit(&huart2, (uint8_t *)"AT+RESET
", strlen("AT+RESET
"), 100); //HC-05:OK

  HAL_Delay(1000);

  HAL_UART_Transmit(&huart2, (uint8_t *)"AT+ROLE=1
", strlen("AT+ROLE=1
"), 100); //HC-05:OK

  HAL_Delay(1000);

  HAL_UART_Transmit(&huart2, (uint8_t *)"AT+PSWD=1234
", strlen("AT+PSWD=1234
"), 100); //HC-05:OK

  HAL_Delay(1000);

  HAL_UART_Transmit(&huart2, (uint8_t *)"AT+INIT
", strlen("AT+INIT
"), 100); //HC-05:OK

  HAL_Delay(10000);

  HAL_UART_Transmit(&huart2, (uint8_t *)"AT+RMAAD
", strlen("AT+RMAAD
"), 100); //HC-05:OK

  HAL_Delay(1000);

  HAL_UART_Transmit(&huart2, (uint8_t *)"AT+PAIR=86DC,B0,ABF7F1,20
", strlen("AT+PAIR=86DC,B0,ABF7F1,20
"), 100); //HC-05:OK

  HAL_Delay(21000);

  HAL_UART_Transmit(&huart2, (uint8_t *)"AT+BIND=86DC,B0,ABF7F1
", strlen("AT+BIND=86DC,B0,ABF7F1
"), 100); //HC-05:OK

  HAL_Delay(3000);

  HAL_UART_Transmit(&huart2, (uint8_t *)"AT+LINK=86DC,B0,ABF7F1
", strlen("AT+LINK=86DC,B0,ABF7F1
"), 100); //HC-05:FAIL + INQ: Mac Address

  HAL_Delay(3000);

  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_1, 0 );

I've tried also diffrent configurations of these commands, but all the time the same -> FAIL.

(我也尝试过对这些命令进行不同的配置,但始终都是-> FAIL。)

Btw.

(顺便说一句。)

I know that i set buadrate 9600, but it doesnt matter in AT Commands mode.

(我知道我设置了Buadrate 9600,但是在AT Commands模式下没关系。)

The light on HC blinks very fast of 1s, then blinks slowly (as well as in connected mode) for 2s, but then blinks again very fast and then again slowly and over and over again.

(HC上的指示灯以1s的速度快速闪烁,然后缓慢闪烁(以及在连接模式下)2s,然后以非常快的速度再次闪烁,然后又缓慢又反复地闪烁。)

I guess the HC is trying to connect to the Elm all the time.

(我猜想HC一直都在尝试连接Elm。)

The mac address is correct - i used few MacAdress scanners and the address is similar everywhere.

(mac地址是正确的-我使用了很少的MacAdress扫描仪,并且到处都类似。)

The ELM327 require password every time when i connect to it (even if the device is paired with my smartphone).

(每当我连接到ELM327时(即使该设备已与我的智能手机配对),ELM327都需要输入密码。)

I read probably all topics on StakOVF and others sites.

(我可能在StakOVF和其他站点上阅读了所有主题。)

The solutions, which i found, didnt work.

(我发现的解决方案没有用。)

Has anyone idea, what's wrong?

(有谁知道,怎么了?)

  ask by HansAndDeep translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...