4G email reseting failure Error code:1

Wireless communications in Waspmote, topologies, node types...
Post Reply
mikismart
Posts: 25
Joined: Thu Jul 11, 2019 8:33 am
Company: Samek Engineering

4G email reseting failure Error code:1

Post by mikismart » Thu Jul 11, 2019 2:11 pm

Hi
I have been programming Smart Environment Pro to send Email via google smtp server but _4G.emailReset(); couldn't successfully work and i can't send email is there any means that i can fix this problem.? quick response will be appreciated and here is my code:-

Code: Select all

/*
    --------------- 4G_19 - Sending e-mail ---------------

    Explanation: This example shows how to set up the module to send
    e-mails

    Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L.
    http://www.libelium.com

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

    Version:           3.0
    Design:            David Gascón
    Implementation:    Luis Miguel Martí
*/

#include <Wasp4G.h>

// APN settings
///////////////////////////////////////
char apn[] = "etc";
char login[] = "etc";
char password[] = "etc";
///////////////////////////////////////


// E-mail sender parameters
//////////////////////////////////////////////////
char sender_address[] = "ictatsamek@gmail.com";
char sender_user[] = "ictatsamek@gmail.com";
char sender_password[] = "samek@2010";
//////////////////////////////////////////////////

//char sender_user[] = "test1@libelium.com";
//char sender_password[] = "eHr73j";

// E-mail SMTP parameters
//////////////////////////////////////////////////
char smtp_server[] = "smtp.gmail.com";
uint8_t smtp_security = Wasp4G::EMAIL_SSL;
uint16_t smtp_port = 465;
//////////////////////////////////////////////////

// E-mail to send
//////////////////////////////////////////////////
char receiver_address[] = "mikiyasshemsu@gmail.com";
char subject[] = "Subject of email"; // maximum: 100 bytes
char message[] = "This is an e-mail message from Waspmote";
//////////////////////////////////////////////////

// variable
uint8_t error;


void setup()
{
  USB.ON();
  USB.println(F("Start program"));

  //////////////////////////////////////////////////
  // Set operator parameters
  //////////////////////////////////////////////////
  _4G.set_APN(apn, login, password);


  //////////////////////////////////////////////////
  // Show APN settings via USB port
  //////////////////////////////////////////////////
  _4G.show_APN();

  //////////////////////////////////////////////////
  // 1. Switch on the 4G module
  //////////////////////////////////////////////////
  error = _4G.ON();

  if (error == 0)
  {
    USB.println(F("1. 4G module ready..."));

    ////////////////////////////////////////////////
    // 1.1. Reset e-mail parameters
    ////////////////////////////////////////////////
        
    error = _4G.emailReset();

    if (error == 0)
    {
      USB.println(F("1.1. Reset e-mail parameters OK"));
    }
    else
    {
      USB.print(F("1.1. Error reset configuration. Code: "));
      USB.println(error, DEC);
    }

    ////////////////////////////////////////////////
    // 1.2. Set SMTP server
    ////////////////////////////////////////////////
    error = _4G.emailSetServerSMTP(smtp_server);

    if (error == 0)
    {
      USB.println(F("1.2. SMTP server set OK"));
    }
    else
    {
      USB.print(F("1.2. Error set server. Code: "));
      USB.println(error, DEC);
    }

    ////////////////////////////////////////////////
    // 1.3. Configure SMTP server security and port
    ////////////////////////////////////////////////
    error = _4G.emailConfigureSMTP(smtp_security, smtp_port);

    if (error == 0)
    {
      USB.println(F("1.3. Configure SMTP server OK"));
    }
    else
    {
      USB.print(F("1.3. Error configuring SMTP server. Code: "));
      USB.println(error, DEC);
    }
    
    ////////////////////////////////////////////////
    // 1.4. Set sender address
    ////////////////////////////////////////////////
    error = _4G.emailSetSender(sender_address, sender_user, sender_password);

    if (error == 0)
    {
      USB.println(F("1.4. Sender addres set OK"));
    }
    else
    {
      USB.print(F("1.4. Error set address. Code: "));
      USB.println(error, DEC);
    }

    ////////////////////////////////////////////////
    // 1.5. Save e-mail configuration settings
    ////////////////////////////////////////////////
    error = _4G.emailSave();

    if (error == 0)
    {
      USB.println(F("1.5. Save configuration OK"));
    }
    else
    {
      USB.print(F("1.5. Error saving configuration. Code: "));
      USB.println(error, DEC);
    }
  }
  else
  {
    USB.print(F("1. Error starting module. Code: "));
    USB.println(error, DEC);
  }

  USB.println(F("*** Setup done ***\n\n"));
}




