-1

I've recently bought a IOT-GA6 gsm module . I want to use it to send an mms but doesn't work. The SMS and call work. When I execute the void function (mms) the monitor shows the error message +CME EYROR:58. Does anybody know what this means and how to solve it? enter image description here

this is my code

include SoftwareSerial.h
include SD.h

define  CS    4

SoftwareSerial A6Module(2, 3);

File dataFile;

int i;

unsigned char data=0;

void setup()
{
  pinMode(PWR,OUTPUT);
  pinMode(CS,OUTPUT);

  A6Module.begin(115200);
  Serial.begin(115200);

  digitalWrite(PWR,LOW);
  delay(10);

  digitalWrite(PWR,HIGH);
  delay(10);

  if (!SD.begin(CS)) Serial.println("initialization failed!");
  else Serial.println("initialization done.");  
}

void loop()
{
  if(Serial.available())
  {
    while(Serial.available())
    {
      data=Serial.read();
      Serial.write(data);
      Serial.println("\n");
    }
    //data=0;
  }

  if(Serial.available())
  {
    data=Serial.read();
  }  

  if(data=='1')
  {
    A6Module.println("AT+CGMI\r"); //Manufacturer identification
  }

  if(data=='2')
  {
    A6Module.println("AT+CGMM\r"); //Model identification
  }

  if(data=='3')
  {
    A6Module.println("AT+CGMR\r"); //Software version
  }

  if(data=='4')
  {
    A6Module.println("AT+CGSN\r"); //IMEI number
  }

  if(data=='5')
  {
    A6Module.println("ATD+21369682909;\r"); //Calling
  }

  if(data=='6')
  {
    A6Module.println("ATH\r"); //Hang Up
  }

  if(data=='7')
  {
    A6Module.println("AT+CMGF=1");
    delay(2000);
    A6Module.print("AT+CMGS=\"+213696829093");
    A6Module.print(char(34));  // "
    A6Module.print(char(13));  // CR
    A6Module.print('\r');  // hex equivalent of newline
    delay(2000);
    A6Module.print("A6 test message");
    delay(500);
    A6Module.println (char(26));  //ctrl_z
  }

  if(data=='8')
  {
    A6Module.println("AT+CMGR=1\r"); //Read message
  }

  if(data=='9')
  {
   A6Module.println("AT+CMGD=1,0\r"); //Delete message
  }  

  if(data=='s') sendMMS();
  data=0;
}

void sendMMS()
{
  A6Module.print("AT+CMMSINIT");
  delay(100);

  if(A6Module.available())
  {
    while(A6Module.available()) Serial.write(A6Module.read());
  }
  A6Module.print("AT+CMMSCURL=\"http://mms.itelcel.com/servlets/mms\"");
  delay(100);

  if(A6Module.available())
  {
    while(A6Module.available()) Serial.write(A6Module.read());
  }
  A6Module.print("AT+CMMSCID=1\r");
  delay(100);

  if(A6Module.available())
  {
    while(A6Module.available()) Serial.write(A6Module.read());
  }
  A6Module.print("AT+CMMSPROTO=\"148.233.151.240\",8080");
  delay(100);

  if(A6Module.available())
  {
    while(A6Module.available()) Serial.write(A6Module.read());
  }
  A6Module.print("AT+CMMSSENDCFG=6,3,0,0,2,4\r");
  delay(100);

  if(A6Module.available())
  {
    while(A6Module.available()) Serial.write(A6Module.read());
  }
  A6Module.print("AT+SAPBR=3,1,\"CONTYPE\",\"MMS\"\r");
  delay(100);

  if(A6Module.available())
  {
    while(A6Module.available()) Serial.write(A6Module.read());
  }
  A6Module.print("AT+SAPBR=3,1,\"APN\",\"mms.itelcel.com\"");
  delay(100);

  if(A6Module.available())
  {
    while(A6Module.available()) Serial.write(A6Module.read());
  }
  A6Module.print("AT+SAPBR=1,1");
  delay(4000);
  if(A6Module.available())

  {
    while(A6Module.available()) Serial.write(A6Module.read());
  }
  A6Module.print("AT+SAPBR=2,1");
  delay(4000);

  if(A6Module.available())
  {
    while(A6Module.available()) Serial.write(A6Module.read());
  }
  A6Module.print("AT+CMMSEDIT=1");
  delay(100);

  if(A6Module.available())
  {
    while(A6Module.available()) Serial.write(A6Module.read());
  }
  A6Module.print("AT+CMMSDOWN=\"PIC\",19293,2000000,\"test.jpg\"\r");
  delay(1000);

  if(A6Module.available())
  {
    while(A6Module.available()) Serial.write(A6Module.read());
  }

  dataFile=SD.open("test.jpg");
  i=0;
  if(dataFile)
  {
    while(dataFile.available())
    {
      data=dataFile.read();
      if(data<0x10) Serial.print("0");
      Serial.print(data,HEX);
      i++;
      if((i%40)==0) Serial.println();
      A6Module.write(data);
    }
    dataFile.close();
  }  
  else
  {
    Serial.println("error opening test.jpg");
  }

  delay(1000);
  A6Module.print("AT+CMMSRECP=\"+213696829093");
  delay(100);

  if(A6Module.available())
  {
    while(A6Module.available()) Serial.write(A6Module.read());
  }
  A6Module.print("AT+CMMSVIEW\r");
  delay(2000);

  if(A6Module.available())
  {
    while(A6Module.available()) Serial.write(A6Module.read());
  }
  A6Module.print("AT+CMMSSEND\r");
  delay(2000);

  if(A6Module.available())
  {
    while(A6Module.available()) Serial.write(A6Module.read());
  }
  A6Module.print("AT+CMMSEDIT=0\r");
  delay(2000);

  if(A6Module.available())
  {
    while(A6Module.available()) Serial.write(A6Module.read());
  }
  A6Module.print("AT+CMMSTERM\r");
  delay(2000);

  if(A6Module.available())
  {
    while(A6Module.available()) Serial.write(A6Module.read());
  }
}
  • 2
    which line causes the error? ... use print statements to debug the program flow – jsotola May 31 '18 at 16:20
  • all commands beginning as 'AT+CMMS' to A6 receives +cme error 58 I dont' know why! – b chabb Jan 10 at 15:55
1

The Arduino Uno does not support the maximum current requested by GA6, try an external source for the gprs module of at least 6V using common ground between the gprs module and the arduino.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.