How to reload Arduino's bootloader on MKR1000 ? [solved]

This is NOT the "double press on reset" issue: I see the current bootloader dumping stuff on the COM console.

Now, the story. Well, it is my fault. Sort of...

In short, I wanted to test Zerynth for Python in the MKR1000. Didn't work well so far but that's another story.

Anyway, it burnt another bootloader (kind of virtualization, for threads as far as I understood).

Now, I want to come back to Arduino IDE but I need to burn the Arduino bootloader first.


Any idea where I could find how to do it? Any help appreciated :slight_smile:

These are my stock instructions for burning the bootloader on the MKR1000. It sounds like you already have a programmer of some sort, so there might be some information here that is not of use to you, but perhaps some of it will be helpful even so:
You'll need:

  • An extra Arduino board that runs at 3.3 V.
  • An SD slot. This could be built into your Arduino board (e.g., MKR Zero), a shield (e.g., MKR SD Proto Shield), or one of the common SD modules.
  • An SD card that fits your SD slot.
  • A way to connect the SD card to your computer.
  • A way to make the connections to the SWD pins on your target Arduino board. On the MKR1000, it is a 0.05" pitch 2x5 male header on the top of the board, which you will need an adapter for.

It is possible to use an Arduino board that runs at 5 V as the programmer, but you'll need to use level shifting circuitry on the programming lines to avoid exposing the target board to 5 V logic levels, which would damage it.


Connect an SD card to your computer.

Open this link in your browser: ArduinoCore-samd/bootloaders at master · arduino/ArduinoCore-samd · GitHub

Click the folder that matches the name of your target board.

Click the file that ends in .bin.

Click the "Download" button.

Rename the downloaded file to fw.bin

Move fw.bin to the SD card.

Eject the SD card from your computer.

Plug the USB cable of the Arduino board you will be using as a programmer into your computer.

(In the Arduino IDE) Sketch > Include Library > Manage Libraries

Wait for the download to finish.

In the "Filter your search..." field, type "Adafruit DAP library".

Press "Enter".

Click on "Adafruit DAP library by Adafruit".

Click the "Install" button.

Wait for the installation to finish.

Click the "Close" button.

File > Examples > Adafruit DAP library > flash_from_SD

Change this line:

#define SD_CS 4

according to the Arduino pin connected to the SD CS pin. If your board has a built-in SD slot (e.g., MKR Zero), then you can change this line:

