Logic Machine Forum
reactor not get ip from GSM - Printable Version

+- Logic Machine 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 not get ip from GSM (/showthread.php?tid=5430)

Pages: 1 2


reactor not get ip from GSM - Frank68 - 23.05.2024

Greetings

I changed the SIM and mounted a tested working one on a phone, my problem is that it does not receive IP from the cellular network, even if the signal is there.
Latest firmware version available
What can it be?

Thank you


RE: reactor not get ip from GSM - admin - 23.05.2024

Check that you have correct APN and dial number settings.
Post what you have in System config > Status > System log.


RE: reactor not get ip from GSM - Frank68 - 23.05.2024

(23.05.2024, 07:52)admin Wrote: Check that you have correct APN and dial number settings.
Post what you have in System config > Status > System log.

APN is correct

need the dial number of SIM ?

thank's


RE: reactor not get ip from GSM - admin - 23.05.2024

Default dial number is *99***1# but it might be different, check with your operator.

Also post what you have in System config > Status > System log.


RE: reactor not get ip from GSM - Frank68 - 23.05.2024

(23.05.2024, 07:58)admin Wrote: Default dial number is *99***1# but it might be different, check with your operator.

Also post what you have in System config > Status > System log.
the dial number be set in 3G/4G/ ppp connection or in resident sms script?

in system log see

May 23 08:04:52 LM5R_VERGATO daemon.err pppd[1932]: Connect script failed


RE: reactor not get ip from GSM - admin - 23.05.2024

Dial number is set in System config > Network. But you don't need to specify it if the default one is used.

Is SMS script working for you?


RE: reactor not get ip from GSM - Frank68 - 23.05.2024

(23.05.2024, 08:11)admin Wrote: Dial number is set in System config > Network. But you don't need to specify it if the default one is used.

Is SMS script working for you?

Yes I use only one number

the error il log why? error ppp connection, not have ip from mobile network.


RE: reactor not get ip from GSM - admin - 23.05.2024

If SMS script is working then the hardware is ok. This means that your configuration is wrong. Maybe a username or password is needed. Your operator should provide all settings - APN, user/password (if applicable) and dial-up number.


RE: reactor not get ip from GSM - Frank68 - 23.05.2024

(23.05.2024, 08:31)admin Wrote: If SMS script is working then the hardware is ok. This means that your configuration is wrong. Maybe a username or password is needed. Your operator should provide all settings - APN, user/password (if applicable) and dial-up number.

I use same SIM OPERATOR on other LM REACTOR and the same config working good , this no ?


RE: reactor not get ip from GSM - admin - 23.05.2024

Have you tried using this SIM on a different LM?


RE: reactor not get ip from GSM - Frank68 - 23.05.2024

(23.05.2024, 08:48)admin Wrote: Have you tried using this SIM on a different LM?

Now I have put new SIM tested on other LM and the new SIM working on ther LM.


RE: reactor not get ip from GSM - Frank68 - 24.05.2024

(23.05.2024, 08:51)Frank68 Wrote:
(23.05.2024, 08:48)admin Wrote: Have you tried using this SIM on a different LM?

Now I have put new SIM tested on other LM and the new SIM working on ther LM.

now I have ip from network but have this problem in log

attempt to call global 'sendsms' (a nil value) stack traceback:

thank's


RE: reactor not get ip from GSM - admin - 24.05.2024

It's not a user script, it's an init sequence of the 3g/4g services. Usually this error means that the configuration is incorrect.

If you are sure that all settings are correct then the only option is to replace the SIM card.


RE: reactor not get ip from GSM - Frank68 - 24.05.2024

(24.05.2024, 07:31)admin Wrote: It's not a user script, it's an init sequence of the 3g/4g services. Usually this error means that the configuration is incorrect.

If you are sure that all settings are correct then the only option is to replace the SIM card.

I check the sim on phone and work correctly

the IP is provided from mobile netwok but have this error.

???


RE: reactor not get ip from GSM - admin - 24.05.2024

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)



RE: reactor not get ip from GSM - Frank68 - 24.05.2024

(24.05.2024, 08:45)admin Wrote: 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)
this is the log file

* string: AT&F

OK

+CPIN: READY

SMS DONE

PB DONE

