【问题标题】:Sim900 Won't Find NetworksSim900 找不到网络
【发布时间】:2018-01-13 07:35:39
【问题描述】:

我有一台来自Sainsmart 的 Sim900。我有一个从树莓派到 Sim900 的有效串行连接。我可以编写命令、接收响应,甚至可以从 SIM 卡中查询我的电话号码等数据。我的 SIM 卡是 AT&T 卡。我无法让 Sim900 找到网络并尝试连接。据说,它应该自己做,但我也没有看到。我能想到的唯一两件事是固件错误,或者芯片没有获得足够的电力。固件(来自 AT+CGMR)是 Revision:1137B06SIM900M64_ST_ENHANCE。这似乎是您可以从Simcom's Site 获得的最新固件。至于电源,我很确定电源足够,因为我买了充电器 USB 电缆和适配器,其中电缆随附的适配器承诺支持 2 安培。我剥掉了电缆,给了它一个 3 安培的电源。当我尝试连接时,芯片也不会随机重置。我可以设置掉电丢失的设置,但只有在我拔下芯片重置设置时它们才会消失。

以下输出来自我最近的测试,试图了解为什么我无法发送短信。

----------------------------------------------------------------------------------------
Command: "b'AT\r\n\r\n'" Response: "AT


OK
"
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
Command: "b'AT+CMEE=2\r\n'" Response: "AT+CMEE=2

OK
"
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
Command: "b'AT+CFUN?\r\n'" Response: "AT+CFUN?

+CFUN: 1

OK
"
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
Command: "b'AT+CREG=2\r\n'" Response: "AT+CREG=2

OK
"
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
Command: "b'AT+CREG?\r\n'" Response: "AT+CREG?

+CREG: 2,0

OK
"
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
Command: "b'AT+COPS?\r\n'" Response: "AT+COPS?

+COPS: 0

OK
"
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
Command: "b'AT+QBAND?\r\n'" Response: "AT+QBAND?

ERROR
"
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
Command: "b'AT+CSQ\r\n'" Response: "AT+CSQ

+CSQ: 20,0

OK
"
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
Command: "b'AT+QENG?\r\n'" Response: "AT+QENG?

ERROR
"
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
Command: "b'AT+CIMI\r\n'" Response: "AT+CIMI

310REDACTED

OK
"
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
Command: "b'AT+CNUM\r\n'" Response: "AT+CNUM

+CNUM: "","1678REDACTED",129,7,4

OK
"
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
Command: "b'AT+CMGF=1\r\n'" Response: "AT+CMGF=1

OK
"
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
Command: "b'AT+CSCS=?\r\n'" Response: "AT+CSCS=?

+CSCS: ("IRA","GSM","UCS2","HEX","PCCP","PCDN","8859-1")

OK
"
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
Command: "b'AT+CSCS="GSM"\r\n'" Response: "AT+CSCS="GSM"

OK
"
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
Command: "b'AT+CREG?\r\n'" Response: "AT+CREG?

+CREG: 2,0

OK
"
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
Command: "b'AT+CMGS="978REDACTED"\r'" Response: "AT+CMGS="978REDACTED"

> "
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
Command: "b'Pi\x1a'" Response: "Pi
+CMS ERROR: operation not allowed
"
----------------------------------------------------------------------------------------

生成此输出的 Python3 脚本如下:

import serial
import time
import binascii

ser = serial.Serial(port='/dev/serial0',baudrate=9600,timeout=1)

command = bytes("AT" + '\r\n', 'utf-8') + binascii.a2b_hex('0D0A')
ser.write(command)
rcv = ser.read(1000)
print("----------------------------------------------------------------------------------------")
print("Command: \"%s\" Response: \"%s\"" % (command, rcv.decode()))
print("----------------------------------------------------------------------------------------")
time.sleep(1)

command = bytes('AT+CMEE=2'+'\r\n', 'utf-8')
ser.write(command)
rcv = ser.read(1000)
print("----------------------------------------------------------------------------------------")
print("Command: \"%s\" Response: \"%s\"" % (command, rcv.decode()))
print("----------------------------------------------------------------------------------------")
time.sleep(1)

#ser.write(bytes("ATE0" + '\r\n', 'utf-8')) # Reverse it with ATE
#rcv = ser.read(1000)
#print(rcv)
#time.sleep(1)

command = bytes('AT+CFUN?'+'\r\n', 'utf-8')
ser.write(command)
rcv = ser.read(1000)
print("----------------------------------------------------------------------------------------")
print("Command: \"%s\" Response: \"%s\"" % (command, rcv.decode()))
print("----------------------------------------------------------------------------------------")
time.sleep(1)

