Very strange problem during beginning with MKR Wifi 1010

Hi all,
I am not really a newbe in Arduino using and programming, but I am now very troubled ...
I'm digging into the IoT domain, and make tests on my fresly purchased MKR WiFI 1010.
For example the Internet RTC, sending push with Prowl, testing Serial connexion and data logging with SD shield, Writing a simple web server, etc...
Suddenly the sketch upload stucks for several minutes and finally displays an upload error, without more explanations.
Sometimes, the IDE crashes.
After changing of laptop, changing of ports, upadating to the last IDE version, many hard reset, nothing better.
I finally returned the MKR to the seller asking for warranty, and bought 2 more ones to another store.
Once receiving them, i try to upload a web server sketch for de-bugging : unsuccessfuly, than an example of RTC sketch, and again ... uploading error after long uplaoding minutes, without any more comment. Than an empty program (just empty setup + empty loop) : no more result...
Is there a "deep reset" method ? or any tip allowing me to get out from this crazy loop ???
In advance thanks a lot for your advices....
J.

In order to gather more information that might help us to troubleshoot your problem, I'm going to ask you to post the full output from the upload when in verbose mode.

Please do this:

  1. Select File > Preferences from the Arduino IDE's menus.
  2. Uncheck the checkbox next to Show verbose output during: compilation
  3. Check the checkbox next to Show verbose output during: upload.
  4. Click the OK button.
  5. Attempt an upload, as you did before.
  6. After the upload fails, you'll see a button on the right side of the orange bar in the Arduino IDE: Copy error messages. Click that button. This copies the full output to the clipboard.
  7. Open a forum reply here by clicking the Reply button.
  8. Click the </> icon on the post composer toolbar. This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
    Code block
  9. Press Ctrl+V. This will paste the error output from the upload into the code block.
  10. Move the cursor outside of the code tags before you add any additional text to your reply.
  11. Click the Reply button to post the output.

