The file is complete. I run the script using the “AT Command Tester V27” software.
If I implement the script using the Arduino MKR1000, it does not work. Below is the sketch and the console output. I know I missing something that “AT Command Tester V27” handles, but I have no idea what it is.
CODE
#define SerialAT Serial1
// HL 7650 Pin definition
#define HL_PWR_ON 5 //Sierra PWR_ON Pin
#define HL_RST_N 4 //Sierra RESET_IN_N
#define HL_GP_2 3 //Sierra GPIO2
void setup()
{
// Set console baud rate
Serial.begin(115200);
SerialAT.begin(115200);
long timeStartRunning = millis();
while (!Serial&&millis()-timeStartRunning<=3000)
;
// Initialize Sierra
sierra_Init();
sendATcommand("AT&F" ,2000);
sendATcommand("AT+CGREG?" ,2000);
sendATcommand("AT+CPIN?" ,2000);
sendATcommand("AT+CGACT=0,1" ,2000);
sendATcommand("AT+KCNXCFG=1,\"GPRS\",\"internet.itelcel.com\"",2000);
sendATcommand("AT+CGDCONT=1,\"IP\",\"internet.itelcel.com\"",2000);
sendATcommand("AT+CGACT=1,1",5000);
sendATcommand("AT+CGATT=1",2000);
sendATcommand("AT+KTCPCFG?",2000);
sendATcommand("AT+KTCPCLOSE=1,1",2000);
sendATcommand("AT+KTCPDEL=1",2000);
sendATcommand("AT+KTCPCFG?",2000);
sendATcommand("AT+KTCPCFG=1,0,\"www.lefalme.com.mx\",80",2000);
sendATcommand("AT+KTCPCNX=1",2000);
sendATcommand("AT+KTCPSTAT=1",2000);
sendATcommand("AT&K3",2000);
sendATcommand("AT+KTCPSTART=1",10000);
sendATcommand("\r\nGET /OTA/DownloadFile.ino HTTP/1.1\r\nHost:www.lefalme.com.mx\r\nConnection:keep-alive\r\n\r\n",30000);
}
void loop()
{
delay(1000);
}
// This function "sierra_Init()" must be included to run sierra chip and in setup
//------------------------------------------------------------------------------
void sierra_Init()
//------------------------------------------------------------------------------
{
//////////////////////////////////////////////////////////////////
// Setting POWER_ON Pin active Low for powering up sierra chip.//
// Setting PWR_ON to active HIGH will make HL7650 to power off//
///////////////////////////////////////////////////////////////
pinMode(HL_PWR_ON, OUTPUT);
digitalWrite(HL_PWR_ON, LOW);
//////////////////////////////////////////////////////////////////////////////
// Setting UART channel for sierra communication //
// Default baud rate is 115200 //
//////////////////////////////////////////////////////////////////////////////
SerialAT.begin(115200);
//////////////////////////////////////////////////////////////////////////////
// RESET_IN_N signal - active low for 20ms to restart HL7650 //
//////////////////////////////////////////////////////////////////////////////
pinMode(HL_RST_N, OUTPUT);
digitalWrite(HL_RST_N, HIGH);
//////////////////////////////////////////////////////////////////////////////
// Sierra_GPIO2 signal(IN/OUTPUT) - is used to trigger HL7650 to wake up //
// from sleep mode //
//////////////////////////////////////////////////////////////////////////////
pinMode(HL_GP_2, INPUT);
digitalWrite(HL_GP_2, HIGH);
}
void sendATcommand(const char *toSend, unsigned long milliseconds) {
Serial.print("Sending: ");
Serial.println(toSend);
SerialAT.println(toSend);
unsigned long startTime = millis();
Serial.print("Received: ");
while (millis() - startTime < milliseconds) {
if (SerialAT.available())
{
char c = (char)SerialAT.read();
Serial.print(c);
}
}
Serial.println("-------------------------");
}
CONSOLE OUTPUT
Sending: AT&F
Received: AT&F
OK
-------------------------
Sending: AT+CGREG?
Received: AT+CGREG?
+CGREG: 0,1
OK
-------------------------
Sending: AT+CPIN?
Received: AT+CPIN?
+CPIN: READY
OK
-------------------------
Sending: AT+CGACT=0,1
Received: AT+CGACT=0,1
OK
+KCNX_IND: 1,0,0
-------------------------
Sending: AT+KCNXCFG=1,"GPRS","internet.itelcel.com"
Received: AT+KCNXCFG=1,"GPRS","internet.itelcel.com"
OK
-------------------------
Sending: AT+CGDCONT=1,"IP","internet.itelcel.com"
Received: AT+CGDCONT=1,"IP","internet.itelcel.com"
OK
-------------------------
Sending: AT+CGACT=1,1
Received: AT+CGACT=1,1
OK
-------------------------
Sending: AT+CGATT=1
Received: AT+CGATT=1
OK
-------------------------
Sending: AT+KTCPCFG?
Received: AT+KTCPCFG?
+KTCPCFG: 1,0,1,0,,"www.lefalme.com.mx",80,3134,0,0,0,0
OK
-------------------------
Sending: AT+KTCPCLOSE=1,1
Received: AT+KTCPCLOSE=1,1
ERROR
-------------------------
Sending: AT+KTCPDEL=1
Received: AT+KTCPDEL=1
OK
-------------------------
Sending: AT+KTCPCFG?
Received: AT+KTCPCFG?
OK
-------------------------
Sending: AT+KTCPCFG=1,0,"www.lefalme.com.mx",80
Received: AT+KTCPCFG=1,0,"www.lefalme.com.mx",80
+KTCPCFG: 1
OK
-------------------------
Sending: AT+KTCPCNX=1
Received: AT+KTCPCNX=1
OK
+KCNX_IND: 1,4,1
+KCNX_IND: 1,1,0
+KTCP_IND: 1,1
-------------------------
Sending: AT+KTCPSTAT=1
Received: AT+KTCPSTAT=1
+KTCPSTAT: 3,-1,0,0
OK
-------------------------
Sending: AT&K3
Received: AT&K3
OK
-------------------------
Sending: AT+KTCPSTART=1
Received: AT+KTCPSTART=1
CONNECT
-------------------------
Sending:
GET /OTA/DownloadFile.ino HTTP/1.1
Host:www.lefalme.com.mx
Connection:keep-alive
Received: HTTP/1.1 200 OK
Date: Mon, 28 Feb 2022 07:21:35 GMT
Server: Apache
Upgrade: h2,h2c
Connection: Upgrade, Keep-Alive
Last-Modified: Sat, 15 Jan 2022 06:16:26 GMT
Accept-Ranges: bytes
Content-Length: 9778
Vary: Accept-Encoding,User-Agent
Keep-Alive: timeout=2, max=100
//#def o"
eD _
:dDn_0rfeeR2#YUfefdeX1el#RdY_0fAN0c AT
DMUeMfI
ei
Siduen ygafMaNem;P= O
h[r.hGbhSw;
da=l
UT
O/.t8dC teedilGbeGeencmeRA_/PonN efi
H Sie
lostEk,tAUpdwaboolegBlsOFcrmwun,201 arar;
vop(/le.0tns)il&mimeing
Set("")l.pRS / md rialAn(1
nMO/ Ie sitse
FOGS th GO iN 00)gitGSLOW rtte soe
skallnstest iniem. tarendStmm.foriMo
rm nf." Fr))rian("
10 r }
.prOKer("C toSert(
emec,GP,GRD)) Stln(;
y(1 re
i(
o aock(
stOirk =)ECKWAvoi
{
hecateurllaeFck>ECMWAchirmte()#if SM
fui)nrhe----------------sier()
-------------------//////////////////// SOWE actfor p uch PWcil6r////////////nMoR_);
alWrWR;
////////////////////Sett chr mun Dd 1 //////////
beg);
///////////////////// RE stivr st0 /////////////// LPgLG//////////// SiO2 /OUTis tr50 p // p m /////////////
(PgLHiherme( MP t:l.nec);l.Vial"); tiyiHTTP);
(mmengT_HTI
entr {i.d;}
is(arnecME_CO)
Sin
milmegCoP>HTTTI prto coo:eS AUm
r(
i"U1.0 cintHosRVE;
.pcto;
arnecm i e")le(-tyiHTAINN (abl {Sert(" 00);
ial.""meStgC>=_TI prinanfil DIM c a")connLo eSgCP)ce
nng tesRntrsLboDat=falewLe;
ienble
p
t =ountter0;ioucli);leva
e re g)
na]y a+; ite=vio3) {
ltersL0'; rin
/ C "ea str(TPLL) trs2)
rnn or. ig iscSL } Ma fefL 0l) /"e+)3 F[1 irmi]
datrrmw=0 er("Lmwan . Iot e up
nl( t /"n
elstr(nte")
cin
fi
lne eB16]
}
iL ianu
tu } hane [0
la= (a!=us
fl = te
dIWNL iht BBy}
efT_OAD ri
.pesd:ri(ces NErin(lo ct(if-tyiHTAN riansthrv
onca cl();al\nsc;
m.ne//ntlS edrin();stirk ;
NO CARRIER
+KTCP_NOTIF: 1,4
-------------------------
Only the HTTP headers are fine. I do not recognize the characters corresponding to the data file.