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.

AT commands modem on CR300


Benjamin.vial Mar 26, 2024 02:26 PM

Hi,

I'm getting mad, I need your input.

I have a CR300, and a GSM modem (ercogener 400e) piloted by the CR300. The modem is plugged on the RS232 com port, and the power is managed by the 12Vdc switch.

Using Putty, I can see my modem correctly been registred on the french network, have an IP, can ping some addresse : it's online.

Then I can see the CR300 correctly manage switch and power up the modem ; I've added a IF condition with the hour of the day, and the battery voltage.

And I configured both serial port with the correct baudrate (115200), and the modem with the correct parity (8N1).

And I configured in the PPP tab the dial string : AT+CGDCONT=1,"IP","fipbouygtel.com";ATD*99***1#

When I plug the 400e and the CR300, I'm connecting with DevConfig Utility to looking on the PPP page to see the communication between the two devices, and it never pass the stages :

ppp state: dialing START -> dialing ECHO
ppp state: dial failed -> dialing START
ppp state: dialing OFFLINE -> dialing ECHO_ATH

Then turn in loop.

Here is my prog (I've hide my credentials of dydns off course) :

 

'CR300/CR310
'Created by Short Cut (4.4)

'Declare Variables and Units
Public BattV
Public PTemp_C
Public TRHData(2)
Public WS_ms
Public WindDir
Public T107_C_010
Public T107_C_150
Public T107_C_300
Public SlrW
Public SlrkJ
Public Rain_mm
Public TimeOffset="NAN"

Alias TRHData(1)=AirTC
Alias TRHData(2)=RH

Units BattV=Volts
Units PTemp_C=Deg C
Units WS_ms=meters/second
Units WindDir=degrees
Units T107_C_010=Deg C
Units T107_C_150=Deg C
Units T107_C_300=Deg C
Units SlrW=W/m^2
Units SlrkJ=kJ/m^2
Units Rain_mm=mm
Units AirTC=Deg C
Units RH=%

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

'----------MODEM parametres
Const GPRS_ModemBaudRate = 115200
Const GPRS_ModemPort = ComRS232
Const GPRS_CR = CHR(13)
Const GPRS_OK = CHR(10)& "OK"
Public ppp As String * 50
Dim pppOld As String * 50
Public TelecomFlag As Boolean 'True if telecom powered
Public TelecomStartTime = 7 'UTC
Public TelecomStopTime = 20 'UTC
'----------MODEM parametres
'----------DynDNS parametres
Dim Socket
Dim SocketResponse As String * 200
Dim pppInfo(9) As String *32
Dim UDDNScont = 0
Const dyndnshostname="XOXOXOXOXOXOXOXOXO"
Const dyndnsauth="XOXOXOXOXOXOXOXOXO"
'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=ipaddress HTTP/1.0"+CHR(13)+CHR(10)
'----------DynDNS parametres



'Define Data Tables
DataTable(meteo,True,-1)
DataInterval(0,10,Min,10)
Average(1,T107_C_010,FP2,False)
Average(1,T107_C_150,FP2,False)
Average(1,T107_C_300,FP2,False)
Average(1,AirTC,FP2,False)
Sample(1,RH,FP2)
WindVector(1,WS_ms,WindDir,FP2,False,0,0,0)
FieldNames("WS_ms_S_WVT,WindDir_D1_WVT,WindDir_SD1_WVT")
Average(1,SlrW,FP2,False)
Totalize(1,SlrkJ,IEEE4,False)
Totalize(1,Rain_mm,FP2,False)
EndTable

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

'---------MODEM sous-routine
Sub ModemON 'procedure de démarrage du modem
PortSet (SW12V,1)
TelecomFlag = True
Delay(1,45,sec)
ppp=IPInfo (1,0)
If ppp="" OR ppp="0.0.0.0" Then
ppp=PPPOpen
EndIf
Delay(1,20,sec)
EndSub

Sub ModemOFF 'arret du modem
PPPClose
SerialOpen(GPRS_ModemPort,GPRS_ModemBaudRate,0,20000,100)
SerialOut(GPRS_ModemPort,"AT+CFUN=0" & GPRS_CR,GPRS_OK,3,200)
Delay(1,5,sec)
SerialOut(GPRS_ModemPort,"AT+CPWROFF" & GPRS_CR,GPRS_OK,3,200)
Delay(1,30,sec) 'delay a few more seconds just to be sure the modem is off
SerialClose(GPRS_ModemPort) 'Release the serial port connection.
PortSet (SW12V,0) 'Turn off the modem (when necessary)
pppOld="0.0.0.0"
EndSub

Sub UpdateDDNS
Socket=TCPOpen("members.dyndns.org",80,8245)
If Socket<>0 Then
SerialOut(Socket,SocketGetRequest,"",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'---------MODEM sous-routine


'Main Program
BeginProg
TelecomFlag = False
'Main Scan
Scan(30,Sec,1,0)
'Default CR300 Datalogger Battery Voltage measurement 'BattV'
Battery(BattV)
'Default CR300 Datalogger Processor Temperature measurement 'PTemp_C'
PanelTemp(PTemp_C,50)
'CS215 Temperature & Relative Humidity Sensor measurements 'AirTC' and 'RH'
SDI12Recorder(TRHData(),C1,"0","M!",1,0,-1)
'03002 Wind Speed & Direction Sensor (CSL) measurements 'WS_ms' and 'WindDir'
PulseCount(WS_ms,1,P_LL,1,1,0.75,0.2)
If WS_ms<0.21 Then WS_ms=0
BrHalf(WindDir,1,mV2500,1,VX1,1,2500,False,20000,50,352,0)
If WindDir>=352 Or WindDir<0 Then WindDir=0
'107 Temperature Probe (CSL) measurement 'T107_C_010'
Therm107(T107_C_010,1,2,VX1,0,50,1,0)
'107 Temperature Probe (CSL) measurement 'T107_C_150'
Therm107(T107_C_150,1,3,VX1,0,50,1,0)
'107 Temperature Probe (CSL) measurement 'T107_C_300'
Therm107(T107_C_300,1,4,VX1,0,50,1,0)
'CMP3/CMP6/CMP11 Pyranometer (CSL) measurements 'SlrkJ' and 'SlrW'
VoltDiff(SlrW,1,mV2500,3,True,0,50,1,0)
If SlrW<0 Then SlrW=0
'Calculate total flux
'The multiplier to calculate total flux was calculated by Short Cut
'and based on a program execution rate (scan rate) of 30 Seconds.
'If you change the program execution rate outside of Short Cut with the CRBasic Editor
'you will need to recalculate this multiplier. See the sensor manual for more details.
SlrkJ=SlrW*1
'Calculate flux density
SlrW=SlrW*33.33333
'Generic Tipping Bucket Rain Gauge measurement 'Rain_mm'
PulseCount(Rain_mm,1,P_SW,2,0,0.2,0)
'Call Data Tables and Store Data
CallTable meteo
CallTable soh
NextScan


'---------MODEM slowsequence
SlowSequence
Scan(1, Min, 3, 0)
If BattV >=11.25 Then
RealTime (rTime) 'get various time elements
If Time_HourOfDay >= TelecomStartTime AND Time_HourOfDay <= TelecomStopTime Then ' activate telecommunication
If TelecomFlag = False Then
ModemON
EndIf
ppp=IPInfo (1,0)
If ppp <> pppOld OR ppp = "0.0.0.0" Then
UpdateDDNS
pppOld = IPInfo (1,0)
TimeOffset = NetworkTimeProtocol ("145.238.203.14",0,1000)
EndIf
Else
If TelecomFlag = True
TelecomFlag = False
ModemOFF
EndIf
EndIf
Else
If TelecomFlag = True
TelecomFlag = False
ModemOFF
EndIf
EndIf
Next Scan
EndSequence
'---------MODEM slowsequence

EndProg

 


Benjamin.vial Mar 28, 2024 09:09 AM

Hey,

is there anybody that could have an idea about this ?

I'm still stuck with this CR300 / modem communication...


Benjamin.vial Mar 28, 2024 04:00 PM

Hey again,

it was a hardware problem ; The ercogener manufacturer DB-9 to DB-15 cable was wrongly wired...

Hard to guess. I made a cable myself : it works immediatly.

Everything works fine now.


karalinda Apr 3, 2024 11:01 AM

This post is under review.

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