一.开箱以及硬件准备





二.前情提要
这次是买了两块板子,算撸羊毛。主要应用于4g语音传输。因为之前的2G传输语音实时体验欠佳。大概体验是这样的:
设备一语音发送端:按键按下录音------>松开按键传输,假设录音10秒.设备二接收到大概也要等待到第10秒才能接收到。这是设备对设备。当时做了一个桌面的软件发语音给设备还是能快一点点的
结论:2G上传速度太慢。大约1秒1k?
后来寻找解决方案:
方案一:stm32l4或者stm32F4+wm8978+air720+tencentos tiny+SPEEX。
选型的考量:

通过串口进行数据的传递。air202F主要产生语音数据以及播放进入的语音数据。air168好像也行。air720主要进行通信。这个方案很靠谱。成品报价给当时觉得还行。但是提出要实时语音。
方案三:ESP32加ES8388+AIR720

多说一句:rk3308的板我买的是百度的大金刚的拆机玩意,9.9一个。试了下硬件没问题。关机进入maskrom也正常。刷写引导文件也正常。但是无法刷入后续文件。有知道这个得大牛可以说说。这个还是等待后续再解决,俺解决了就再来说。这就是上述俺为什么买两块开发板的理由,希望没抢到的大兄弟能理解。
三.进入正题:air724UG
一.首先还是说句总结的话:
二.开始:

1.硬件文档下载链接:
图片来源:合宙官网。具体链接无法复制
http://www.openluat.com/Product/file/uis8910dm/sw_file_20200303181718_8910_module_usb_driver










–加载日志功能模块,并且设置日志输出等级
–如果关闭调用log模块接口输出的日志,等级设置为log.LOG_SILENT即可
require “log”
LOG_LEVEL = log.LOGLEVEL_TRACE
–[[
如果使用UART输出日志,打开这行注释的代码”–log.openTrace(true,1,115200)”即可,根据自己的需求修改此接口的参数
如果要彻底关闭脚本中的输出日志(包括调用log模块接口和Lua标准print接口输出的日志),执行log.openTrace(false,第二个参数跟调用openTrace接口打开日志的第二个参数相同),例如:
1、没有调用过sys.opntrace配置日志输出端口或者最后一次是调用log.openTrace(true,nil,921600)配置日志输出端口,此时要关闭输出日志,直接调用log.openTrace(false)即可
2、最后一次是调用log.openTrace(true,1,115200)配置日志输出端口,此时要关闭输出日志,直接调用log.openTrace(false,1)即可
]]
–log.openTrace(true,1,115200)
require “sys”
require “net”
–每1分钟查询一次GSM信号强度
–每1分钟查询一次基站信息
net.startQueryAll(60000, 60000)
–加载控制台调试功能模块(此处代码配置的是uart2,波特率115200)
–此功能模块不是必须的,根据项目需求决定是否加载
–使用时注意:控制台使用的uart不要和其他功能使用的uart冲突
–使用说明参考demo/console下的《console功能使用说明.docx》
–require “console”
–console.setup(2, 115200)
–加载网络指示灯和LTE指示灯功能模块
–根据自己的项目需求和硬件配置决定:1、是否加载此功能模块;2、配置指示灯引脚
–合宙官方出售的Air720开发板上的网络指示灯引脚为pio.P2_0,LTE指示灯引脚为pio.P2_1
–require “netLed”
–netLed.setup(true,pio.P2_0,pio.P2_1)
–网络指示灯功能模块中,默认配置了各种工作状态下指示灯的闪烁规律,参考netLed.lua中ledBlinkTime配置的默认值
–如果默认值满足不了需求,此处调用netLed.updateBlinkTime去配置闪烁时长
–LTE指示灯功能模块中,配置的是注册上4G网络,灯就常亮,其余任何状态灯都会熄灭
–加载错误日志管理功能模块【强烈建议打开此功能】
–如下2行代码,只是简单的演示如何使用errDump功能,详情参考errDump的api
require “errDump”
errDump.request(“udp://ota.airm2m.com:9072”)
–加载远程升级功能模块【强烈建议打开此功能,如果使用了阿里云的OTA功能,可以不打开此功能】
–如下3行代码,只是简单的演示如何使用update功能,详情参考update的api以及demo/update
–PRODUCT_KEY = “v32xEAKsGTIEQxtqgwCldp5aPlcnPs3K”
–require “update”
–update.request()
–加载HTTP功能测试模块
require “testHttp”
–启动系统框架
sys.init(0, 0)
sys.run()
– @author openLuat
– @module http.testHttp
– @license MIT
– @copyright openLuat
– @release 2018.03.23
module(…,package.seeall)
require”http”
local function cbFnc(result,prompt,head,body)
log.info(“testHttp.cbFnc”,result,prompt)
if result and head then
for k,v in pairs(head) do
log.info(“testHttp.cbFnc”,k..”: “..v)
end
end
if result and body then
log.info(“testHttp.cbFnc”,”bodyLen=”..body:len())
end
end
local function cbFncFile(result,prompt,head,filePath)
log.info(“testHttp.cbFncFile”,result,prompt,filePath)
if result and head then
for k,v in pairs(head) do
log.info(“testHttp.cbFncFile”,k..”: “..v)
end
end
if result and filePath then
log.info(“stop”,os.time())
local size = io.fileSize(filePath)
log.info(“testHttp.cbFncFile”,”fileSize=”..size)
--输出文件内容,如果文件太大,一次性读出文件内容可能会造成内存不足,分次读出可以避免此问题
if size<=4096 then
log.info("testHttp.cbFncFile",io.readFile(filePath))
else
end
end
--文件使用完之后,如果以后不再用到,需要自行删除
if filePath then os.remove(filePath) end
end
local function downloadfiles()
log.info(“start”,os.time())
http.request(“GET”,”http://域名或者ip/download.zip”,nil,nil,nil,30000,cbFncFile,”download.zip”)
end
sys.timerStart(downloadfiles,20000)












