HM-10:可能有些AT命令没有实现?

时间:2017-01-10 08:21:58

标签: at-command hm-10 dspic

我正在开发一个项目,PIC dsPIC33通过串口连接到HM-10设备。 我发送到设备AT命令,但似乎有些AT命令没有在HM-10固件中实现。 详细说明:

AT+RESET - > OK+RESET       : it works
AT+RENEW  -> OK+RENEW       : it works
AT+NAME?  -> OK+NAME:HMSoft : it works
AT+VER?   -> no answer      : it doesn't work
AT+VERS   -> no answer      : it doesn't work
AT+NAMEaa -> no answer      : it doesn't work
你有类似的问题吗? 非常感谢您的帮助与合作 亲切的问候

2 个答案:

答案 0 :(得分:1)

查看datasheet。没有AT+VER?AT+VERS命令。它们是AT+VERR?AT+VERS?

我用HC-06进行了一些测试,有些命令需要CR,有些则没有。也许这也是你的问题?

我在Arduino草图中使用此代码来设置HC-06的BT设备名称:

// Enter AT command mode
if (enterATCommandMode() == true)
{
    // Set the name. As we don't have an end-of-line mark, we need to wait until the
    // timeout is reached and hope for the best. We also check whether the reply starts
    // with "OK", so have at least some indication things worked.
    hc06.print("AT+NAME" + userInput);
    String reply = hc06.readString();
    if (reply.equals(""))
    {
      Serial.println(F("HC-06 didn't reply in time!"));
    }
    else
    {
      if (reply.length() < 2 || !reply.substring(0,2).equalsIgnoreCase(F("OK")))
        Serial.println("Unexpected answer ('" + reply + "') to AT+NAME command!");
      else  
        Serial.println(F("Name was set successfully."));
    }
}


bool enterATCommandMode()
{
  // This buffer receives at most 2 characters as the reply (plus terminating \0)
  char atReplyBuffer[] = { '\0', '\0', '\0' };

  // Send AT command and receive answer
  hc06.print(F("AT"));
  int bytesRead = hc06.readBytesUntil('\0', atReplyBuffer, 2);
  String reply = String(atReplyBuffer);

  // Timed out or answer wasn't OK? Error.
  if (bytesRead != 2 || !reply.equalsIgnoreCase(F("OK")))
  {
    if (reply.equals(""))
      Serial.println(F("HC-06 didn't reply in time!"));
    else
      Serial.println("Unexpected reply ('" + reply + "') to AT command");

    return false;
  }

  // Success
  return true;
}

答案 1 :(得分:0)

命令发送必须没有任何暂停! (我想)。如果我使用以下代码:(假设send8char * x是写入串行端口的函数)

send("AT+NAME");
send("myName"); // id doesn't work

char name[20];     
strcpy(name,"AT+NAME");
strcat(name,"myName");
send(name); // if works!!