command = bytes('AT+CREG=2'+'\r\n', 'utf-8') # What does 2 do?
ser.write(command)
rcv = ser.read(1000)
print("----------------------------------------------------------------------------------------")
print("Command: \"%s\" Response: \"%s\"" % (command, rcv.decode()))
print("----------------------------------------------------------------------------------------")
time.sleep(1)

command = bytes('AT+CREG?'+'\r\n', 'utf-8')
ser.write(command)
rcv = ser.read(1000)
print("----------------------------------------------------------------------------------------")
print("Command: \"%s\" Response: \"%s\"" % (command, rcv.decode()))
print("----------------------------------------------------------------------------------------")
time.sleep(1)

#command = bytes('AT+COPS=?'+'\r\n', 'utf-8')
#ser.write(command)
#rcv = ser.read(1000)
#print("----------------------------------------------------------------------------------------")
#print("Command: \"%s\" Response: \"%s\"" % (command, rcv.decode()))
#print("----------------------------------------------------------------------------------------")
#time.sleep(10)

command = bytes('AT+COPS?'+'\r\n', 'utf-8')
ser.write(command)
rcv = ser.read(1000)
print("----------------------------------------------------------------------------------------")
print("Command: \"%s\" Response: \"%s\"" % (command, rcv.decode()))
print("----------------------------------------------------------------------------------------")
time.sleep(1)

#ser.write(bytes('AT+COPS=0'+'\r\n', 'utf-8'))
#rcv = ser.read(1000)
#print("\"%s\"" % rcv.decode())
#time.sleep(1)

command = bytes('AT+QBAND?'+'\r\n', 'utf-8')
ser.write(command)
rcv = ser.read(1000)
print("----------------------------------------------------------------------------------------")
print("Command: \"%s\" Response: \"%s\"" % (command, rcv.decode()))
print("----------------------------------------------------------------------------------------")
time.sleep(1)

command = bytes('AT+CSQ'+'\r\n', 'utf-8')
ser.write(command)
rcv = ser.read(1000)
print("----------------------------------------------------------------------------------------")
print("Command: \"%s\" Response: \"%s\"" % (command, rcv.decode()))
print("----------------------------------------------------------------------------------------")
time.sleep(1)

command = bytes('AT+QENG?'+'\r\n', 'utf-8')
ser.write(command)
rcv = ser.read(1000)
print("----------------------------------------------------------------------------------------")
print("Command: \"%s\" Response: \"%s\"" % (command, rcv.decode()))
print("----------------------------------------------------------------------------------------")
time.sleep(1)

command = bytes('AT+CIMI'+'\r\n', 'utf-8')
ser.write(command)
rcv = ser.read(1000)
print("----------------------------------------------------------------------------------------")
print("Command: \"%s\" Response: \"%s\"" % (command, rcv.decode()))
print("----------------------------------------------------------------------------------------")
time.sleep(1)

command = bytes('AT+CNUM'+'\r\n', 'utf-8')
ser.write(command)
rcv = ser.read(1000)
print("----------------------------------------------------------------------------------------")
print("Command: \"%s\" Response: \"%s\"" % (command, rcv.decode()))
print("----------------------------------------------------------------------------------------")
time.sleep(1)

#ser.write(bytes('AT+CNMI=2,1,0,0,0'+'\r\n', 'utf-8'))
#rcv = ser.read(1000)
#print(rcv)
#time.sleep(1)

# TEXTING

command = bytes('AT+CMGF=1'+'\r\n', 'utf-8') # Select Message format as Text mode 
ser.write(command) 
rcv = ser.read(1000)
print("----------------------------------------------------------------------------------------")
print("Command: \"%s\" Response: \"%s\"" % (command, rcv.decode()))
print("----------------------------------------------------------------------------------------")
time.sleep(1)

command = bytes('AT+CSCS=?'+'\r\n', 'utf-8') # Possible Value: GSM
ser.write(command) 
rcv = ser.read(1000)
print("----------------------------------------------------------------------------------------")
print("Command: \"%s\" Response: \"%s\"" % (command, rcv.decode()))
print("----------------------------------------------------------------------------------------")
time.sleep(1)

command = bytes('AT+CSCS="GSM"'+'\r\n', 'utf-8') # Possible Value: (8859-1/latin-1)
ser.write(command)
rcv = ser.read(1000)
print("----------------------------------------------------------------------------------------")
print("Command: \"%s\" Response: \"%s\"" % (command, rcv.decode()))
print("----------------------------------------------------------------------------------------")
time.sleep(1)

