【问题标题】:avrdude: stk500_loadaddr protocol error Arduino uno GSM module SIM800L EVB on mac computeravrdude:stk500_loadaddr 协议错误 Arduino uno GSM 模块 SIM800L EVB 在 mac 计算机上
【发布时间】:2018-01-16 02:14:39
【问题描述】:

我在 mac 电脑上设置了 arduino IDE,并将 Arduino uno 与 GSM 模块 SIM800L EVB 一起使用

我使用以下代码块通过此模块发送短信。

#include <GSM.h>

#define PINNUMBER ""

// initialize the library instance
GSM gsmAccess; // include a 'true' parameter for debug enabled
GSM_SMS sms;

// char array of the telephone number to send SMS
// change the number 1-212-555-1212 to a number
// you have access to
char remoteNumber[20]= "12125551212";  

// char array of the message
char txtMsg[200]="Test";

void setup()
{
  // initialize serial communications
  Serial.begin(9600);

  Serial.println("SMS Messages Sender");

  // connection state
  boolean notConnected = true;

  // Start GSM shield
  // If your SIM has PIN, pass it as a parameter of begin() in quotes
  while(notConnected)
  {
    if(gsmAccess.begin(PINNUMBER)==GSM_READY)
      notConnected = false;
    else
    {
      Serial.println("Not connected");
      delay(1000);
    }
  }
  Serial.println("GSM initialized");
  sendSMS();
}

void loop()
{
// nothing to see here
}

void sendSMS(){

  Serial.print("Message to mobile number: ");
  Serial.println(remoteNumber);

  // sms text
  Serial.println("SENDING");
  Serial.println();
  Serial.println("Message:");
  Serial.println(txtMsg);

  // send the message
  sms.beginSMS(remoteNumber);
  sms.print(txtMsg);
  sms.endSMS(); 
  Serial.println("\nCOMPLETE!\n");  
}

当我尝试时,控制台上出现以下错误。考虑这是我第一次使用这项技术。并且不确定我是否必须设置任何驱动程序才能使用 GSM 模块。

avrdude: stk500_loadaddr(): (a) protocol error, expect=0x14, resp=0x00

avrdude: stk500_paged_load(): (a) protocol error, expect=0x14, resp=0x00
avrdude: stk500_cmd(): programmer is out of sync
avr_read(): error reading address 0x0000
    read operation not supported for memory "flash"
avrdude: failed to read all of flash memory, rc=-2
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x00

什么是错误?以及修复它的步骤是什么?

【问题讨论】:

标签: arduino gsm


【解决方案1】:

你有没有设法将任何草图上传到 arduino。首先尝试上传 Blink 示例草图。

如果失败,则说明连接有问题或配置错误。如果您使用的是标准 Arduino IDE,则有一个菜单项可以选择正确的板。如果你有错误的板,那么你会收到很多像这里这样的有线消息。

avrdude: stk500_loadaddr(): (a) protocol error, expect=0x14, resp=0x00

所以首先检查你有正确的板。

如果没问题,但您仍然无法加载,那么您可能损坏了引导加载程序。为上传草图的程序保留了一部分 arduino 内存。其他程序可能会覆盖此代码,从而使芯片变砖。它可以重新加载,但很棘手。

另一种可能是模块干扰了程序员。 Arduino 使用引脚 0 和 1 上传草图和串行通信,使用这些引脚连接模块可能会导致冲突。在QUICKSTART SIM800 (SIM800L) WITH ARDUINO 中,7 号和8 号引脚用于与GSM 模块的串行通信。

【讨论】:

  • 眨眼示例有效。选择板也做得很好。仅当我连接 GSM800L 模块时才会出现这种情况。
  • 你可以断开模块,加载草图,然后重新连接模块,看看它是否可以这样工作。看看这篇ayomaonline.com/programming/… 的帖子,模块上的电压水平似乎有点奇怪。可能连接板导致 atmega 芯片出现故障。还要避免使用引脚 1 和 2,因为它们可能会在上传草图时使用。
  • 您共享的链接工作正常。默认的 Arduino TX 和 RX 端口是问题所在。因为我没有看到比您发布的任何有效的解决方案。如果您相应地更改答案,我可以标记为已接受。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-08-24
  • 1970-01-01
  • 2018-08-11
  • 1970-01-01
  • 1970-01-01
  • 2022-06-18
  • 2022-07-23
相关资源
最近更新 更多