This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

reactor not get ip from GSM
#15
Disable SMS script and 3g/4g connection then run this script once and post what you get in Logs. Don't forget to change apn variable value.

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)
Reply


Messages In This Thread
reactor not get ip from GSM - by Frank68 - 23.05.2024, 07:28
RE: reactor not get ip from GSM - by admin - 23.05.2024, 07:52
RE: reactor not get ip from GSM - by Frank68 - 23.05.2024, 07:56
RE: reactor not get ip from GSM - by admin - 23.05.2024, 07:58
RE: reactor not get ip from GSM - by Frank68 - 23.05.2024, 08:08
RE: reactor not get ip from GSM - by admin - 23.05.2024, 08:11
RE: reactor not get ip from GSM - by Frank68 - 23.05.2024, 08:17
RE: reactor not get ip from GSM - by admin - 23.05.2024, 08:31
RE: reactor not get ip from GSM - by Frank68 - 23.05.2024, 08:39
RE: reactor not get ip from GSM - by admin - 23.05.2024, 08:48
RE: reactor not get ip from GSM - by Frank68 - 23.05.2024, 08:51
RE: reactor not get ip from GSM - by Frank68 - 24.05.2024, 06:27
RE: reactor not get ip from GSM - by admin - 24.05.2024, 07:31
RE: reactor not get ip from GSM - by Frank68 - 24.05.2024, 07:44
RE: reactor not get ip from GSM - by admin - 24.05.2024, 08:45
RE: reactor not get ip from GSM - by Frank68 - 24.05.2024, 08:56
RE: reactor not get ip from GSM - by admin - 24.05.2024, 08:59
RE: reactor not get ip from GSM - by Frank68 - 24.05.2024, 09:04
RE: reactor not get ip from GSM - by admin - 24.05.2024, 09:27
RE: reactor not get ip from GSM - by Frank68 - 24.05.2024, 09:35
RE: reactor not get ip from GSM - by admin - 24.05.2024, 09:40

Forum Jump: