Oops. I Erased The Entire Chip.

It happens. And that's ok. It's a pretty easy fix, actually. If you didn't already do so, download a copy of the bootloader binary file (*.bin) for your board:

Now open the Device Programming window.

With the J-Link tool selected and the Device set to your SAMD chip (should be populated based on your project file), click the Apply button. If everything checks out, the buttons next to "Device signature" and "Target voltage" should enable.

Click the Read button next to "Device signature"

If the device ID reading returns OK, click Memories on the left and the window will look like this:

In the "Flash (256 KB)" section, type/select the path to the bootloader binary file you downloaded earlier.

Ensure the "Erash Flash before programming" checkbox is checked.

Click the Program button.

If everything was successful, close the Device Programming window. Since the flash was erased, anything you had on the board's flash will be gone (firmware, any libraries, etc).

The board should have reset, and connected to Windows in bootloader mode (i.e. FEATHERBOOT, TRINKETBOOT, etc). To keep the variables to a minimum with the file system, I usually drag and drop a firmware .uf2 onto the board before running it in AS7.

Again, resist the urge to manipulate the file system while running the board from AS7. But, now that you know this process, you can recover from it if you do.

This guide was first published on May 24, 2018. It was last updated on May 24, 2018. This page (Oops. I Erased The Entire Chip.) was last updated on Sep 21, 2019.