Skip to main content Skip to local navigation

Getting Started with the Adafruit Metro M0 Express

Getting Started with the Adafruit Metro M0 Express

I bought the Adafruit Metro M0 Express because it has both a debugger port soldered on and has a SAMD21 chip on it.  While it has a bootloader and CircuitPython on it, I'm actually only interested in using it as a potentially student-friendly development platform for learning C / C++ on the Cortex M0+.

I was surprised to discover two things.  First, the particular flavour of SAMD21 on the Metro is not supported by the MPLAB X 5.0.  Missed that when doing my background research.  Second, the J-Link debugger can't take over direct control of the chip... the Circuit Python bootloader appears to block it (source 1, source 2).

Since the SAMD part on the Adafruit Metro isn't supported by Microchip's MPLAB X IDE yet, I'm using the limited / trial version of Keil.  My German students seemed to like using Keil, so I might as well kick its tires.  In the end I want to use MPLAB X but I'll have to develop on Keil for the time being. There's a quick setup tutorial at Microdigital.  I chose the Segger JLink-EDU as the debugger and Keil identified it and updated the firmware on it.  (Note to Segger: it's a nice gesture to have an educational version of your hardware)

I'm going to try using Segger's Ozone to connect directly to the Metro board with the JLink.  If I set the JLink-EDU to 1MHz and SWD (not JTAG) within Ozone it can pause operation and step through the assembler commands that are currently running on the Metro M0 board.  It doesn't seem to require me to press the reset button. Weirdly, even though I've paused the processor the RGB LED continues to flash at low frequency (every few seconds).

SWD @ 1MHz via Ozone and JLink EDU to the Metro M0 board.

The Ozone utility by Segger can permit the JLink to connect to the Metro M0 board. I set it to SWD operation and 1MHz communication rate.

Now, when I go back to Keil I adjust the debugger options for my JLink.  As soon as I change it from JTAG to SW then the LEDs on the Metro M0 boad turn off... I'm assuming that Keil is interrogating the board and JLink in the background.

Keil settings for the JLink debugger.

Keil settings for the JLink debugger.

When I go back to the main window in Keil Windows pops up a new Windows explorer window and instead of the usual window showing the usual files on the Metro board it actually shows a "Metro Boot" option... maybe this is similar to how you reflash the FRDM KL25Z boards.

Now, I seem to be able to connect but I'm getting the following error

flash memory isn't erasing

I can connect to the board, but I can't erase the flash memory...

[to be updated...]