if (!SD.begin(SD_CS)) {


if (!SD.begin()) {

Select the correct board from the Tools > Board menu.

Select the correct port from the Tools > Port menu.

Sketch > Upload

Wait for the upload to finish successfully.

Unplug the programmer Arduino board from your computer.

Plug the SD card into the SD slot connected to your Arduino board.

Connect the programmer Arduino board to the target Arduino board as follows:

| Programmer | | Target |
| - | - |
| ----------- | |------- |
| VCC | | +3V3 |
| ----------- | |------- |
| 10 | | SWDIO |
| ----------- | |------- |
| 9 | | SWCLK |
| ----------- | |------- |
| GND | | GND |
| ----------- | |------- |
| 11 | | RESETN |
| ----------- | |------- |

MKR 1000 SWD header pinout:

Plug the USB cable of the programmer Arduino board into your computer.

Tools > Serial Monitor. You should now see the target board detected, and the bootloader file flashed to it successfully.

Unplug the programmer Arduino board from your computer.

Disconnect the programmer Arduino board from the target Arduino board.

Note: another alternative is to use a J-Link debug probe (J-Link EDU Mini and J-Link clones are available for a low price) with the Adalink software:

Well, Pert, many many thanks for your answer. I'll keep it by my side for future reference.

However, I don't have (so far) the harware required. SD card slot etc... The Segger J-Link EDU mini is now in my shopping list :slight_smile:

So this was not an easy solution. I was already crawling in that direction, but I was far from having defined all the steps, and you gave all the infos I was struggling for. Thanks.

Anyway, my issue was solved this very easy other way :

  • a few days ago, I installed Atmel Studio 7 to explore low level programming without the Arduino layer (loop, setup, libraries etc) that makes life so easy but hides things (cf. youtube). I want to go down to ARM assembler exploration.
  • I saw the Arduino IDE for Atmel Studio 7 extension. I installed it.
  • Then I chose the right settings for my board in the vMicro menu.
  • I opened the Visual Micro Explorer panel, again from the vMicro menu.
  • I clicked on the Example tab there.
  • There : IDE Examples -> 01.Basics -> and guess what: Blink.
  • Compile and upload.

At that point, I don't know why it does it, but it burnt the bootloader (nothing on the console about that) and then the sketch is indeed uploaded and run.

And finally, I can come back to the Arduino IDE as well.

Probably works for all MKR. Don't know for other boards.

Anyway: phew! :slight_smile:

Thanks again for your support. Much appreciated: Karma++.

You're welcome. I'm glad to hear you got your MKR1000 working again. Thanks for taking the time to post an update with your solution. Enjoy!

it there was no bootloader then there is no way to flash the bootloader over UART

Per, why Adalink with programmer? I use "Burn bootloader" in IDE.

Per, why Adalink with programmer? I use "Burn bootloader" in IDE.

With a J-Link? If so, which programmer do you select: Atmel EDBG, Atmel-ICE, or Atmel SAM-ICE?

With a J-Link? If so, which programmer do you select: Atmel EDBG, Atmel-ICE, or Atmel SAM-ICE?

Atmel EDBG. the tool behind it (openocd if I remember right) doesn't care if it is Atmel. it detects the programmer

No joy:

Error: unable to find CMSIS-DAP device

I spent some time looking into the topic of using the J-Link as a CMSIS-DAP device a while back but didn't find anything of use.

I am using one of the $5 Chinese J-Link clones from eBay.

Do you have any ideas about this Juraj?

Even if the J-Link won't work, this is great information for me because it means that the CMSIS-DAP debugger I've been recommending to people who want to use the Arduino Pro IDE's deubgger can also be used as a programmer with the Arduino IDE. I think there is still a use case for the Adafruit_DAP approach with the people who have a spare Arduino board and don't want to invest in a dedicated device just to recover their bricked board, but this definitely makes it more attractive to spend a little bit of money for a CMSIS-DAP device that is useful for every day debugging in addition to making the rare Burn Bootloader process a point and click operation.

I had been meaning to figure out the command line process to use it as a programmer for SAMD, but assumed it wasn't possible to use the existing programmer definitions for SAMD in the Arduino IDE with this device. I just tried it and it works great!

So @jslovi, unless Juraj can show us how to make the J-Link work with the Arduino IDE (and ideally with the Arduino Pro IDE as a debugger too), I would suggest considering a CMSIS-DAP debugger instead of the J-Link Mini EDU.

This is the one I have and am very happy with:

It's all open source hardware and firmware and very reasonably priced. It will plug right in to your MKR1000 if you buy the cable that's offered in that Tindie listing. The creator of that debugger, Alex Taradov's Free-DAP code is the basis for the Adafruit_DAP library I recommended in my bootloader instructions, so they seem someone worth supporting.

Juraj might have an alternative recommendation to that debugger if you want to pay a little more for something more fancy.

:slight_smile: yes I have a fancy programmer which is an NXP evaluation board too so a complete overkill, but it was available at an electronic components distributor based in my town.

I experimented with ST-link2 to recover my MKR before I had the programmer. ST-link didn't work and I finally flashed the bootloader with the AdafruitDAP library. But as far as I remember, the problem with ST-link2 was the communication with the MCU, not with openocd. But I had to change some configuration in openocd. It was more then a year ago so I don't remember the details, but I will try it later today.

I get the same error with my ST-Link V2. I actually got the first use out of that programmer the other day giving the stm32duino platform and a Blue Pill board a try.

Per, in
.arduino15/packages/arduino/hardware/samd/1.8.4/variants/…/openocd_scripts file
you can try as
source [find interface/…cfg]
a file from
there is a jlink.cfg

I have Atmel EDBG selected as programmer and for source [find interface/stlink.cfg] I get

Open On-Chip Debugger 0.10.0+dev-gf0767a31 (2018-06-11-13:40)
Licensed under GNU GPL v2
For bug reports, read
debug_level: 2
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
none separate
adapter speed: 400 kHz
Info : Unable to match requested speed 400 kHz, using 240 kHz
Info : Unable to match requested speed 400 kHz, using 240 kHz
Info : clock speed 240 kHz
Info : STLINK v2 JTAG v32 API v2 SWIM v7 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.243243
Error: init mode failed (unable to connect to the target)
in procedure 'init' 
in procedure 'ocd_bouncer'

Error while burning bootloader.

(nothing is connected to the programmer)

from Internet search it looks like the ST-link V2 works only with the STM MCUs. I had no problem use it with IDE to upload sketches to a Blue Pill.