void loop()
{
  //////////////////////////////////////////////////
  // 1. Switch ON
  //////////////////////////////////////////////////
  error = _4G.ON();

  if (error == 0)
  {
    USB.println(F("1. 4G module ready..."));

    ////////////////////////////////////////////////
    // 2. Send e-mail
    ////////////////////////////////////////////////
    error = _4G.emailSend(receiver_address, subject, message);

    if (error == 0)
    {
      USB.println(F("2. Sending e-mail OK"));
    }
    else
    {
      USB.print(F("2. Error sending e-mail. Code: "));
      USB.println(error, DEC);
    }
  }
  else
  {
    // Problem with the communication with the 4G module
    USB.print(F("1. 4G module not started. Error code: "));
    USB.println(error, DEC);
  }

  ////////////////////////////////////////////////
  // 3. Powers off the 4G module
  ////////////////////////////////////////////////
  USB.println(F("3. Switch OFF 4G module"));
  _4G.OFF();


  ////////////////////////////////////////////////
  // 4. Sleep
  ////////////////////////////////////////////////
  USB.println(F("4. Enter deep sleep..."));
  PWR.deepSleep("00:00:10:00", RTC_OFFSET, RTC_ALM1_MODE1, ALL_OFF);

  USB.ON();
  USB.println(F("5. Wake up!!\n\n"));
}

mikismart
Posts: 25
Joined: Thu Jul 11, 2019 8:33 am
Company: Samek Engineering

Re: 4G email reseting failure Error code:1

Post by mikismart » Thu Jul 11, 2019 2:56 pm

this is the output for the above code

Start program
*****************************
APN: etc
LOGIN: etc
PASSWORD: etc
*****************************
1. 4G module ready...
1.1. Error reset configuration. Code: 1
1.2. SMTP server set OK
1.3. Configure SMTP server OK
1.4. Sender addres set OK
1.5. Save configuration OK
*** Setup done ***


1. 4G module ready...
2. Error sending e-mail. Code: 2
3. Switch OFF 4G module
4. Enter deep sleep...

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: 4G email reseting failure Error code:1

Post by libelium-dev » Fri Jul 12, 2019 7:52 am

Hi,

Please upload the following example codes to the node and copy here the output to know more information about the module
http://www.libelium.com/development/was ... dule-info/
http://www.libelium.com/development/was ... work-info/

In addition, please upload the following code, then open the Serial monitor and at the bottom of the window select Carriage return. Now wait around 20 seconds and introduce the following commands at the upper part of the serial monitor. Please share with us the answer of the module.
  • AT
  • AT+CMEE=2
  • AT+CPIN?
  • AT#ERST

Code: Select all

void setup()
{  
  // init USB port
  USB.ON();
  USB.println(F("Bridge between USB port and SOCKET1"));

  Utils.setMuxSocket1();
  
  // begin serial communication
  beginSerial( 115200, SOCKET1);
  
  // switch on 3G/GPRS or expansion board in SOCKET1
  pinMode(GPRS_PW, OUTPUT);
  digitalWrite(GPRS_PW, HIGH);
  pinMode(DIGITAL6,OUTPUT);
  digitalWrite(DIGITAL6,HIGH);
  delay(1000);

  serialFlush(0);
  serialFlush(1);
  USB.ON();
}


void loop()
{   
  // UART1 ----> UART0 (USB)
  while( serialAvailable(1) > 0 ) 
  {
    // print
    printByte(serialRead(1),0);       
  }

  // USB (UART0) ----> UART1
  while( serialAvailable(0) > 0 ) 
  {
    // print 
    printByte(serialRead(0), 1);
  } 
}
Regards

mikismart
Posts: 25
Joined: Thu Jul 11, 2019 8:33 am
Company: Samek Engineering

Re: 4G email reseting failure Error code:1

Post by mikismart » Fri Jul 12, 2019 9:22 am

the output of the code
http://www.libelium.com/development/was ... dule-info/

Start program
4G module ready

