使用 MRK GSM 1400 访问 SIM 卡时出现问题

发布于 2025-01-13 08:14:58 字数 1349 浏览 0 评论 0原文

我昨天收到了全新的 Arduino MKR GSM 1400,今天开始使用。

但是,我在建立与 SIM 卡的连接时遇到问题。我正在使用 MKRGSM 库中的“ReceiveSMS”示例(代码如下),但执行在 gsmAccess.begin(PINNUMBER) 命令处陷入困境。

使用 AT 命令和调试模式,我得到了错误消息的以下描述:

AT+CPIN?
+CME ERROR: SIM not inserted

我尝试连接 3 个不同的 SIM 卡,所有这些都事先用智能手机进行了测试并确认可以正常工作。我已尝试删除 PIN,但仍然出现相同的错误。

有人知道可能出什么问题吗?

提前致谢

代码:

// include the GSM library
#include <MKRGSM.h>

#include "arduino_secrets.h" 
// Please enter your sensitive data in the Secret tab or arduino_secrets.h
// PIN Number
const char PINNUMBER[] = SECRET_PINNUMBER;

// initialize the library instances
GSM gsmAccess;
GSM_SMS sms;

// Array to hold the number a SMS is retreived from
char senderNumber[20];

void setup() {
  // initialize serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  Serial.println("SMS Messages Receiver");

  // connection state
  bool connected = false;

  // Start GSM connection
  while (!connected) {
    if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
      connected = true;
    } else {
      Serial.println("Not connected");
      delay(1000);
    }
  }

  Serial.println("GSM initialized");
  Serial.println("Waiting for messages");
}

I received yesterday my brand new Arduino MKR GSM 1400 and started playing around with today.

However, I'm having trouble stablishing the connection with the SIM card. I'm using the "ReceiveSMS" example from the MKRGSM library (code below), but the execution is getting stuck at the gsmAccess.begin(PINNUMBER) command.

Using AT commands and the debug mode, I got the following description for the error message:

AT+CPIN?
+CME ERROR: SIM not inserted

I have tried connecting with 3 different SIM cards, all tested beforehand with a smartphone and confirmed to be functional. I have tried removing the PIN, but still got the same error.

Does anybody have any idea on what could be going wrong?

Thanks in advance

Code:

// include the GSM library
#include <MKRGSM.h>

#include "arduino_secrets.h" 
// Please enter your sensitive data in the Secret tab or arduino_secrets.h
// PIN Number
const char PINNUMBER[] = SECRET_PINNUMBER;

// initialize the library instances
GSM gsmAccess;
GSM_SMS sms;

// Array to hold the number a SMS is retreived from
char senderNumber[20];

void setup() {
  // initialize serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  Serial.println("SMS Messages Receiver");

  // connection state
  bool connected = false;

  // Start GSM connection
  while (!connected) {
    if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
      connected = true;
    } else {
      Serial.println("Not connected");
      delay(1000);
    }
  }

  Serial.println("GSM initialized");
  Serial.println("Waiting for messages");
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文