command = bytes('AT+CREG?'+'\r\n', 'utf-8')
ser.write(command)
rcv = ser.read(1000)
print("----------------------------------------------------------------------------------------")
print("Command: \"%s\" Response: \"%s\"" % (command, rcv.decode()))
print("----------------------------------------------------------------------------------------")
time.sleep(1)

command = bytes('AT+CMGS="978REDACTED"', 'utf-8') + binascii.a2b_hex('0D') # 0D is CR
ser.write(command)
rcv = ser.read(1000)
print("----------------------------------------------------------------------------------------")
print("Command: \"%s\" Response: \"%s\"" % (command, rcv.decode()))
print("----------------------------------------------------------------------------------------")
time.sleep(5)

command = bytes("Pi",'utf-8') + binascii.a2b_hex('1A')
ser.write(command)
rcv = ser.read(1000)
print("----------------------------------------------------------------------------------------")
print("Command: \"%s\" Response: \"%s\"" % (command, rcv.decode()))
print("----------------------------------------------------------------------------------------")
time.sleep(5)

#ser.write(binascii.a2b_hex('0D0A')) # 0D is CR
#rcv = ser.read(1000)
#print("\"%s\"" % rcv.decode())

此外,在 minicom 中运行时也会出现同样的问题。这不是 Python 特定的问题。虽然显示来自 AT 命令“AT+COPS=?”的数据存在问题在 Python 中。但是,显示错误是另一天的问题,因为我仍然可以在 minicom 中阅读它。

编辑:澄清问题

基本上,我想知道为什么我不能发送短信以及如何解决它!我确信这与未在任何网络上注册有关,但在运行“AT+COPS=?”时没有显示可连接的网络。列出任何潜在的原因表示赞赏。如果需要,我可以做一些事情,比如给我的设置拍照。

编辑:提供一些关于“AT+COPS=?”的见解

使用 Minicom,我得到以下结果,“AT+COPS=?”。我无法在 Python 3 中测试此命令,因为它使来自自身的反馈和所有其他未来命令为空,如在空引号中(例如“”)。即使启用 CMEE 以提供详细文本也是一个问题。当我重置 Python 程序时,它会被重置。

AT+COPS=?
+COPS: (1,"Off Network","","310260"),,(0,1,4),(0,1,2)

OK

无论我将 CREG 设置为什么,每次运行命令时都会得到上述结果。

链接: Amazon Page Where I Bought Sim900

【问题讨论】:

  • sim能在智能手机上使用吗?
  • 是的,它可以工作,也没有别针。
  • 如果到 20 号我们还不能弄清楚这是什么问题,那么我将使用不同的 sim 卡进行测试。我应该在那个日期之前从 Google 获得我的 Project Fi sim 并且邮局在下周一之前开放,所以我可以看看它是否有 AT&T 的问题。鉴于此,固件问题中链接的 SimCom 页面显示 AT&T 是受支持的运营商。我想我们会发现的。
  • 你可能想在raspberrypi.stackexchange.com上问这个问题。
  • 不!不!不!你应该never, never, never, never, never, never, never, never, never, never, ever use time.sleep like that。您必须读取解析调制解调器返回的响应,否则您将abort 命令。

标签: python networking at-command sim900


【解决方案1】:

事实证明,我的代码或硬件都没有问题。这是我的网络提供商 AT&T 的问题。现在,我知道他们摆脱了 2G,但我没有意识到这也意味着电话和短信。因为我忘记了电话和短信不是在他们自己单独的协议上。由于我是在手机上输入的,所以我将使用屏幕截图来说明我的意思。

这是网络子模式的列表。我的手机通常是 LTE 数据的首选。我的 GSM 芯片使用第二种选择,显然是 GSM。由于我仍然支持AT&T's LTE network provides 的频段,我也许可以将较慢的 LTE 连接组合在一起。我只需要看看破解固件有多可行。

这是我的 LTE 网络列表在扫描时的样子(本质上是 AT+COPS=?):

这与我的 GSM 芯片看到的输出相同。这与 GSM 选项有关。选择关闭网络选项时,我无法呼叫任何人。

鉴于此,我要么需要找到支持 GSM 的运营商,将固件组合在一起以支持慢速 LTE,要么砍掉我的手臂并在黑市上出售以换取昂贵的 LTE 芯片。

【讨论】:

  • 所有的 AT 命令都应该是 LTE 兼容的(其中一些在<AcT> 注册网络的接入技术参数中有明显的痕迹)。当然,网络可能配置了不同的支持,但不支持 SMS 消息似乎很奇怪。
猜你喜欢
  • 1970-01-01
  • 2014-02-22
  • 2013-05-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多