![]() |
|
reactor modem check - Printable Version +- LogicMachine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Hardware (https://forum.logicmachine.net/forumdisplay.php?fid=12) +--- Thread: reactor modem check (/showthread.php?tid=5569) |
reactor modem check - Frank68 - 21.08.2024 hi I have two reactor lm5p2-lte that with a storm stopped seeing the SIMs, in one the SIM had signs of burning, now when I try to use the script to verify the modem it tells me init script failed in both, the 2 modems could be damaged for check the modem i use this script Code: apn = 'PUT_YOUR_APN_HERE'
dial = '*99***1#'
io.writefile('/sys/class/gpio/export', 8)
io.writefile('/sys/class/gpio/export', 71)
io.writefile('/sys/class/gpio/gpio8/direction', 'high')
os.sleep(1)
io.writefile('/sys/class/gpio/gpio8/direction', 'low')
io.writefile('/sys/class/gpio/gpio71/direction', 'high')
tty1 = '/dev/ttyACM3'
tty2 = '/dev/ttyUSB2'
for i = 1, 20 do
os.sleep(1)
if io.exists(tty1) then
tty = tty1
break
elseif io.exists(tty2) then
tty = tty2
break
end
end
if not tty then
log('init failed')
return
end
buf = {}
function send(cmd, timeout)
port:write(cmd .. '\r\n')
local res, err = port:read(1000, timeout or 1)
return res, err
end
function sendlog(cmd, timeout)
local res = send(cmd, timeout)
if res then
buf[ #buf + 1 ] = res
end
end
port = require('serial').open(tty)
log('open port', tty)
for i = 1, 20 do
res = send('AT')
if res then
break
end
end
if not res then
log('no response')
return
end
sendlog('AT&F', 10) -- reset settings
sendlog('ATE1') -- echo enabled
sendlog('AT+CGDCONT=1,"IP","' .. apn .. '"') -- set apn
sendlog('ATD' .. dial) -- connect
res = table.concat(buf)
log(res)RE: reactor modem check - admin - 21.08.2024 Init fails means that the modem cannot be detected. Most likely it is completely broken. |