Jacktang 发表于 2020-4-15 07:18

物联网4G通讯模块开发的问题

<p><span style="font-size:16px;">&nbsp; &nbsp;&nbsp; 在万物互联的物联网时代,物与物之间的连接主要是通过网络进行,网络之间既可以通过网线载体连接也可以通过4G、WIFY等进行无线连接,在无线远距离通讯中目前主要采用的就是4G技术。4G模块是连接物与物的重要载体,是终端设备接入互联网的核心部件,许多新兴市场对4G通信模块的需求都在日益扩大,4G通信模块把频率接收器和信号增幅器等部件全都整合在一起,实现了一体化。</span></p>

<p><span style="font-size:16px;">  4G模块用的是龙尚4G模块U9300C,该模块带有串口和USB口,所以向linux内核添加3G模块的驱动(USB转串口驱动)和PPP协议的支持,然后编译内核并下载到开发板。主要是包括两部分Linux驱动层的支持和模块启停脚本调试。</span></p>

<p><span style="font-size:16px;">第一部分 应用层4G通讯</span></p>

<p><span style="font-size:16px;">4G通讯主要是采用AT指令进行,AT 指令的格式如下<br />
  1) 每个 AT 指令行以 AT 字符开头(注:部分以&ldquo;+&rdquo;开头),以&lt;CR&gt;作为结束;<br />
  2) 每个指令行可以有多个指令组成,相互之间以&ldquo;;&rdquo;隔开;<br />
  3) 标准 AT 指令符合 GSM Rec. 07.07、 07.05、 3GPP TS 27.005、 27.007 和 ITU-T Rec. V25ter标准;<br />
  4) 每个扩展指令都提供了一个测试指令,以检测该指令是否存在及参数的类型或范围;<br />
  5) 带参数的指令一般都提供了一个读取指令以读取参数的当前值;<br />
  6) 设置指令用来设置参数及完成相应的功能。</span></p>

<p><span style="font-size:16px;">下图为 U9300C AT 指令指令行的结构:<br />
  AT CMD1 &nbsp;CMD2=12; +CMD1 &nbsp;; +CMD2=,, 15; +CMD2?; +CMD2=? &nbsp;&lt;CR&gt;<br />
  1 &nbsp; &nbsp; &nbsp; &nbsp;2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 3 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;4 &nbsp; &nbsp; &nbsp;5 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 6 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 7 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 8 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 9</span></p>

<p><span style="font-size:16px;">  1:指令前缀;<br />
  2:基本指令;<br />
  3:辅助参数;<br />
  4:扩展指令(前缀是&ldquo;+&rdquo;);<br />
  5:扩展指令分解;<br />
  6:辅助参数,可被忽略不写;<br />
  7:读指令,核对当前的辅助参数值;<br />
  8:测试指令,可获取参数的类型和范围;<br />
  9:指令终止符。</span></p>

<p><span style="font-size:16px;">第二部分 驱动层配置</span></p>

<p><span style="font-size:16px;">主要是配置内核并向内核添加4G驱动模块<br />
参考 https://www.cnblogs.com/aaronLinux/p/7159660.html</span></p>

<p><span style="font-size:16px;">第三部分 关于AT模块通讯问题有以下注意点</span></p>

<p><span style="font-size:16px;">问题描述:模块无法连接上MQTT,分析发送的连接数据也对。对应第5条,少做一步。 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(1)拿到模块之后网上找点相关AT指令例程,主要是查看AT指令格式。 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(2)电脑端通过网络调试助手开通一个服务端,可以使用花生壳进行IP映射。 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(3)串口小板直接连接模块,通过串口发送AT指令(一般命令后面有\r\n),观察模块返回数据信息以及是否可以连接上网络调试助手的服务端。 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span></p>

<p><span style="font-size:16px;">(4)连接成功之后,并且可以发送数据,网络调试助手能收到模块发送的数据,表明模块通过串口已经走通了。 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span></p>

<p><span style="font-size:16px;">(5)透传,根据上面AT指令的流程在单片机中编写程序,通过两个串口小板读取模块接收和发送的数据。先用单片机通过模块给电脑端的网络调试助手发送数据,电脑端的服务端连接上模块并且可以接收模块数据,这样才能表明数据AT指令没有问题(这里是一个坑,今天踩进去了)。 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span></p>

<p><span style="font-size:16px;">&nbsp;(6)用单片机通过模块连接MQTT服务器,并观察MQTT连接情况。</span></p>

蓝先生 发表于 2020-4-15 09:38

<p>龙尚有点跟不上了,爱陆通有做成的成品了解一下</p>

alan000345 发表于 2020-4-15 15:40

<p>5G和4G以后是并存的关系,4G资料也很重要啊,谢谢分享。</p>

蓝先生 发表于 2020-4-16 09:15

alan000345 发表于 2020-4-15 15:40
5G和4G以后是并存的关系,4G资料也很重要啊,谢谢分享。

<p>应该就像现在的4G和2G吧</p>

胖子峰 发表于 2024-10-29 14:38

<p>提供4G+Lora+wifi+BT功能模块,13510319685</p>
页: [1]
查看完整版本: 物联网4G通讯模块开发的问题