Thanks for your support.
Hereafter the feedback after trying to upload a minimum sketch (empty sertuo + empty loop :

Sketch uses 12000 bytes (4%) of program storage space. Maximum is 262144 bytes.
Global variables use 2204 bytes (6%) of dynamic memory, leaving 30564 bytes for local variables. Maximum is 32768 bytes.
Forcing reset using 1200bps open/close on port COM8

I was a little too fast for posting. This was made during the - very long - waiting time of uploading.
Now the upload ends with the following commplete message :

Arduino: 1.8.15 (Windows 10), Board: "Arduino MKR WiFi 1010"

Sketch uses 12000 bytes (4%) of program storage space. Maximum is 262144 bytes.

Global variables use 2204 bytes (6%) of dynamic memory, leaving 30564 bytes for local variables. Maximum is 32768 bytes.

Forcing reset using 1200bps open/close on port COM8

PORTS {COM8, } / {COM8, } => {}

PORTS {COM8, } / {COM8, } => {}

PORTS {COM8, } / {COM8, } => {}

PORTS {COM8, } / {COM8, } => {}

PORTS {COM8, } / {COM8, } => {}

PORTS {COM8, } / {COM8, } => {}

PORTS {COM8, } / {COM8, } => {}

PORTS {COM8, } / {COM8, } => {}

PORTS {COM8, } / {COM8, } => {}

PORTS {COM8, } / {COM8, } => {}

PORTS {COM8, } / {COM8, } => {}

PORTS {COM8, } / {COM8, } => {}

PORTS {COM8, } / {COM8, } => {}

PORTS {COM8, } / {COM8, } => {}

PORTS {COM8, } / {COM8, } => {}

PORTS {COM8, } / {COM8, } => {}

PORTS {COM8, } / {COM8, } => {}

PORTS {COM8, } / {COM8, } => {}

PORTS {COM8, } / {COM8, } => {}

PORTS {COM8, } / {COM8, } => {}

Uploading using selected port: COM8

C:\Users\Admin\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.7.0-arduino3/bossac.exe -i -d --port=COM8 -U true -i -e -w -v C:\Users\Admin\AppData\Local\Temp\arduino_build_460058/Vide.ino.bin -R 

An error occurred while uploading the sketch



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I tried to check my 3rd MKR in this sequence :

  • upload a sketch containing a simple webserver (to check internet connection).
    Result : OK
  • upload a sketch doing an serial write / read (to check the response time)
    Result : impossible to open the serial monitor + IDE stucks + no more uploads possible (like the 1st & 2nd MKR).
    I must tell that this Serial sketch ran perfectly on a Mega.
    I looks like a very repeatitive bootloader problem (3 times on 3 modules). Having digged a little the firmware flashing procedure here and there, I find it very complex regarding to the occurence of this problem.
    Why can we not find anywhere any warning or precaution or programming advises in order to avoid this ? It seems beeing contagious of the MKR platform.

The way uploads work is:

  1. The Arduino IDE (or the upload tool used by the Arduino IDE) sends a signal for the microcontroller to reset.
  2. The microcontroller resets.
  3. The bootloader runs and waits (normally only for a short time) for an upload to start.
  4. The upload tool sends the program to the microcontroller, where the bootloader writes it to flash memory.

On the boards with native USB (like the MK WiFi 1010 you're using), the way the IDE signals the microcontroller to reset is by opening a serial connection at 1200 baud. There is some special code running on the microcontroller in the background of your sketch that does the reset when it detects that 1200 baud connection.

In some cases, your sketch code might cause that reset code to be missing or not working correctly, which will mean the bootloader never runs and the upload fails with the error you're seeing. The fix is to manually reset the board.

Try this:

  1. Press and release the reset button on your board quickly twice. You should now see the LED on the board pulsing, which means the bootloader is running. The double press causes the bootloader to run indefinitely (until the board is reset, powered off, or an upload is done), which means you don't need to get the timing of the reset just right.
  2. Select the port of your board from the Tools > Port menu. The port will be different when the bootloader is running so don't assume you already have the correct port selected.
  3. Start an upload in the Arduino IDE.

The upload should now finish successfully. After this, you should be able to go back to doing normal uploads without needing to press the reset button. If you still need to do the reset trick to do uploads after this, the problem may be caused by your code. You can verify this by uploading a simple sketch like File > Examples > 01.Basics > BareMinimum.

Your answer was very usefull and let me make a big step forwards...
Understanding the upload sequence is to me something precious...
I followed stictly your tips and retrieved a normal sketch upload with simple examples found in the basic directory.
I tried than to upload one my sketches freezing the MK module earlyer (playing with read / print Serial) and the problem appears again.
Here the error message during upload (that's still keeps uploading...) :

Le croquis utilise 27560 octets (10%) de l'espace de stockage de programmes. Le maximum est de 262144 octets.
Les variables globales utilisent 2884 octets (8%) de mémoire dynamique, ce qui laisse 29884 octets pour les variables locales. Le maximum est de 32768 octets.
processing.app.debug.RunnerException
	at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:152)
	at cc.arduino.UploaderUtils.upload(UploaderUtils.java:77)
	at processing.app.SketchController.upload(SketchController.java:732)
	at processing.app.SketchController.exportApplet(SketchController.java:703)
	at processing.app.Editor$UploadHandler.run(Editor.java:2055)
	at java.lang.Thread.run(Thread.java:748)
Caused by: processing.app.SerialException: Erreur de la commande « touch » sur le port série « COM10 ».
	at processing.app.Serial.touchForCDCReset(Serial.java:107)
	at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:136)
	... 5 more
Caused by: jssc.SerialPortException: Port name - COM10; Method name - openPort(); Exception type - Port not found.
	at jssc.SerialPort.openPort(SerialPort.java:167)
	at processing.app.Serial.touchForCDCReset(Serial.java:101)
	... 6 more

You're welcome. I agree that it is very useful to understand the upload process, and also useful to know about the double reset technique that allows us to easily recover our boards and thus feel more free to experiment with less fear that a mistake will cost us the loss of precious hardware.

Were you sure to select the port of the board from the Arduino IDE? Keep in mind that the port usually changes after you put the board in bootloader mode, and that it may change again after that upload is finished.

Sorry, but I was posting about a problem wich was solved shortly after (COM port change after double reset).
Inbetween I have a very representative example of the strange attitude of the MKR :

Hereafter an extract of a sketch dedicated to check the string manipulation (issued from my heating installation that must be upgraded) :

float tp = 18.2;  //Température actuelle Ch. Parents
float te = 18.7;  //Température actuelle Ch. Eva
float tv = 17.5;  //Température actuelle Ch. Victor
float cs = 21;    //Consigne Température actuelle Salon
float cp = 18.5;  //Consigne Température actuelle Ch. Parents
float ce = 15;    //Consigne Température actuelle Ch. Eva
float cv = 15;    //Consigne Température actuelle Ch. Victor
int tex = 0;     //Température extérieure
int tch = 0;     //Température Chaudière
int tct = 0;     //Température circuit
int tec = 0;     //Température ECS
int alarm = 0;    //Numéro d'alarme
int cons = 0;  //Consommation session en temps de vis (s)
int all = 0;    //Temps d'allumage de la session ou maxi si pas en chauffe
int fum = 0;    //Température de fumée actuelle ou maxi si pas en chauffe
int ses = 0;     //Nombre de sessions de la journée
int state = 0;    //Etat du graphe de chauffe
int Date = 0;     //Graphe d'envoi de date
int Mex = 0;
int mex = 0;
int Mfu = 0;
int Mal = 0;
bool ecs = 0;     //Etat de besoin d'ECS
bool hiver = 0;   //Mode hiver
char local =' ';  //Lettre du local concerné
char c;
String etat = "Chaudi&egravere&nbsppr&ecircte";   //chaîne de l'état (en clair)
String Rtemp = "203182197167";                    // températures réelles locaux
String Chaud = "65353600331481236532125512";      // état chaudière
String TimeJ = "135080090090";                    // heures de début de jour ASCII 4 x 3 caractères
String TimeN = "230230225225";                    // heures de début de nuit ASCII 4 x 3 caractères
String TempJ = "210150150150";                    // températures de jour ASCII 4 x 3 caractères
String TempN = "195185150150";                    // températures de nuit ASCII 4 x 3 caractères
String consEnCours = "210150150150150";           // Consignes appliquées en temps réel
String chaufEnCours = "0101";                     // Demandes de chauffage en temps réel
String Msg;
String stat ="30/8/2021  4.29  16  21  182 171 12 \r";  // chaîne contenu du fichier Log.txt
int DJS;                    // heure de début jour Salon ASCII 3 caractères
int DJP;                    // heure de début jour ChP ASCII 3 caractères
int DJE;                    // heure de début jour ChE ASCII 3 caractères
int DJV;                    // heure de début jour ChV ASCII 3 caractères
int DNS;                    // heure de début nuit Salon ASCII 3 caractères
int DNP;                    // heure de début nuit ChP ASCII 3 caractères
int DNE;                    // heure de début nuit ChE ASCII 3 caractères
int DNV;                    // heure de début nuit ChV ASCII 3 caractères
int djs;                    // heure de début jour Salon ASCII 3 caractères
int djp;                    // heure de début jour ChP ASCII 3 caractères
int dje;                    // heure de début jour ChE ASCII 3 caractères
int djv;                    // heure de début jour ChV ASCII 3 caractères
int dns;                    // heure de début nuit Salon ASCII 3 caractères
int dnp;                    // heure de début nuit ChP ASCII 3 caractères
int dne;                    // heure de début nuit ChE ASCII 3 caractères
int dnv;                    // heure de début nuit ChV ASCII 3 caractères
int affich = 0;
bool sal;                    // Chauffe en cours salon
bool par;                    // Chauffe en cours Ch. Parents
bool eva;                    // Chauffe en cours Ch. Eva
bool vic;                    // Chauffe en cours Ch. Victor
float TJS;                   // Consigne température de jour Salon ASCII 3 caractères
float TJP;                   // Consigne température de jour CHP ASCII 3 caractères
float TJE;                   // Consigne température de jour ChE ASCII 3 caractères
float TJV;                   // Consigne température de jour ChV ASCII 3 caractères
float TNS;                   // Consigne température de nuit Salon ASCII 3 caractères
float TNP;                   // Consigne température de nuit ChP ASCII 3 caractères
float TNE;                   // Consigne température de nuit ChP ASCII 3 caractères
float TNV;                   // Consigne température de nuit ChV ASCII 3 caractères
float tjs;                   // Consigne température de jour Salon ASCII 3 caractères
float tjp;                   // Consigne température de jour CHP ASCII 3 caractères
float tje;                   // Consigne température de jour ChE ASCII 3 caractères
float tjv;                   // Consigne température de jour ChV ASCII 3 caractères
float tns;                   // Consigne température de nuit Salon ASCII 3 caractères
float tnp;                   // Consigne température de nuit ChP ASCII 3 caractères
float tne;                   // Consigne température de nuit ChP ASCII 3 caractères
float tnv;                   // Consigne température de nuit ChV ASCII 3 caractères

void setup() {
  Serial.begin(9600);
}

void loop() {

  //****************************************** Récupération valeurs chaudière via ventilation ***********************************
  
  while ((c = Serial.read()) > '\n') Msg += (char) c; 
       if (c == '\n')
          {if (Msg.substring(0,3).equals("tch")) 
            { tch = (int)(Msg.substring(3,5)).toInt();
              Serial.print("Temp Chaudiere :");
              Serial.println(tch);
              Msg = ""; }
          if (Msg.substring(0,3).equals("tct")) 
            { tct = (int)(Msg.substring(3,5)).toInt();
              Serial.print("Temp Circuit :");
              Serial.println(tct);
              Msg = ""; }
          if (Msg.substring(0,3).equals("tex")) 
            { tex = ((int)(Msg.substring(3,5)).toInt())-20;
              Serial.print("Temp Ext :");
              Serial.println(tex);
              Msg = ""; }
          if (Msg.substring(0,3).equals("ecs")) 
            { ecs = (bool)(Msg.substring(3,4)).toInt();
              Serial.print("Besoin d'ECS :");
              Serial.println(ecs);
              Msg = ""; }
          if (Msg.substring(0,5).equals("alarm")) 
            { alarm = (int)(Msg.substring(5,6)).toInt();
              Serial.print("Alarme :");
              Serial.println(alarm);
              Msg = ""; }
          if (Msg.substring(0,5).equals("state")) 
            { state = ((int)(Msg.substring(5,7)).toInt())-10;
              Serial.print("Etat :");
              Serial.println(state);
              Msg = ""; }
          if (Msg.substring(0,5).equals("hiver")) 
            { hiver = (bool)(Msg.substring(5,6)).toInt();
              Msg = ""; 
              Serial.print("Hiver :");
              Serial.println(hiver);}
          if (Msg.substring(0,3).equals("tec")) 
            { tec = (int)(Msg.substring(3,5)).toInt();
              Serial.print("Temp ECS :");
              Serial.println(tec);
              Msg = ""; }
          if (Msg.substring(0,4).equals("cons"))   
            { cons = ((int)(Msg.substring(4,9)).toInt())-10000;
              Serial.print("Consommation :");
              Serial.println(cons);
              Msg = ""; }
          if (Msg.substring(0,3).equals("fum"))   
            { fum = ((int)(Msg.substring(3,6)).toInt())-100;
              Serial.print("Temp Fumee :");
              Serial.println(fum);
               Msg = "";}
          if (Msg.substring(0,3).equals("all"))   
            { all = ((int)(Msg.substring(3,5)).toInt())-100;
              Serial.print("Temps d'Allumage :");
              Serial.println(all);
              Msg = ""; }
          if (Msg.substring(0,3).equals("ses"))   
            { ses = ((int)(Msg.substring(3,5)).toInt())-10;
              Serial.print("Nb Sessions :");
              Serial.println(ses);
              Msg = ""; }  }  }

The upolad runs correctly after displaying this :

Arduino : 1.8.15 (Windows 10), Carte : "Arduino MKR WiFi 1010"

Le croquis utilise 15880 octets (6%) de l'espace de stockage de programmes. Le maximum est de 262144 octets.

Les variables globales utilisent 2756 octets (8%) de mémoire dynamique, ce qui laisse 30012 octets pour les variables locales. Le maximum est de 32768 octets.

Once uploaded, trying to open the serial monitor has nos effect, also trying to close the IDE. Only pressing the reset button closes the IDE window...

This is the most representative example (because having very simple operations to do) that shows the strange attitude of this module.

Tchatting with others forumers let me think that MKR has either a bad or no reputation ... Reading its characteristics, that seems strange...

My advice is to methodically reduce your sketch down to the absolute minimum amount of code required to still produce the problem. Often once I have done that I find that the problem is obvious. Even if it's not, that minimal demonstration sketch will make it easy for the forum members to help you out with it.

Well, I think it's important to keep in mind that people who had a great experience with a product are much less likely to be motivated to post about it.

It's also important to keep in mind that a complaint you read about one MKR board may not apply to another. For example, there were some problems with the MKR GSM 1400 hardware design. But those problems are not at all relevant to the MKR WiFi 1010.

If you want the highest possible level of community support, the AVR architecture boards (Uno, Nano, Pro Mini, Leonardo, Micro, Mega) are the best choice because they have been around the longest. However, the support for the SAMD architecture of the MKR WiFi 1010 is pretty well supported too. It's true that new bugs and incompatibilities have been introduced into the SAMD core library over the last year, but those happened during a major refactoring of the core that will greatly facilitate its ongoing development in the years to come. During that same period no new bugs or incompatibilities have been introduced to the AVR core. The reason is because there hasn't been a release of the AVR core, and not a lot of development on it either.

The specific problem you are having would likely also occur with the Leonardo. The symptom would not occur on the boards without native USB capability such as the Uno and Mega because those boards have a dedicated USB chip which can not be affected by the code in your sketch. But that native USB capability has several benefits as well.

Reduced to its most basic size, the sketch I include below in this post downloads with 5% of Flash space, and 8% of RAM.

However, the download does not finish and gets stuck on the size information.

Le croquis utilise 15416 octets (5%) de l'espace de stockage de programmes. Le maximum est de 262144 octets.
Les variables globales utilisent 2636 octets (8%) de mémoire dynamique, ce qui laisse 30132 octets pour les variables locales. Le maximum est de 32768 octets.

10 minutes later it displays this :

Une erreur est survenue lors du transfert du croquis
processing.app.SerialException: Erreur d'ouverture du port série « COM10 ».
	at processing.app.Serial.<init>(Serial.java:152)
	at processing.app.Serial.<init>(Serial.java:82)
	at processing.app.SerialMonitor$2.<init>(SerialMonitor.java:132)
	at processing.app.SerialMonitor.open(SerialMonitor.java:132)
	at processing.app.AbstractMonitor.resume(AbstractMonitor.java:132)
	at processing.app.Editor.resumeOrCloseSerialMonitor(Editor.java:2120)
	at processing.app.Editor.access$1300(Editor.java:117)
	at processing.app.Editor$UploadHandler.run(Editor.java:2089)
	at java.lang.Thread.run(Thread.java:748)
Caused by: jssc.SerialPortException: Port name - COM10; Method name - openPort(); Exception type - Port busy.
	at jssc.SerialPort.openPort(SerialPort.java:164)
	at processing.app.Serial.<init>(Serial.java:141)
	... 8 more
Erreur d'ouverture du port série « COM10 ».

Hereafter the code :

int tex = 0;     //Température extérieure
int tch = 0;     //Température Chaudière
int tct = 0;     //Température circuit
int tec = 0;     //Température ECS
int alarm = 0;    //Numéro d'alarme
int cons = 0;  //Consommation session en temps de vis (s)
int all = 0;    //Temps d'allumage de la session ou maxi si pas en chauffe
int fum = 0;    //Température de fumée actuelle ou maxi si pas en chauffe
int ses = 0;     //Nombre de sessions de la journée
int state = 0;    //Etat du graphe de chauffe
bool ecs = 0;     //Etat de besoin d'ECS
bool hiver = 0;   //Mode hiver
char c;
String Msg;

void setup() {
  Serial.begin(9600);
}

void loop() {

  //****************************************** Récupération valeurs chaudière via ventilation ***********************************
  
  while ((c = Serial.read()) > '\n') Msg += (char) c; 
       if (c == '\n')
          {if (Msg.substring(0,3).equals("tch")) 
            { tch = (int)(Msg.substring(3,5)).toInt();
              Serial.print("Temp Chaudiere :");
              Serial.println(tch);
              Msg = ""; }
          if (Msg.substring(0,3).equals("tct")) 
            { tct = (int)(Msg.substring(3,5)).toInt();
              Serial.print("Temp Circuit :");
              Serial.println(tct);
              Msg = ""; }
          if (Msg.substring(0,3).equals("tex")) 
            { tex = ((int)(Msg.substring(3,5)).toInt())-20;
              Serial.print("Temp Ext :");
              Serial.println(tex);
              Msg = ""; }
          if (Msg.substring(0,3).equals("ecs")) 
            { ecs = (bool)(Msg.substring(3,4)).toInt();
              Serial.print("Besoin d'ECS :");
              Serial.println(ecs);
              Msg = ""; }
          if (Msg.substring(0,5).equals("alarm")) 
            { alarm = (int)(Msg.substring(5,6)).toInt();
              Serial.print("Alarme :");
              Serial.println(alarm);
              Msg = ""; }
          if (Msg.substring(0,5).equals("state")) 
            { state = ((int)(Msg.substring(5,7)).toInt())-10;
              Serial.print("Etat :");
              Serial.println(state);
              Msg = ""; }
          if (Msg.substring(0,5).equals("hiver")) 
            { hiver = (bool)(Msg.substring(5,6)).toInt();
              Msg = ""; 
              Serial.print("Hiver :");
              Serial.println(hiver);}
          if (Msg.substring(0,3).equals("tec")) 
            { tec = (int)(Msg.substring(3,5)).toInt();
              Serial.print("Temp ECS :");
              Serial.println(tec);
              Msg = ""; }
          if (Msg.substring(0,4).equals("cons"))   
            { cons = ((int)(Msg.substring(4,9)).toInt())-10000;
              Serial.print("Consommation :");
              Serial.println(cons);
              Msg = ""; }
          if (Msg.substring(0,3).equals("fum"))   
            { fum = ((int)(Msg.substring(3,6)).toInt())-100;
              Serial.print("Temp Fumee :");
              Serial.println(fum);
               Msg = "";}
          if (Msg.substring(0,3).equals("all"))   
            { all = ((int)(Msg.substring(3,5)).toInt())-100;
              Serial.print("Temps d'Allumage :");
              Serial.println(all);
              Msg = ""; }
          if (Msg.substring(0,3).equals("ses"))   
            { ses = ((int)(Msg.substring(3,5)).toInt())-10;
              Serial.print("Nb Sessions :");
              Serial.println(ses);
              Msg = ""; }  } }

The problem seems to be that this card does not have a dedicated USB chip. It is therefore affected by the code of this sadly simple sketch, which represents only a tiny part of my need.

I did a test by replacing Serial by Serial1 (for both print and read).

Always gaming with the quick double reset and switch on a second port, than retrieving the initial one, I finally successfully uploaded the sketch.
BUT.... How can I setup a sketch without serial monitor ???

I have to admit that it is purely unusable for me ( and thus probably for many others...)
How can be put on the market a product officially dedicated to the IoT and which is simply unable to manage its UART... ???
The firmware is obviously not completed. Waste of time and money... I am VERY disappointed and will now turn to products whose development is completed and whose users confirm their capabilities and qualities, such as the ESP32.
Thank you anyway for your patience and your pedagogy.

This error occurs when some other application has the serial port of your Arduino board open. That can happen even if you have two instances of the Arduino IDE running and both are trying to use the serial port via Serial Monitor or uploading. In some rare cases, the operating system can leave the port stuck in an unusable state. Restarting the computer fixes that.

The sketch code won't cause this particular "Port busy" error. The sketch interfering with the upload process has a different symptom, such as the one you posted in reply #4

That may be true, but keep in mind that the firmware is the sketch you wrote.

Arduino boards and software are tools for people who want to create new things and learn and have fun overcoming the challenges of that creating and learning process. They are not for the people who want some pre-made consumer product. If you want something like that, then look elsewhere. If you want to have success with Arduino then you are going to need to adjust your attitude. Going into this mode of immediately jumping to blaming your tools on the first problem you encounter is not productive. It is possible there is a bug in the free open source libraries or toolchain, but far more likely is that there is a bug in your sketch. You'll never know which it is if you don't have the perseverance to complete the investigation.

You won't have this specific class of problem from the ESP32 due to it not having native USB capabilities, but you will surely have plenty other problems that are just as tricky.

I edit my previous post, after having renamed Serial to Serial 1.
When I talk about "firmware", thats not about my sketch, but about the USB emulated Serial port.

You won't have this specific class of problem from the ESP32 due to it not having native USB capabilities, but you will surely have plenty other problems that are just as tricky.

I allready moved to an ESP8266, and the things are running much better, and the existing litterature and experience are hugely higher!!!

As I am stubborn and obstinate, I finally found the source of the trouble with the MKR Wifi 1010:
It does not accept "Serial.read", which causes all the problems described above.
After replacing this command with "Serial.parseInt" everything started working!
Of course, I had to rewrite the whole Serial communication, but the result is positive.
I hope this information can be used by others...