Unicode 错误,SIM7080G 通过 Pico 和 Micropython 执行 AT 命令

问题描述 投票:0回答:1

我是一个相对新手,尝试在 Pico 上使用 SIMCOM1080G 模块制作物联网设备。

我可以使用 shell 向模块发送 AT 命令,但是当尝试使用模块制造商提供的代码时,我得到以下信息

Traceback (most recent call last):
  File "<stdin>", line 124, in <module>
  File "<stdin>", line 69, in check_start
  File "<stdin>", line 34, in send_at
UnicodeError: 

那是发送AT指令的模块:

def send_at(cmd, back, timeout=1000):
    rec_buff = b''
    Pico_SIM7080G.write((cmd + '\r\n').encode())
    prvmills = utime.ticks_ms()
    while (utime.ticks_ms() - prvmills) < timeout:
        if Pico_SIM7080G.any():
            rec_buff = b"".join([rec_buff, Pico_SIM7080G.read(1)])
    if rec_buff != '':
        if back not in rec_buff.decode():
            print(cmd + ' back:\t' + rec_buff.decode())
            return 0
        else:
            print(rec_buff.decode())
            return 1
    else:
        print(cmd + ' no responce')

34号线是

if back not in rec_buff.decode():

有什么建议吗?谢谢。

iot micropython raspberry-pi-pico
1个回答
0
投票

对于任何未来的答案猎人:将设备放入法拉第笼中可显着减少所计数的 UnicodeError 数量。它并没有完全阻止他们,但确实帮助了很多。所以我猜这个模块做工不是很好,而且对干扰非常敏感。

我花越多时间尝试让这个板发挥作用,我就越不希望购买它。 Waveshare 的文档和支持不存在。把你的钱带到别处去。

© www.soinside.com 2019 - 2024. All rights reserved.