Arduino MKR GSM 1400

Good evening to all, I write because and for some time I have problems with the MKR GSM 1400 module.
The problem I have is the following, I can connect my module, I can select the port and everything, I compile the program and it doesn't give me any error, when I go to load it it disconnects from the computer and reconnects itself and I get this error message:

Sketch uses 33668 bytes (12%) of program storage space. Maximum is 262144 bytes.
Atmel SMART device 0x10010005 found
Device       : ATSAMD21G18A
Chip ID      : 10010005
Version      : v2.0 [Arduino:XYZ] Oct  4 2017 08:53:16
Address      : 8192
Pages        : 3968
Page Size    : 64 bytes
Total Size   : 248KB
Planes       : 1
Lock Regions : 16
Locked       : none
Security     : false
Boot Flash   : true
BOD          : true
BOR          : true
Arduino      : FAST_CHIP_ERASE
Arduino      : FAST_MULTI_PAGE_WRITE
Arduino      : CAN_CHECKSUM_MEMORY_BUFFER
Erase flash
done in 0.828 seconds

Write 34228 bytes to flash (535 pages)

[===                           ] 11% (64/535 pages)
[=======                       ] 23% (128/535 pages)
[==========                    ] 35% (192/535 pages)
[==============                ] 47% (256/535 pages)
[=================             ] 59% (320/535 pages)
[=====================         ] 71% (384/535 pages)
[=========================     ] 83% (448/535 pages)
[============================  ] 95% (512/535 pages)
[==============================] 100% (535/535 pages)
done in 0.226 seconds

Verify 34228 bytes of flash with checksum.
Verify successful
done in 0.035 seconds
CPU reset.

The module that came to me has no antenna and no external battery.

My question and the following one, it's possible that the problem is due to the fact that I don't have the battery and when I go to charge the program I have a momentary Reset? on the other modules it never happened to me, the program seems right to me and it's the same as those provided by arduino...
To eliminate the battery problem I tried to power the module on the GND and on VIN but it disconnects anyway...

Has anyone had anything like this happened before? Do you know how to solve this problem?

Good evening to all and I hope that someone can help me...

I also put the code I use, maybe it can help:

// include the GSM library
#include <MKRGSM.h>

//#include "arduino_secrets.h" 
// Please enter your sensitive data in the Secret tab or arduino_secrets.h
// PIN Number
#define SECRET_PINNUMBER     ""
const char PINNUMBER[] = SECRET_PINNUMBER;

// initialize the library instances
GSM gsmAccess;
GSM_SMS sms;

// Array to hold the number a SMS is retreived from
char senderNumber[20];

void setup() {
  // initialize serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  Serial.println("SMS Messages Receiver");

  // connection state
  bool connected = false;

  // Start GSM connection
  while (!connected) {
    if (gsmAccess.begin() == GSM_READY) {
      connected = true;
    } else {
      Serial.println("Not connected");
      delay(1000);
    }
  }

  Serial.println("GSM initialized");
  Serial.println("Waiting for messages");
}

void loop() {
  int c;

  // If there are any SMSs available()
  if (sms.available()) {
    Serial.println("Message received from:");

    // Get remote number
    sms.remoteNumber(senderNumber, 20);
    Serial.println(senderNumber);

    // An example of message disposal
    // Any messages starting with # should be discarded
    if (sms.peek() == '#') {
      Serial.println("Discarded SMS");
      sms.flush();
    }

    // Read message bytes and print them
    while ((c = sms.read()) != -1) {
      Serial.print((char)c);
    }

    Serial.println("\nEND OF MESSAGE");

    // Delete message from modem memory
    sms.flush();
    Serial.println("MESSAGE DELETED");
  }

  delay(1000);

}

If you try the blink Program, what happens ?

Hi, what do you mean, blink program?

The examples of programs I found are those in the MKRGSM.h library

I also tried to load an empty project just to see if it gave me problems but it still disconnects and connects.

Mozzini97:
I also tried to load an empty project just to see if it gave me problems but it still disconnects and connects.

That's kinda what I meant. a dumb simple program to see what the arduino is doing.

what do you mean with "it still disconnects and connects"

