我这边特殊情况需要使用两个模块,并同步一些重启的指令,写完功能一切正常,但是后来出现串口持续收到0xff的情况,导致无法正常运行,请问是否串口部分损坏还是其他的原因,现在屏蔽串口部分代码模块其他功能还是正常
-- uart 的初始化配置函数
function uart_INIT(i, uconf)
pm.wake("mcuart")
uart.setup(1, 115200, 8, uart.PAR_NONE, uart.STOP_1, nil, 1)
uart.on(1, "receive", function(uid, length)
local uchar = uart.read(uid, length)
log.info("temp_ver1", uchar)
if string.find(uchar, "reboot!") ~= nil then
-- 重启指令
nvm.set("restart_flag1", true, nil, false)
nvm.set("restart_flag2", true, nil, false)
nvm.set("restart_flag3", true, nil, false)
nvm.set("restart_flag4", true, nil, false)
nvm.set("restart_flag5", true, nil, false)
nvm.set("restart_flag6", true, nil, true)
nvm.flush()
restart_sys("server restart")
elseif string.find(uchar, "update") ~= nil then
-- 版本号
-- local temp_ver=string.byte(uchar)
-- log.info("temp_ver",uchar)
local set, strend = string.find(uchar, "update")
local idx, t_ver = pack.unpack(uchar:sub(strend + 1, strend + 1), "b")
device_version = t_ver / 10
nvm.set("device_version", device_version)
log.warn("new_version_1", device_version)
end
end)
uart.setup(2, 115200, 8, uart.PAR_NONE, uart.STOP_1, nil, 1)
uart.on(2, "receive", function(uid, length)
local uchar = uart.read(uid, length)
log.info("temp_ver2", uchar)
if string.find(uchar, "reboot!") ~= nil then
-- 重启指令
nvm.set("restart_flag1", true, nil, false)
nvm.set("restart_flag2", true, nil, false)
nvm.set("restart_flag3", true, nil, false)
nvm.set("restart_flag4", true, nil, false)
nvm.set("restart_flag5", true, nil, false)
nvm.set("restart_flag6", true, nil, true)
nvm.flush()
restart_sys("server restart")
elseif string.find(uchar, "update") ~= nil then
-- 版本号
-- local temp_ver=string.byte(uchar)
-- log.info("temp_ver",uchar)
local set, strend = string.find(uchar, "update")
local idx, t_ver = pack.unpack(uchar:sub(strend + 1, strend + 1), "b")
device_version = t_ver / 10
nvm.set("device_version", device_version)
log.warn("new_version_1", device_version)
end
end)
-- 处理串口接收到的数据
-- sys.subscribe("UART_RECV_WAIT_1", read)
-- sys.subscribe("UART_SENT_RDY_1", write)
end
-- sys.taskInit(uart_INIT, 1, uconf)
log如下,开机后持续收到0xff ,图片是notepad++打开才看到有0xff的数据收到,
[2019-12-27 09:49:40,381.381]: start tool
[2019-12-27 09:50:03,803.803]: host trace ====================================
[2019-12-27 09:50:03,806.806]: host trace INTR VER :Luat_V0038_8955F_FLOAT
[2019-12-27 09:50:03,806.806]: host trace BASE VER :B6005
[2019-12-27 09:50:03,808.808]: host trace SCRIPT ADDR :0x00560000
[2019-12-27 09:50:03,809.809]: host trace SCRIPT SIZE :0x000b0000
[2019-12-27 09:50:03,809.809]: host trace BASE ADDR :0x004c0000
[2019-12-27 09:50:03,809.809]: host trace BASE SIZE :0x000a0000
[2019-12-27 09:50:03,809.809]: host trace ====================================
[2019-12-27 09:50:03,811.811]: host trace [cust_task_main]: Enter message loop
[2019-12-27 09:50:03,812.812]: host trace lualibc_fopen_ext /integrity.bin rb 0 1 2
[2019-12-27 09:50:03,812.812]: host trace lualibc_fopen_ext /integrity.bin rb 0 1 2
[2019-12-27 09:50:03,813.813]: host trace INTEGRITY file correct!
[2019-12-27 09:50:03,815.815]: host trace lualibc_fopen_ext /ldata/1.TXT rb 0 1 2
[2019-12-27 09:50:03,831.831]: host trace lualibc_fopen_ext /ldata/2.TXT rb 0 1 2
[2019-12-27 09:50:03,831.831]: host trace lualibc_fopen_ext /ldata/3.TXT rb 0 1 2
[2019-12-27 09:50:03,834.834]: host trace lualibc_fopen_ext /ldata/4.TXT rb 0 1 2
[2019-12-27 09:50:03,835.835]: host trace lualibc_fopen_ext /ldata/5.TXT rb 0 1 2
[2019-12-27 09:50:03,836.836]: host trace lualibc_fopen_ext /ldata/6.TXT rb 0 1 2
[2019-12-27 09:50:03,838.838]: host trace FH:file=/lua/wdt.lua,len=1239,offset=109697
[2019-12-27 09:50:03,839.839]: host trace FH:file=/lua/utils.lua,len=3858,offset=105814
[2019-12-27 09:50:03,841.841]: host trace FH:file=/lua/sys.lua,len=6183,offset=99604
[2019-12-27 09:50:03,842.842]: host trace FH:file=/lua/socket.lua,len=14666,offset=84913
[2019-12-27 09:50:03,844.844]: host trace FH:file=/lua/sim.lua,len=1281,offset=83604
[2019-12-27 09:50:03,845.845]: host trace FH:file=/lua/ril.lua,len=8310,offset=75269
[2019-12-27 09:50:03,845.845]: host trace FH:file=/lua/pm.lua,len=474,offset=74770
[2019-12-27 09:50:03,846.846]: host trace FH:file=/lua/pins.lua,len=1321,offset=73425
[2019-12-27 09:50:03,848.848]: host trace FH:file=/lua/patch.lua,len=1256,offset=72143
[2019-12-27 09:50:03,849.849]: host trace FH:file=/lua/nvm.lua,len=3173,offset=68943
[2019-12-27 09:50:03,851.851]: host trace FH:file=/lua/ntp.lua,len=2053,offset=66865
[2019-12-27 09:50:03,852.852]: host trace FH:file=/lua/net.lua,len=5269,offset=61571
[2019-12-27 09:50:03,854.854]: host trace FH:file=/lua/misc.lua,len=3368,offset=58178
[2019-12-27 09:50:03,855.855]: host trace FH:file=/lua/main.lua,len=424,offset=57728
[2019-12-27 09:50:03,855.855]: host trace FH:file=/lua/log.lua,len=1174,offset=56528
[2019-12-27 09:50:03,858.858]: host trace FH:file=/lua/link.lua,len=2839,offset=53664
[2019-12-27 09:50:03,858.858]: host trace FH:file=/lua/jddl.lua,len=44034,offset=9604
[2019-12-27 09:50:03,859.859]: host trace FH:file=/lua/http.lua,len=6716,offset=2862
[2019-12-27 09:50:03,861.861]: host trace FH:file=/lua/config.lua,len=2087,offset=749
[2019-12-27 09:50:03,861.861]: host trace FH:file=/lua/clib.lua,len=491,offset=230
[2019-12-27 09:50:03,862.862]: host trace parse_luadb_data:delupdpack=0,err=0,section=1,wrFile=0
[2019-12-27 09:50:03,864.864]: host trace [fopen_ext]: /lua/main.lua 2!
[2019-12-27 09:50:03,865.865]: host trace RUN main.lua
[2019-12-27 09:50:03,865.865]: host trace [fopen_ext]: /lua/main.lua 2!
[2019-12-27 09:50:03,867.867]: host trace [fopen_ext]: /lua/log.lua 2!
[2019-12-27 09:50:03,868.868]: host trace [fopen_ext]: /lua/log.lua 2!
[2019-12-27 09:50:03,868.868]: host trace [fopen_ext]: /lua/sys.lua 2!
[2019-12-27 09:50:03,869.869]: host trace [fopen_ext]: /lua/sys.lua 2!
[2019-12-27 09:50:03,871.871]: host trace [fopen_ext]: /lua/utils.lua 2!
[2019-12-27 09:50:03,871.871]: host trace [fopen_ext]: /lua/utils.lua 2!
[2019-12-27 09:50:03,872.872]: host trace [fopen_ext]: /lua/patch.lua 2!
[2019-12-27 09:50:03,872.872]: host trace [fopen_ext]: /lua/patch.lua 2!
[2019-12-27 09:50:03,874.874]: host trace [fopen_ext]: /lua/clib.lua 2!
[2019-12-27 09:50:03,875.875]: host trace [fopen_ext]: /lua/clib.lua 2!
[2019-12-27 09:50:03,875.875]: host trace [fopen_ext]: /lua/pins.lua 2!
[2019-12-27 09:50:03,877.877]: host trace [fopen_ext]: /lua/pins.lua 2!
[2019-12-27 09:50:03,878.878]: host trace [fopen_ext]: /lua/net.lua 2!
[2019-12-27 09:50:03,878.878]: host trace [fopen_ext]: /lua/net.lua 2!
[2019-12-27 09:50:03,878.878]: host trace [fopen_ext]: /lua/ril.lua 2!
[2019-12-27 09:50:03,880.880]: host trace [fopen_ext]: /lua/ril.lua 2!
[2019-12-27 09:50:03,881.881]: host trace [fopen_ext]: /lua/sim.lua 2!
[2019-12-27 09:50:03,881.881]: host trace [fopen_ext]: /lua/sim.lua 2!
[2019-12-27 09:50:03,882.882]: host trace [fopen_ext]: /lua/wdt.lua 2!
[2019-12-27 09:50:03,882.882]: host trace [fopen_ext]: /lua/wdt.lua 2!
[2019-12-27 09:50:03,884.884]: host trace [I]-[wdt.taskWdt] AirM2M --> WATCHDOG : OK nil nil
[2019-12-27 09:50:03,884.884]: host trace [fopen_ext]: /lua/misc.lua 2!
[2019-12-27 09:50:03,885.885]: host trace [fopen_ext]: /lua/misc.lua 2!
[2019-12-27 09:50:03,887.887]: host trace [fopen_ext]: /lua/jddl.lua 2!
[2019-12-27 09:50:03,888.888]: host trace [fopen_ext]: /lua/jddl.lua 2!
[2019-12-27 09:50:03,888.888]: host trace [fopen_ext]: /lua/socket.lua 2!
[2019-12-27 09:50:03,890.890]: host trace [fopen_ext]: /lua/socket.lua 2!
[2019-12-27 09:50:03,891.891]: host trace [fopen_ext]: /lua/link.lua 2!
[2019-12-27 09:50:03,891.891]: host trace [fopen_ext]: /lua/link.lua 2!
[2019-12-27 09:50:03,891.891]: host trace [fopen_ext]: /lua/config.lua 2!
[2019-12-27 09:50:03,892.892]: host trace [fopen_ext]: /lua/config.lua 2!
[2019-12-27 09:50:03,894.894]: host trace [fopen_ext]: /lua/nvm.lua 2!
[2019-12-27 09:50:03,894.894]: host trace [fopen_ext]: /lua/nvm.lua 2!
[2019-12-27 09:50:03,895.895]: host trace [fopen_ext]: /lua/pm.lua 2!
[2019-12-27 09:50:03,897.897]: host trace [fopen_ext]: /lua/pm.lua 2!
[2019-12-27 09:50:03,898.898]: host trace lualibc_fopen_ext /nvm_para.lua rb 0 1 2
[2019-12-27 09:50:03,898.898]: host trace load fExist fBakExist true nil
[2019-12-27 09:50:03,898.898]: host trace lualibc_fopen_ext /nvm_para.lua r 0 1 2
[2019-12-27 09:50:03,900.900]: host trace lualibc_fopen_ext /nvm_para.lua r 0 1 2
[2019-12-27 09:50:03,901.901]: host trace load fResult true
[2019-12-27 09:50:03,904.904]: host trace [W]-[file_size] 0
[2019-12-27 09:50:03,905.905]: host trace [I]-[version] 1.1
[2019-12-27 09:50:03,907.907]: host trace [I]-[last_time_cnt] 1573228800
[2019-12-27 09:50:03,910.910]: host trace [W]-[read file] 1
[2019-12-27 09:50:03,911.911]: host trace lualibc_fopen_ext /ldata/1.TXT r 0 1 2
[2019-12-27 09:50:03,914.914]: host trace [I]-[hl_old_data:] 1
[2019-12-27 09:50:03,915.915]: host trace [I]-[打印占用的内存:] 395.28515625
[2019-12-27 09:50:03,917.917]: host trace [W]-[read file] 2
[2019-12-27 09:50:03,920.920]: host trace lualibc_fopen_ext /ldata/2.TXT r 0 1 2
[2019-12-27 09:50:03,921.921]: host trace [I]-[hl_old_data:] 1
[2019-12-27 09:50:03,923.923]: host trace [I]-[打印占用的内存:] 337.2890625
[2019-12-27 09:50:03,924.924]: host trace [W]-[read file] 3
[2019-12-27 09:50:03,926.926]: host trace lualibc_fopen_ext /ldata/3.TXT r 0 1 2
[2019-12-27 09:50:03,927.927]: host trace [I]-[hl_old_data:] 1
[2019-12-27 09:50:03,928.928]: host trace [I]-[打印占用的内存:] 336.9169921875
[2019-12-27 09:50:03,930.930]: host trace [W]-[read file] 4
[2019-12-27 09:50:03,931.931]: host trace lualibc_fopen_ext /ldata/4.TXT r 0 1 2
[2019-12-27 09:50:03,934.934]: host trace [I]-[hl_old_data:] 1
[2019-12-27 09:50:03,936.936]: host trace [I]-[打印占用的内存:] 336.919921875
[2019-12-27 09:50:03,937.937]: host trace [W]-[read file] 5
[2019-12-27 09:50:03,938.938]: host trace lualibc_fopen_ext /ldata/5.TXT r 0 1 2
[2019-12-27 09:50:03,940.940]: host trace [I]-[hl_old_data:] 1
[2019-12-27 09:50:03,941.941]: host trace [I]-[打印占用的内存:] 337.029296875
[2019-12-27 09:50:03,944.944]: host trace [W]-[打印占用的内存:] 336.74609375
[2019-12-27 09:50:03,944.944]: host trace [fopen_ext]: /lua/ntp.lua 2!
[2019-12-27 09:50:03,947.947]: host trace [fopen_ext]: /lua/ntp.lua 2!
[2019-12-27 09:50:03,953.953]: host trace [I]-[poweron reason:] 7 JDDL 3.5 2.3.4 Luat_V0038_8955F_FLOAT [2019-12-27 09:50:03,954.954]: host trace [I]-[temp_ver1]��2019-12-27 09:50:03,957.957]: host trace [I]-[temp_ver1]��2019-12-27 09:50:03,957.957]: host trace [I]-[temp_ver1]