echo AT指令 调试ttyUSB

通过 echo 给 ttyUSBx 发送 AT 指令 调试 SIM7100CE 4G 模块

项目特性

4G模块上电
echo 0 > /sys/class/leds/gprs_power/brightness

4G模块断电
echo 1 > /sys/class/leds/gprs_power/brightness

我们的项目中 ttyUSB0 和 ttyUSB1被RS232的后面两个口占了,所以4G模块是从 ttyUSB2-ttyUSB7

模块属性

root@myd-am335x dev# echo 0 > /sys/class/leds/gprs_power/brightness
root@myd-am335x dev# [  286.573959] usb 1-1.2: new high-speed USB device number 5 using musb-hdrc
[  286.694987] usb 1-1.2: New USB device found, idVendor=1e0e, idProduct=9001
[  286.702212] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  286.710215] usb 1-1.2: Product: SimTech, Incorporated
[  286.715565] usb 1-1.2: Manufacturer: SimTech, Incorporated
[  286.721713] usb 1-1.2: SerialNumber: 0123456789ABCDEF
[  286.729759] GobiSerial 1-1.2:1.0: GobiSerial converter detected
[  286.749544] usb 1-1.2: GobiSerial converter now attached to ttyUSB2
[  286.771079] GobiSerial 1-1.2:1.1: GobiSerial converter detected
[  286.784996] usb 1-1.2: GobiSerial converter now attached to ttyUSB3
[  286.805922] GobiSerial 1-1.2:1.2: GobiSerial converter detected
[  286.819512] usb 1-1.2: GobiSerial converter now attached to ttyUSB4
[  286.840863] GobiSerial 1-1.2:1.3: GobiSerial converter detected
[  286.853895] usb 1-1.2: GobiSerial converter now attached to ttyUSB5
[  286.881234] GobiSerial 1-1.2:1.4: GobiSerial converter detected
[  286.888345] usb 1-1.2: GobiSerial converter now attached to ttyUSB6
[  286.920272] GobiSerial 1-1.2:1.6: GobiSerial converter detected
[  286.929662] usb 1-1.2: GobiSerial converter now attached to ttyUSB7
Interface number 接口类型 功能
ttyUSB2 USB serial Diagnostic Interface
ttyUSB3 USB serial GPS NMEA Interface
ttyUSB4 USB serial AT port Interface
ttyUSB5 USB serial Modem port Interface (ppp 拨号)
ttyUSB6 USB serial USB Audio Interface
ttyUSB7 USB RMNet wwan interface

模块功能

可以通过 ttyUSB5 去 pppd 拨号
可以通过 ttyUSB4 给模块发送 AT指令,目前可以实现如下:

  1. 通过AT指令 获取信号质量
  2. 通过AT指令,开启GPS功能

使能模块GPS功能

准备:ARM的调试串口打开com,ssh连接ARM登录
在com调试串口操作

  1. 给 4G模块上电
  2. 等待 ttyUSBx出现

在SSH连接的终端操作
3. cat /dev/ttyUSB3

root@myd-am335x ~# cat /dev/ttyUSB3 

在com调试串口操作
4. echo -en “AT+CGPS=1\r\n” > /dev/ttyUSB4

root@myd-am335x ~#  echo -en "AT+CGPS=1\r\n" > /dev/ttyUSB4
  1. 在SSH连接的终端观察 ttyUSB3 会有GPS数据自动吐出来,如下所示

$GPGGA,031734.0,3411.816517,N,10851.306555,E,1,05,2.4,430.0,M,-28.0,M,,*7B

......

$GPRMC,031734.0,A,3411.816517,N,10851.306555,E,0.0,153.6,201000,0.0,E,A*03

......

备注:经纬度正确,时分秒正确,日月年还不对,应该还需要发AT指令配置

如果想上电自启动 GPS,可以使用如下命令
echo -en “AT+CGPSAUTO=1\r\n” > /dev/ttyUSB4

设置本地时区 +32 是北京时区
echo -en “AT+CCLK=“20/06/09,11:19:00+32”\r\n” > /dev/ttyUSB4
设置提示 OK了, 但是查看时间的时候还是不对,为啥呢?

你可能感兴趣的:(linux,嵌入式,linux,嵌入式)