1.1. Hardware revision: 1.00
1.2. Manufacturer identification: Telit
1.3. Model identification: LE910-EUG
1.4. Revision identification: 17.01.522
1.5. IMEI: 359852054648663
1.6. IMSI: 636019931240982
1.7. ICCID: 89251011740012409828
1.8. Show APN:
*****************************
APN: APN
LOGIN: user
PASSWORD: password
*****************************
1.9a. Temperature interval: 0
1.9b. Temperature: 27 Celsius degrees


and the output for the code
http://www.libelium.com/development/was ... work-info/
Start program

*****************************
APN: etc
LOGIN:
PASSWORD:
*****************************
1. 4G module ready
1.1. Module connected to network
1.2. RSSI: -61 dBm
1.3. Network type: HSDPA
1.4. Operator: ETH-MTN
2. Switch OFF 4G module
3. Enter deep sleep...
4. Wake up!!

mikismart
Posts: 25
Joined: Thu Jul 11, 2019 8:33 am
Company: Samek Engineering

Re: 4G email reseting failure Error code:1

Post by mikismart » Fri Jul 12, 2019 10:21 am

this is also the output for by inserting the commands
  • AT
    AT+CMEE=2
    AT+CPIN?
    AT#ERST

Code: Select all

void setup()
{  
  // init USB port
  USB.ON();
  USB.println(F("Bridge between USB port and SOCKET1"));

  Utils.setMuxSocket1();
  
  // begin serial communication
  beginSerial( 115200, SOCKET1);
  
  // switch on 3G/GPRS or expansion board in SOCKET1
  pinMode(GPRS_PW, OUTPUT);
  digitalWrite(GPRS_PW, HIGH);
  pinMode(DIGITAL6,OUTPUT);
  digitalWrite(DIGITAL6,HIGH);
  delay(1000);

  serialFlush(0);
  serialFlush(1);
  USB.ON();
}


void loop()
{   
  // UART1 ----> UART0 (USB)
  while( serialAvailable(1) > 0 ) 
  {
    // print
    printByte(serialRead(1),0);       
  }

  // USB (UART0) ----> UART1
  while( serialAvailable(0) > 0 ) 
  {
    // print 
 
printByte(serialRead(0), 1);
}
}

Bridge between USB port and SOCKET1
�AT

OK
AT+CMEE=2

OK
AT+CPIN?

+CPIN: READY

OK
AT#ERST

OK

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: 4G email reseting failure Error code:1

Post by libelium-dev » Mon Jul 15, 2019 7:54 am

Hi,

The emailReset() function sends the AT#ERST command to the module. The AT#ERST command has worked in your test so the emailReset() function should work too. What API are you using? Could you please try to download the complete IDE again which includes the last API v042 and try again.

Regards

mikismart
Posts: 25
Joined: Thu Jul 11, 2019 8:33 am
Company: Samek Engineering

Re: 4G email reseting failure Error code:1

Post by mikismart » Mon Jul 15, 2019 11:29 am

Hi
I Updated the api and the IDE with the latest one and the reseting problem is fixed but i can't send the email and it Error Code:2 so how can i fix this problem

mikismart
Posts: 25
Joined: Thu Jul 11, 2019 8:33 am
Company: Samek Engineering

Re: 4G email reseting failure Error code:1

Post by mikismart » Mon Jul 15, 2019 3:08 pm

Hi
when I do something the following outputs we get but their is also one problem the sending data is not deliver to receiver email and also their is no data on the sender email send history. what is the problem please help me?
Start program
*****************************
APN: etc
LOGIN: xxx
PASSWORD: xxx
*****************************
1. 4G module ready...
1.1. Reset e-mail parameters OK
1.2. SMTP server set OK
1.3. Configure SMTP server OK
1.4. Sender addres set OK
1.5. Save configuration OK
*** Setup done ***


1. 4G module ready...
2. Sending e-mail OK
3. Switch OFF 4G module
4. Enter deep sleep...
5. Wake up!!


1. 4G module ready...
2. Error sending e-mail. Code: 2
3. Switch OFF 4G module
4. Enter deep sleep...
5. Wake up!!


1. 4G module ready...
2. Error sending e-mail. Code: 2
3. Switch OFF 4G module
4. Enter deep sleep...
5. Wake up!!


1. 4G module ready...
2. Error sending e-mail. Code: 2
3. Switch OFF 4G module
4. Enter deep sleep...
5. Wake up!!

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: 4G email reseting failure Error code:1

Post by libelium-dev » Tue Jul 16, 2019 8:26 am

Hi,

We have just responded to you in your other topic. Please continue the conversation just in one topic.

Regards

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest