Arduino MKR WIFI 1010 boot

Note: alternative methods are described at the end of the post.

Using an Arduino board as the programmer

You'll need

  • An extra Arduino board that runs at 3.3 V to use as the programmer.
    • Any of the SAMD architecture boards (e.g., MKR boards, Nano 33 IoT, Zero) will work fine.
    • The sketch is too large for the AVR architecture boards (e.g., Mega), so they can't be used.
    • The sketch doesn't compile for the Nano 33 BLE, so it can't be used.
  • A way to make the connections to the SWD pins on your target Arduino board. For the Nano 33 IoT and the MKR Boards other than MKR1000, I like to use a 0.1" pitch 2x3 POGO adapter. You could also solder wires to the test points if you prefer. On the MKR boards other than the MKR1000, the SWD header is on the bottom of the board and is the footprint for a 0.1" pitch 2x3 SMD header (e.g., https://www.digikey.com/short/z3dvdv).

Instructions

  1. Select Sketch > Include Library > Manage Libraries... from the Arduino IDE's menus.

  2. Wait for the download to finish.

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

  4. Press Enter.

  5. Click on "Adafruit DAP library by Adafruit".

  6. Click the Install button.

  7. Wait for the installation to finish.

  8. Click the Close button.

  9. Select File > Examples > Adafruit DAP library > samd21 > flash_MKR_bootloaders from the Arduino IDE's menus.
    (despite the "MKR" in the sketch name, this also supports the Nano 33 IoT)

  10. Select your programmer Arduino board from the Tools > Board from the Arduino IDE's menus.

  11. Select the port of the programmer Arduino board from the Tools > Port from the Arduino IDE's menus.

  12. Select Sketch > Upload from the Arduino IDE's menus.

  13. Wait for the upload to finish successfully.

  14. Unplug the programmer Arduino board from your computer.

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

    Programmer Target
    VCC +3V3
    1 SWDIO
    2 SWCLK
    GND GND
    0 RESETN

    SWD pads on MKR boards other than MKR 1000 (board in picture is MKR Zero, but it's the same for your MKR WiFi 1010):
    MKR SWD

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

  17. Select Tools > Serial Monitor from the Arduino IDE's menus.

  18. Select "No line ending" from the dropdown menu near the bottom right corner of the Serial Monitor window.

  19. You should see some instructions for using the sketch in the Serial Monitor output field. This includes a menu of the boards supported by the sketch:

    Select Arduino MKR board to erase and flash with bootloader:
    
    Z     -> Arduino Zero (6504 bytes)
    MZ    -> Arduino MKR Zero (6408 bytes)
    1000  -> Arduino MKR 1000 WIFI (6408 bytes)
    1010  -> Arduino MKR WIFI 1010 (7984 bytes)
    
    [...]
    

    Find your target Arduino board on the list and note the code written to the left of it on the list.

  20. Type the code for the target Arduino board in the Serial Monitor's input field.

  21. Click the Send button to the right of the Serial Monitor input field.

  22. The Serial Monitor output field should now show the board you selected and the progress of flashing the bootloader to the target Arduino board. Wait for it to show "Done!"

  23. Unplug the programmer Arduino board from your computer.

  24. Disconnect the programmer Arduino board from the target Arduino board.


Alternatives

These are some alternatives to the "Adafruit DAP" method I described above.

Using a CMSIS-DAP debug probe as the programmer

If you have a CMSIS-DAP compliant debug probe, you can just do this instead:

  1. Connect the debug probe to your Arduino board.
  2. Select Tools > Programmer > Atmel EDBG from the Arduino IDE's menus.
  3. Select Tools > Burn Bootloader from the Arduino IDE's menus. - The "Burn Bootloader" process should now finish successfully.

I use this little open source debugger.