Sketch Upload not possible on ARM Cortex-M0 Processor / SAMD21 Board

Hi everyone,

Unfortunately, I have a huge problem with Arduino. For some reason, I can no longer upload a sketch to my board (senseBox; ARM Cortex-M0+ processor from the SAM D21 family by Microchip). Initially, everything worked smoothly. The sketch also ran on my board without any issues before. I have already uninstalled Arduino multiple times (including deleting all folders/configurations), restarted my Mac several times, and tried different USB cables, but without success. I am attaching my sketch and the current error messages. If someone could help me with this, I would be infinitely grateful.

When I press the reset Button the Upload might work, but the board is not loading the components. Well, actually nothing happens. :smiley: Suddenly it stopped working. Before that I was uploading minimum 10 sketches per Day and everything worked well.

I'm using a MacBook with M1 chip.

Thank you very much in advance!!

Error compiling the sketch:

/Users/USERNAME/Desktop/Sketch_International/Programmcode_Mexico/Programmcode_Mexico.ino: In function 'void submitValues()':
/Users/USERNAME/Desktop/Sketch_International/Programmcode_Mexico/Programmcode_Mexico.ino:175:14: warning: unused variable 'c' [-Wunused-variable]
         char c = client.read();
              ^
In file included from /Users/USERNAME/Library/Arduino15/packages/arduino/hardware/samd/1.8.14/cores/arduino/api/String.h:33:0,
                 from /Users/USERNAME/Library/Arduino15/packages/arduino/hardware/samd/1.8.14/cores/arduino/api/IPAddress.h:24,
                 from /Users/USERNAME/Library/Arduino15/packages/arduino/hardware/samd/1.8.14/cores/arduino/api/ArduinoAPI.h:30,
                 from /Users/USERNAME/Library/Arduino15/packages/arduino/hardware/samd/1.8.14/cores/arduino/Arduino.h:23,
                 from sketch/Programmcode_Mexico.ino.cpp:1:
/Users/USERNAME/Library/Arduino15/packages/arduino/hardware/samd/1.8.14/cores/arduino/api/deprecated-avr-comp/avr/pgmspace.h:65:35: warning: 'char* strcpy(char*, const char*)' writing 25 bytes into a region of size 24 overflows the destination [-Wstringop-overflow=]
 #define strcpy_P(dest, src) strcpy((dest), (src))
                             ~~~~~~^~~~~~~~~~~~~~~
/Users/USERNAME/Desktop/Sketch_International/Programmcode_Mexico/Programmcode_Mexico.ino:145:3: note: in expansion of macro 'strcpy_P'
   strcpy_P(_server, server);
   ^~~~~~~~

Error when uploading the sketch:

The sketch uses 65212 bytes (24%) of program storage space. The maximum is 262144 bytes.
Global variables use 7640 bytes of dynamic memory.
Forcing reset by opening/closing with 1200 bps on port /dev/cu.usbmodem101
PORTS {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } / {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } / {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } / {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } / {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } / {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } / {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } / {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } / {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } / {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } / {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } / {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } / {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } / {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } / {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } / {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } / {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } => {}
PORTS {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } / {/dev/cu.usbmodem101, /dev/cu.wlan-debug, /dev/tty.usbmodem101, /dev/tty.wlan-debug, } => {}
Uploading using selected port: /dev/cu.usbmodem101
/Users/USERNAME/Library/Arduino15/packages/arduino/tools/bossac/1.7.0-arduino3/bossac -i -d --port=cu.usbmodem101 -U true -i -e -w -v /var/folders/dj/mfcb5zcs6hg_bp36xw87lsc80000gn/T/arduino_build_424472/Programmcode_Mexico.ino.bin -R 
No device found on cu.usbmodem101
Set binary mode
An error occurred while uploading the sketch
Send auto-baud
Set binary mode

The way uploads to this type of board works is:

  1. Arduino IDE (or the upload tool used by Arduino IDE) sends a signal for the microcontroller to activate the bootloader program.
  2. The microcontroller activates the bootloader program.
  3. The bootloader program 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 program writes it to flash memory.

The way the IDE signals the microcontroller to run the bootloader program is by opening a serial connection to the board at 1200 baud (AKA "1200bps touch"). There is some special code running on the microcontroller in the background of your sketch that recognizes that "1200bps touch" as a special signal.

In some cases, your sketch code (or the code of a library used by the sketch) might cause that "1200bps touch" detection code to be missing or not working correctly, which will mean the bootloader is never activated and the upload fails with the error you're encountering.

In order to test this hypothesis, please try the following experiment:

  1. Select File > Examples > 01.Basics > BareMinimum from the Arduino IDE menus.
    A minimal valid sketch will open in a new Arduino IDE window.
  2. Upload the "BareMinimum" sketch to the board using the reset technique you found in order to ensure the upload is successful.
  3. Wait for the upload to finish successfully.
  4. Upload the "BareMinimum" sketch to the board again, but this time do it normally, without resetting the board.

Did the normal upload you performed at step (4) of those instructions fail?

The "BareMinimum" sketch is used as a "known good" state we know won't interfere with the board's ability to react to the "1200bps touch". If the upload doesn't fail when the "BareMinimum" sketch is running on the board, but does fail when your real sketch is running on the board, then you will know the issue is caused by something in the code of your real sketch. You can then focus your troubleshooting efforts on finding the specific code in the sketch that is causing the problem, and adjusting the code so that it doesn't interfere with the upload capability (assuming this effect is the cause of a bug rather than an expected and unavoidable effect of the code).

1 Like

Hi,
thank you really much for your effort to help me!
I've tried the BareMinimum Sketch but unfortunately the problem remains the same. Is there anything else I could try?

Well, I just forgot to initialize the display, haha! Just cost me 7 hours to figure out.

@PaLuScia ,
Topic locked. You have posted the same question here:

So you have 2 lots of people working on the same problem, each probably unaware of the others. The help you get here is given by volunteers working for free in their spare time, asking the same question twice wastes their time and is not appreciated.

Please take some time to read the forum guide:

Repeatedly posting the same question multiple times can result in a ban from the forum.

Thank you.