Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

IP address didn't kept in PPP connexion


Benjamin.vial Aug 7, 2024 01:59 PM

Hello,

I'm trying to link a CR350 and a "fasttrack/wavecom like" modem (ercogener 325e, it's the very same).

I've set my modem first with a direct link on my laptop with these parameters :

AT+CPIN? --->>> ("READY", pin is deactivated)
AT+IPR=115200
AT+IFC=0,0

Then I save the profile :
AT+W

And so I've enter this on DevConfig Utility on the PPP page :

Modem dial string : AT+CGDCONT=1,"IP","fipbouygtel.com";ATD*99***1#
Modem dial response : CONNECT

And finally I've made a program that I'll put below.

So after a time (1-2 min) I eventually get an IP but this IP doesn't stay and it's unpingable. As I saw some time on the PPP window "ppp state: user interrupt" I suspect something in my program that try 2 access at the same time or my loop are wrong, can you please help me ? Here my prog, I just let the connexion + update a DynDNS service (commented for now), and some light measure :

 

'2024-08-07

'general
Public BattV
Public PTemp_C
Public TimeOffset="NAN"
Public PingMe
', TraceMessage As String * 100
Public myIP As String *15
'Public Dest As String *300, LastRx_Secs As Long
Public MessageSLOW As String *40

'maj heure
Dim rTime(9)
Alias rTime(1)= Time_Year
Alias rTime(2)= Time_Month
Alias rTime(3)= Time_DayOfMonth
Alias rTime(4)= Time_HourOfDay
Alias rTime(5)= Time_Minutes
Alias rTime(6)= Time_Seconds
Alias rTime(7)= Time_Microseconds
Alias rTime(8)= Time_DayOfWeek
Alias rTime(9)= Time_DayOfYear

Units BattV=Volts
Units PTemp_C=Deg C

'----------MODEM parametres
Const Modem_baud = 115200
Const Modem_port = COMRS232
Const Modem_return = CHR(13)
Const Modem_ok = CHR(10)&"OK"

'Public TelecomFlag As Boolean
Public TelecomStartTime = 5 'UTC
Public TelecomStopTime = 22 'UTC
'----------MODEM parametres

'----------DynDNS parametres
Dim Socket
Dim SocketResponse As String * 200
Dim pppInfo(9)  As String *32
Dim UDDNScont = 0
Const dyndnshostname="cr300-labo.dyndns.info"
Const dyndnsauth="thepassword"
'Const SocketGetRequest="GET /nic/update?hostname="+dyndnshostname+"&myip=ipaddress&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG HTTP/1.0"+CHR(13)+CHR(10) 
'Const SocketGetRequest="GET /nic/update?hostname="+dyndnshostname+"&myip="+myIP+CHR(13)+CHR(10)
Const SocketGetRequest="GET /nic/update?hostname="+dyndnshostname+"&myip="

'----------DynDNS parametres

'---------MODEM sous-routine
Sub ModemON 'démarrage modem
  SW12 (SW12_1,1 )  
  Delay(1,30,sec)
  SerialOpen(Modem_port,Modem_baud,0,20000,0,0,0)
  SerialOut (COMRS232,"AT+CGATT=1" & Modem_return,Modem_ok,3,200)
  SerialOut (COMRS232,"AT+CGDCONT=1,'IP','fipbouygtel.com'" & Modem_return,Modem_ok,3,200)
  SerialOut (COMRS232,"AT+CGACT=1,1" & Modem_return,Modem_ok,3,200)
  SerialOut (COMRS232,"ATD*99***1#" & Modem_return,Modem_ok,3,200)
  'If myIP="" OR myIP="0.0.0.0"
  myIP=PPPOpen
  'EndIf
  Delay(1,10,sec)
EndSub

Sub ModemOFF 'arret modem
	PPPClose
	SerialOpen(Modem_port,Modem_baud,0,20000,100)
	SerialOut(Modem_port,"AT+CFUN=0" & Modem_return,Modem_ok,3,200)
	Delay(1,5,sec)
	SerialOut(Modem_port,"AT+CPWROFF" & Modem_return,Modem_ok,3,200)
	Delay(1,10,sec)
	SerialClose(Modem_port)
  SW12 (SW12_1,0 )
  Delay(1,10,sec  
EndSub

Sub UpdateDDNS 'maj du DynDNS
    Socket=TCPOpen("members.dyndns.org",80,8245)
  If Socket<>0 Then
    SerialOut(Socket,SocketGetRequest+myIP+CHR(13)+CHR(10),"",0,0)
    SerialOut(Socket,"Host: members.dyndns.org "+CHR(13)+CHR(10),"",0,0)
    SerialOut(Socket,"Authorization: Basic "+dyndnsauth+CHR(13)+CHR(10),"",0,0)
    SerialOut(Socket,"User-Agent: Company - Device - Version Number"+CHR(13)+CHR(10),"",0,0)
    SerialOut(Socket,CHR(13)+CHR(10),"",0,0)
    SerialIn(SocketResponse,Socket,1000,"",200)
    SplitStr (pppInfo,SocketResponse,CHR(13)+CHR(10),9,5)
    UDDNScont = UDDNScont+1
  EndIf
EndSub

DataTable(soh,True,-1)
	DataInterval(0,1,Min,10)
	Minimum(1,BattV,IEEE4,False,False)
	Average(1,PTemp_C,IEEE4,False)
EndTable

'---------MODEM sous-routine

'Main Program
BeginProg
	'Main Scan
	Scan(10,Sec,1,0)
		Battery(BattV)
		PanelTemp(PTemp_C,4000)
		Calltable soh
	NextScan

'---------MODEM slowsequence
	SlowSequence
		Scan(1, Min, 3, 0)
		If BattV >=11.25 Then 
  			RealTime (rTime)
  			If Time_HourOfDay >= TelecomStartTime AND Time_HourOfDay <= TelecomStopTime Then
  			  ModemON
  				PingMe=PingIP ("www.google.com",10000,1)
  				TimeOffset = NetworkTimeProtocol ("145.238.203.14",0,1000)
  				If myIP<>"" OR myIP="0.0.0.0" Then
  					'UpdateDDNS
  					MessageSLOW="ModemON et ping OK"
          Else
            MessageSLOW="ModemON mais pas de ping"
            myIP=""
            'ModemON
  				EndIf
  			Else
  			  'IPTrace (TraceMessage)
  			  MessageSLOW="Batt low et/ou horaire nuit"
  			EndIf
		Else
  				ModemOFF
  				MessageSLOW="Batt low"	
		EndIf
  		
		Next Scan
	EndSequence
'---------MODEM slowsequence

EndProg

 

Log in or register to post/reply in the forum.