arduino-libraries / MKRGSM

GNU Lesser General Public License v2.1
55 stars 51 forks source link

Arduino MKRGSM1400 how to set the RAT and Band in UMTS mode? #108

Open AntonioRiccelli77 opened 4 years ago

AntonioRiccelli77 commented 4 years ago

Hello I need to set my MKRGSM1400 for working in to 3G mode for upload a file vs an hosted FTP server, but I noticed that although I have set the band on UMTS the upload speed cannot exceed 2.07Kbs. below is the function that sets this operation in my function with setRAT("2,2");

//Questo metodo và eseguito una sola volta a seguito di un cambio banda e basta
bool setRAT(String choice){
  MODEM.debug();

  String response;

   //Beginning the band manager restarts the modem
  delay(4000);
  Serial.println("Restarting modem...");
  band.begin();
  Serial.println("Modem restarted.");
  delay(1000);

  // Change the band
  String newBandName=GSM_MODE_UMTS;
  bool operationSuccess;
  operationSuccess = band.setBand(newBandName);
  // Tell the user if the operation was OK
  if (operationSuccess) {
    Serial.println("Success");
  } else {
    Serial.println("Error while changing band");
  }

  String bandName = band.getBand(); // Get and print band name
  Serial.println("Current BAND is: ");
  Serial.println(bandName);
  //set RAT
  Serial.print("Disconnecting from network: ");
  MODEM.sendf("AT+COPS=2");
  MODEM.waitForResponse(10000);
  Serial.println("done.");

  Serial.print("Setting Radio Access Technology: ");
  MODEM.sendf("AT+URAT=%s", choice.c_str());
  MODEM.waitForResponse(10000, &response);
  //Serial.println("done.");------------------------------------------------------------

  Serial.print("Switch off the module: ");
  MODEM.sendf("AT+CPWROFF");//https://www.u-blox.com/sites/default/files/AT-CommandsExamples_AppNote_%28UBX-13001820%29.pdf
  MODEM.waitForResponse(10000, &response);
  Serial.println("done.");

  MODEM.noDebug();
  return true;
}
AntonioRiccelli77 commented 4 years ago

Hello I need to set my MKRGSM1400 for working in to 3G mode for upload a file vs an hosted FTP server, but I noticed that although I have set the band on UMTS the upload speed cannot exceed 2.07Kbs. below is the function that sets this operation in my function with setRAT("2,2");

//Questo metodo và eseguito una sola volta a seguito di un cambio banda e basta
bool setRAT(String choice){
  MODEM.debug();

  String response;

   //Beginning the band manager restarts the modem
  delay(4000);
  Serial.println("Restarting modem...");
  band.begin();
  Serial.println("Modem restarted.");
  delay(1000);

  // Change the band
  String newBandName=GSM_MODE_UMTS;
  bool operationSuccess;
  operationSuccess = band.setBand(newBandName);
  // Tell the user if the operation was OK
  if (operationSuccess) {
    Serial.println("Success");
  } else {
    Serial.println("Error while changing band");
  }

  String bandName = band.getBand(); // Get and print band name
  Serial.println("Current BAND is: ");
  Serial.println(bandName);
  //set RAT
  Serial.print("Disconnecting from network: ");
  MODEM.sendf("AT+COPS=2");
  MODEM.waitForResponse(10000);
  Serial.println("done.");

  Serial.print("Setting Radio Access Technology: ");
  MODEM.sendf("AT+URAT=%s", choice.c_str());
  MODEM.waitForResponse(10000, &response);
  //Serial.println("done.");------------------------------------------------------------

  Serial.print("Switch off the module: ");
  MODEM.sendf("AT+CPWROFF");//https://www.u-blox.com/sites/default/files/AT-CommandsExamples_AppNote_%28UBX-13001820%29.pdf
  MODEM.waitForResponse(10000, &response);
  Serial.println("done.");

  MODEM.noDebug();
  return true;
}

this is a debug informations:

AT
OK
AT+IPR=921600
OK
AT
OK
AT+UPSV=3       
OK
Modem restarted.
AT+URAT=1,2
OK
AT+UBANDSEL=2100
OK
Success
AT+UBANDSEL?
+UBANDSEL: 2100

OK
Current BAND is:
UMTS_MODE
Disconnecting from network: AT+COPS=2
OK
done.
Setting Radio Access Technology: AT+URAT=2,2
OK
Switch off the module: AT+CPWROFF
OK
done.
card initialized.
System ready...
Current Carrier is: vodafone IT
Signal Strenght: 20
Starting FTP client.
SD opened
Command connected
220-#
220-#
220-#  Aruba.it
220-#  The Web Hosting Company     
220-#
220-#
220 This is a private system - No anonymous login
331 User XXXX@XXXX.it OK. Password required
230 OK. Current restricted directory is /
215 UNIX Type: L8
200 TYPE is now 8-bit binary
227 Entering Passive Mode (89,46,104,211,195,99)
Data port: 50019
Data connected
150 Accepted data connection
Writing
Data disconnected
226-File successfully transferred
**226 20.440 seconds (measured here), 2.06 Kbytes per second
221-Goodbye. You uploaded 43 and downloaded 0 kbytes.**
221 Logout.
Command disconnected
SD closed
Stop Acquisition Observations