(did you remove the black foam the MKR is delivered with? it's conductive so short circuits pins possible )

Do you have in mind when you connect your phone to the computer and if you have the volume turned on does it make sounds? and you also get notification that the device is connected...
When I load the program my MKR GSM 1400 does the same thing, it never happened to me with any other arduino I connected.
And then the message I published above comes out in orange...

The connection cable is an original SAMSUNG and anyway my computer recognizes the card.

I'm on a mac, not a PC. I suppose the sound means that a new USB device has been found

when you load your program on it starts running, it's possible that the USB Serial is reset

what do you see if you load this program and open the console at 115200 bauds

void setup()
{
  Serial.begin(115200);
  while(!Serial);
}

void loop()
{
  Serial.println(millis());
  delay(1000);
}

He always does the same thing, I do not understand why he does a reset of the CPU, in the program I do not tell him to do it ... To someone and already happened?

Tell us what you see in the console.

I see this message in the console:

Lo sketch usa 33676 byte (12%) dello spazio disponibile per i programmi. Il massimo è 262144 byte.
Atmel SMART device 0x10010005 found
Device       : ATSAMD21G18A
Chip ID      : 10010005
Version      : v2.0 [Arduino:XYZ] Oct  4 2017 08:53:16
Address      : 8192
Pages        : 3968
Page Size    : 64 bytes
Total Size   : 248KB
Planes       : 1
Lock Regions : 16
Locked       : none
Security     : false
Boot Flash   : true
BOD          : true
BOR          : true
Arduino      : FAST_CHIP_ERASE
Arduino      : FAST_MULTI_PAGE_WRITE
Arduino      : CAN_CHECKSUM_MEMORY_BUFFER
Erase flash
done in 0.825 seconds

Write 34236 bytes to flash (535 pages)

[===                           ] 11% (64/535 pages)
[=======                       ] 23% (128/535 pages)
[==========                    ] 35% (192/535 pages)
[==============                ] 47% (256/535 pages)
[=================             ] 59% (320/535 pages)
[=====================         ] 71% (384/535 pages)
[=========================     ] 83% (448/535 pages)
[============================  ] 95% (512/535 pages)
[==============================] 100% (535/535 pages)
done in 0.211 seconds

Verify 34236 bytes of flash with checksum.
Verify successful
done in 0.035 seconds
CPU reset.
Error downloading http://downloads.arduino.cc/packages/package_staging_index.json.

In the last line of information it says CPU reset but I don't understand why it does a reset, I in the program don't tell you, it does it so randomly...

Attached I put the image of my main settings

I think the reset is ok after upload

There is probably an issue with a partially downloaded json. This could happen if there is an incomplete json file for the board manager in Arduino Data folder

I’d say remove the SAMD install, trash the IDE and reinstall the ide from latest version download and look to spyware (Cf this discussion)

Thank you very much. I've tried these two procedures:

The problem with Json seems solved but I still have this error message:

Sketch uses 12168 bytes (4%) of program storage space. Maximum is 262144 bytes.
Atmel SMART device 0x10010005 found
Device       : ATSAMD21G18A
Chip ID      : 10010005
Version      : v2.0 [Arduino:XYZ] Oct  4 2017 08:53:16
Address      : 8192
Pages        : 3968
Page Size    : 64 bytes
Total Size   : 248KB
Planes       : 1
Lock Regions : 16
Locked       : none
Security     : false
Boot Flash   : true
BOD          : true
BOR          : true
Arduino      : FAST_CHIP_ERASE
Arduino      : FAST_MULTI_PAGE_WRITE
Arduino      : CAN_CHECKSUM_MEMORY_BUFFER
Erase flash
done in 0.825 seconds

Write 12328 bytes to flash (193 pages)

[=========                     ] 33% (64/193 pages)
[===================           ] 66% (128/193 pages)
[============================= ] 99% (192/193 pages)
[==============================] 100% (193/193 pages)
done in 0.076 seconds

Verify 12328 bytes of flash with checksum.
Verify successful
done in 0.014 seconds
CPU reset.

This is the code I use to do the test:

void setup() {
pinMode(6, OUTPUT);
}

void loop()

 {
 digitalWrite(6, HIGH); 
 delay(300);
 digitalWrite(6, LOW); 
 delay(300);
}

The code is loaded on the board because actually the LED blinks, when I go to write more complex programs but does not make me go the serial monitor...

I don't understand why it does all those operations for such a simple program, I tried to download different versions of arduino, I uninstalled it, I tried everything but that message always comes out. Does anyone have other solutions? If I can not solve this problem I can not advance with the project and are already several days that I am blocked ...
Thanks a lot to everyone and have a nice day

Seems solved to me. There is no error message just information

The code is compiled, uploaded to the arduino, then vérifier and then the arduino reboot and launch your program.

I don't understand where is your problem now?

when I go to write more complex programs but does not make me go the serial monitor...

What do you mean with that??

The problem is that I do not see anything on the serial monitor, I removed the code to the sim and at the moment there are about 2 fr so the credit is sufficient.

// include the GSM library
#include <MKRGSM.h>
#define SECRET_PINNUMBER     ""
//#include "arduino_secrets.h" 
// Please enter your sensitive data in the Secret tab or arduino_secrets.h
// PIN Number
const char PINNUMBER[] = SECRET_PINNUMBER;

// initialize the library instances
GSM gsmAccess;
GSM_SMS sms;

// Array to hold the number a SMS is retreived from
char senderNumber[20];

void setup() {
  // initialize serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  Serial.println("SMS Messages Receiver");

  // connection state
  bool connected = false;

  // Start GSM connection
  while (!connected) {
    if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
      connected = true;
    } else {
      Serial.println("Not connected");
      delay(1000);
    }
  }

  Serial.println("GSM initialized");
  Serial.println("Waiting for messages");
}