NO CARRIER

+PPPD: DISCONNECTED
ATE1

OK
AT+CGDCONT=1,"IP","internet.it"

OK
ATD*3332958126#


RE: reactor not get ip from GSM - admin - 24.05.2024

Keep the dial number default (dial = '*99***1#') and try again. This number is never your SIM number.


RE: reactor not get ip from GSM - Frank68 - 24.05.2024

(24.05.2024, 08:59)admin Wrote: Keep the dial number default (dial = '*99***1#') and try again. This number is never your SIM number.

the log


* string: AT&F

OK

+CPIN: READY

SMS DONE

PB DONE

NO CARRIER

+PPPD: DISCONNECTED
ATE1

OK
AT+CGDCONT=1,"IP","internet.it"

OK
ATD*99***1#

CONNECT 115200


RE: reactor not get ip from GSM - admin - 24.05.2024

Connect script fails because of "NO CARRIER" message meaning that there's no mobile connection.

Run this updated script and post what you get in Logs:
Code:
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:flush()
  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

  return res
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

function readstatus()
  local data, res, simok, network

  data = sendlog('AT+CSQ')

  if data then
    res = data:match('+CSQ: (%d+)')
    res = tonumber(res)

    if res then
      log('Signal: ' .. tostring(res))
    else
      log('Signal: no response')
    end
  else
    log('Signal: no data from port')
  end

  data = sendlog('AT+CPIN?') or ''

  if data:find('CME ERROR') then
    log('SIM: not found')
  elseif data:find('+CPIN: READY') then
    log('SIM: OK')
    simok = true
  else
    log('SIM: unknown')
  end

  data = sendlog('AT+COPS?')

  if data then
    res = data:match('+COPS: %d+,%d+,"(.*)",%d+')

    if res then
      log('Network: ' .. tostring(res))
      network = res
    else
      log('Network: no info')
    end
  else
    log('Network: no data from port')
  end

  return simok and network
end

for i = 1, 20 do
  if readstatus() then
    break
  end
end

res = table.concat(buf)
log(res)



RE: reactor not get ip from GSM - Frank68 - 24.05.2024

(24.05.2024, 09:27)admin Wrote: Connect script fails because of "NO CARRIER" message meaning that there's no mobile connection.
Run this updated script and post what you get in Logs:
Code:
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:flush()
  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
  return res
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
function readstatus()
  local data, res, simok, network
  data = sendlog('AT+CSQ')
  if data then
    res = data:match('+CSQ: (%d+)')
    res = tonumber(res)
    if res then
      log('Signal: ' .. tostring(res))
    else
      log('Signal: no response')
    end
  else
    log('Signal: no data from port')
  end
  data = sendlog('AT+CPIN?') or ''
  if data:find('CME ERROR') then
    log('SIM: not found')
  elseif data:find('+CPIN: READY') then
    log('SIM: OK')
    simok = true
  else
    log('SIM: unknown')
  end
  data = sendlog('AT+COPS?')
  if data then
    res = data:match('+COPS: %d+,%d+,"(.*)",%d+')
    if res then
      log('Network: ' .. tostring(res))
      network = res
    else
      log('Network: no info')
    end
  else
    log('Network: no data from port')
  end
  return simok and network
end
for i = 1, 20 do
  if readstatus() then
    break
  end
end
res = table.concat(buf)
log(res)

after restart

* string: AT&F

OK

+CPIN: READY

SMS DONE

PB DONE

NO CARRIER

+PPPD: DISCONNECTED
ATE1

OK
AT+CSQ

+CSQ: 99,99

OK
AT+CPIN?

+CPIN: READY

OK
AT+COPS?

+COPS: 0

OK
AT+CSQ

+CSQ: 99,99

OK

NO CARRIER

+PPPD: DISCONNECTED
AT+CPIN?

+CPIN: READY

OK
AT+COPS?

+COPS: 0

OK
AT+CSQ

+CSQ: 99,99

OK
AT+CPIN?

+CPIN: READY

OK
AT+COPS?

+COPS: 0

OK
AT+CSQ

+CSQ: 12,99

OK
AT+CPIN?

+CPIN: READY

OK
AT+COPS?

+COPS: 0,0,"WINDTRE",2

OK