In order to make sure to provide a useful reference for everyone who might have a similar question in the future, I'm going to provide complete instructions. I hope you'll forgive me if some of this information is obvious to you. It might not be for everyone and I'd rather provide too much information than too little. Those who already know a step are welcome to skim over it.
Install the Arduino boards platform for the ATSAMD11 chip on the motor carrier
Unfortunately, Arduino never bothered to provide Boards Manager installation support for this platform, so you must install it manually.
- Start the Arduino IDE if it's not already running.
- Select File > Preferences from the Arduino IDE menus.
- Take note of the path shown in the "Sketchbook location" preference.
- Click the Cancel button.
- Download the boards platform by clicking this link:
https://github.com/arduino/ArduinoCore-samd/archive/refs/heads/mkrmotorcarrier.zip - Unzip the downloaded file
ArduinoCore-samd-mkrmotorcarrier.zip - Movve the unzipped folder to the following location:
The folder structure must look exactly like this:<sketchbook location>/hardware/arduino-development/samd<sketchbook location> |_ hardware |_ arduino-development |_samd |_ boards.txt |_ etc. - Restart the Arduino IDE.
The IDE won't notice a manually installed platform until it has been restarted.
Install the "MattairTech SAM M0+ Boards" platform
This is done to get the version of the SAMD toolchain that is compatible with the boards platform used for the ATSAMD11 microcontroller on the motor carrier.
- Enter the following URL into the "Additional Boards Manager URLs" field:
If there are already Additional Boards Manager URLs there, separate them with commas.https://www.mattairtech.com/software/arduino/package_MattairTech_index.json - Click the OK button.
- Select Tools > Board > Boards Manager from the Arduino IDE's menus.
- Wait for the updates to finish.
- Scroll down through the list of boards platforms until you see "MattairTech SAM M0+ Boards". Click on it.
- From the dropdown version menu, select "1.l6.16".
- Click the Install button.
- Wait for the installation to finish.
- Click the Close button.
Install the "ArduinoMotorCarrier" library
This is necessary to get the "D11-Firmware" sketch.
If you already have the library installed, or you have downloaded the sketch alone, you can skip to the next step.
- Select Sketch > Include Library > Manage Libraries... from the Arduino IDE's menus.
- Wait for the update to finish.
- In the "Filter your search" field, type "ArduinoMotorCarrier".
- Press Enter.
- Scroll down through the list of libraries until you see "ArduinoMotorCarrier by Arduino". Click on it.
- Click the Install button.
- Wait for the installation to finish.
- Click the Close button.
Compile the firmware
- Select File > Preferences from the Arduino IDE menus.
- Take note of the path shown in the "Sketchbook location" preference.
- Click the Cancel button.
- Copy the folder at the following path:
to some convenient location outside the library folder.<sketchbook location>/libraries/ArduinoMotorCarrier/extras/D11-Firmware
The Arduino IDE treats the sketches in the libraries folders as read only and we need to be able to write to the sketch folder, so it's necessary to move it even if you don't need any modifications. - Select File > Open from the Arduino IDE menus.
- Select the file
D11-Firmware.inofrom the folder where you moved the sketch in the previous step. - Click the Open button.
- Make any modifications you would like to the "D11-Firmware" sketch.
- Select Tools > Board > MattairTech SAM M0+ Boards (in sketchbook) > MKR Motor Shield from the Arduino IDE menus.
- Select Tools > Bootloader Size > 4KB bootloader from the Arduino IDE menus.
- Select Tools > Pinmap > Complete from the Arduino IDE menus.
- Select Tools > Link time optimization > Enabled from the Arduino IDE menus.
- Select Sketch > Export compiled Binary from the Arduino IDE menus.
- Wait for the compilation to finish successfully.
- Select Sketch > Show Sketch Folder from the Arduino IDE menus.
This will open the "D11-Firmware" sketch folder in your file browser software. You will see there a file named D11-Firmware.ino.MKRMotorShield.bin. That is the firmware that was generated from the sketch you compiled.
If you have an Atmel ICE or other CMSIS-DAP compliant programmer/debug probe attached to the SWD header on the carrier then you can use Sketch > Upload Using Programmer instead of "Export compiled Binary" to directly flash the firmware to the ATSAMD11 via the Arduino IDE. In this case, you can use the Tools > Bootloader Size > No bootloader, which will give more program memory for the firmware sketch to use.
NOTE: This complex sketch contains essential source code under its src subfolder. Unfortunately, the classic Arduino IDE's File > Save As... functionality has a bug that causes the src subfolder to be lost when you save a sketch to a new location. So make sure you manually copy the sketch to a new location if you need multiple copies of it.