void loop() {
  int c;

  // If there are any SMSs available()
  if (sms.available()) {
    Serial.println("Message received from:");

    // Get remote number
    sms.remoteNumber(senderNumber, 20);
    Serial.println(senderNumber);

    // An example of message disposal
    // Any messages starting with # should be discarded
    if (sms.peek() == '#') {
      Serial.println("Discarded SMS");
      sms.flush();
    }

    // Read message bytes and print them
    while ((c = sms.read()) != -1) {
      Serial.print((char)c);
    }

    Serial.println("\nEND OF MESSAGE");

    // Delete message from modem memory
    sms.flush();
    Serial.println("MESSAGE DELETED");
  }

  delay(1000);

}
SMS Messages Receiver

Is it right how I define the PIN? since I removed it by reading in the various forums recommend to put this:

#define SECRET_PINNUMBER     ""

I don't know where I'm wrong... This is the first time I've used this module and I'm in enough trouble.

Good day to you all :slight_smile:

See post 5 now.

what do you see if you load this program and open the console at 115200 bauds

void setup()
{
  Serial.begin(115200);
  while(!Serial);
}

void loop()
{
  Serial.println(millis());
  delay(1000);
}

Regarding [color=blue]SECRET_[/color]PINNUMBER, are you using the Arduino Create Editor?

-> cf this information

have you tried calling this something different?

If I upload your program to the serial Monitor I read this:

363886
364886
365886
366886
367886
368886
369886
370886

so it works...
as for Arduino Create Editor I do not know what it is, I would like to make the program as simple as possible I need to read a message and just send it.
If I don't use Arduino Create Editor, how do I change the program?

I'm trying to make a program that makes me see on the serial monitor a message that I send him through another phone, once done this program I make do to go on.

I read that you can save important data such as phone number, PIN and so on in a folder but honestly I do not need all this security, can you tell me how to delete parts that I do not need?
Thank you and I wish you a good evening :slight_smile:

Mozzini97:
as for Arduino Create Editor I do not know what it is

"Arduino Create Editor" (more commonly called "Arduino Web Editor") is a cloud based alternative to the Arduino IDE:

Mozzini97:
If I don't use Arduino Create Editor, how do I change the program?

Just like you would any other sketch. The only relevant difference between the Arduino IDE and the Arduino Web Editor in this particular case is that the the Arduino Web Editor has a more "pointy-clicky" approach to the "Secret Tab", as I already explained to your in your previous thread:

pert:
The idea behind arduino_secrets.h is that you define all your private information in that file so that you can share the main sketch file without revealing private information. Many people have accidentally shared information they didn't intend to with their code and had to scramble to change passwords, etc. before some ne'er-do-well uses it for malicious purposes. In fact, black hat hackers are constantly running scans of the Internet looking to harvest information from these types of leaks.

The Arduino Web Editor has a feature that makes it very easy to share your sketches via "Share URLs" and when you do that the arduino_secrets.h file is automatically cleared so anyone viewing your shared sketch won't be able to see your private information and instead can define their own information in the file. In the Arduino Web Editor, the file will be shown as a tab named "Secrets" with a form to fill in the information, which then generates the #define directives for the macros. Anytime you write a name in your sketch in the Arduino Web Editor that starts with "SECRET_", a new field is added to the Secret tab.

In the Arduino IDE, the file will be shown as a tab named arduino_secrets.h and you will find the standard #define directives there.

However, that's not even really relevant here because you commented out the #include directive for arduino_secrets.h in your sketch, so you're not even using the "Secret Tab" feature.