Skip to content

Commit 69bb4ae

Browse files
authored
Merge pull request adafruit#1397 from ShawnHymel/master
Added board support for Arduino MKR Zero
2 parents 17255bc + 29f9794 commit 69bb4ae

7 files changed

Lines changed: 174 additions & 44 deletions

File tree

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ env:
2424
- TRAVIS_TESTS="unix docs translations website" TRAVIS_BOARDS="feather_huzzah circuitplayground_express mini_sam_m4 grandcentral_m4_express pca10056 pca10059 feather_nrf52832 feather_nrf52840_express makerdiary_nrf52840_mdk particle_boron particle_argon particle_xenon sparkfun_nrf52840_mini" TRAVIS_SDK=arm:nrf:esp8266
2525
- TRAVIS_BOARDS="metro_m0_express metro_m4_express pirkey_m0 trellis_m4_express trinket_m0" TRAVIS_SDK=arm
2626
- TRAVIS_BOARDS="feather_radiofruit_zigbee gemma_m0 hallowing_m0_express itsybitsy_m0_express itsybitsy_m4_express meowmeow" TRAVIS_SDK=arm
27-
- TRAVIS_BOARDS="feather_m0_express_crickit feather_m0_rfm69 feather_m0_rfm9x feather_m4_express arduino_zero arduino_mkr1300" TRAVIS_SDK=arm
27+
- TRAVIS_BOARDS="feather_m0_express_crickit feather_m0_rfm69 feather_m0_rfm9x feather_m4_express arduino_zero arduino_mkr1300 arduino_mkrzero" TRAVIS_SDK=arm
2828
- TRAVIS_BOARDS="circuitplayground_express_crickit feather_m0_adalogger feather_m0_basic feather_m0_express catwan_usbstick" TRAVIS_SDK=arm
2929

3030
addons:

README.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,16 @@ Other
6060
supported using the `Adafruit CircuitPython SD
6161
library <https://github.com/adafruit/Adafruit_CircuitPython_SD>`__)
6262
- `Arduino Zero <https://www.arduino.cc/en/Main/ArduinoBoardZero>`__
63+
- `Arduino MKR Zero <https://store.arduino.cc/arduino-mkrzero>`__ (MicroSD card
64+
supported using the `Adafruit CircuitPython SD
65+
library <https://github.com/adafruit/Adafruit_CircuitPython_SD>`__)
6366

6467
"Third-party" or "non-Adafruit" boards
6568
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6669

6770
- `Electronic Cats Meow Meow <https://electroniccats.com/gomeow/>`__
6871
- `Electronic Cats CatWAN USB Stick <https://electroniccats.com/producto/catwan_usb_stick/>`__
6972

70-
7173
Download
7274
--------
7375

ports/atmel-samd/README.rst

Lines changed: 49 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@ SAMD21x18
22
=========
33

44
This port brings MicroPython to SAMD21x18 based development boards under the name
5-
CircuitPython. Supported boards include the Adafruit CircuitPlayground Express,
6-
Adafruit Feather M0 Express, Adafruit Metro M0 Express, Arduino Zero, Adafruit
7-
Feather M0 Basic and Adafruit M0 Bluefruit LE.
5+
CircuitPython. Supported boards include:
6+
7+
- Adafruit CircuitPlayground Express
8+
- Adafruit Feather M0 Basic
9+
- Adafruit Feather M0 Express
10+
- Adafruit Metro M0 Express
11+
- Adafruit M0 Bluefruit LE
12+
- Arduino Zero
13+
- Arduino MKR Zero
14+
815

916
Pinout
1017
------
@@ -15,51 +22,51 @@ different names. The table below matches the pin order in
1522
and omits the pins only available on the largest package because all supported
1623
boards use smaller version.
1724

18-
===================== =============== =========================== ====================== ================ ================== ========================= ================ ================
25+
===================== =================== =============== =========================== ====================== ================ ================== ========================= ================ ================
1926
`microcontroller.pin` `board`
20-
--------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------
21-
Datasheet arduino_zero circuitplayground_express feather_m0_adalogger feather_m0_basic feather_m0_express gemma_m0 metro_m0_express trinket_m0
22-
===================== =============== =========================== ====================== ================ ================== ========================= ================ ================
23-
PA00 ``ACCELEROMETER_SDA`` ``APA102_MOSI`` ``APA102_MOSI``
24-
PA01 ``ACCELEROMETER_SCL`` ``APA102_SCK`` ``APA102_SCK``
25-
PA02 ``A0`` ``A0`` / ``SPEAKER`` ``A0`` ``A0`` ``A0`` ``A0`` / ``D1`` ``A0`` ``D1`` / ``A0``
27+
--------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
28+
Datasheet arduino_mkrzero arduino_zero circuitplayground_express feather_m0_adalogger feather_m0_basic feather_m0_express gemma_m0 metro_m0_express trinket_m0
29+
===================== =================== =============== =========================== ====================== ================ ================== ========================= ================ ================
30+
PA00 ``ACCELEROMETER_SDA`` ``APA102_MOSI`` ``APA102_MOSI``
31+
PA01 ``ACCELEROMETER_SCL`` ``APA102_SCK`` ``APA102_SCK``
32+
PA02 ``A0`` ``A0`` ``A0`` / ``SPEAKER`` ``A0`` ``A0`` ``A0`` ``A0`` / ``D1`` ``A0`` ``D1`` / ``A0``
2633
PA03
27-
PB08 ``A1`` ``A7`` / ``TX`` ``A1`` ``A1`` ``A1`` ``A1``
28-
PB09 ``A2`` ``A6`` / ``RX`` ``A2`` ``A2`` ``A2`` ``A2``
29-
PA04 ``A3`` ``IR_PROXIMITY`` ``A3`` ``A3`` ``A3`` ``D0`` / ``TX`` / ``SDA`` ``A3``
30-
PA05 ``A4`` ``A1`` ``A4`` ``A4`` ``A4`` ``D2`` / ``RX`` / ``SCL`` ``A4``
31-
PA06 ``D8`` ``A2`` ``D8`` / ``GREEN_LED`` ``NEOPIXEL`` ``D8`` ``D4`` / ``TX``
32-
PA07 ``D9`` ``A3`` ``D9`` ``D9`` ``D9`` ``D9`` ``D3`` / ``RX``
33-
PA08 ``D4`` ``MICROPHONE_DO`` ``D4`` / ``SD_CS`` ``D4`` ``D0`` / ``SDA``
34-
PA09 ``D3`` ``TEMPERATURE`` / ``A9`` ``D3`` ``D2`` / ``SCL``
35-
PA10 ``D1`` / ``TX`` ``MICROPHONE_SCK`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D13``
36-
PA11 ``D0`` / ``RX`` ``LIGHT`` / ``A8`` ``D0`` / ``RX`` ``D0`` / ``RX`` ``D0`` / ``RX`` ``D0`` / ``RX``
37-
PB10 ``MOSI`` ``MOSI`` ``MOSI`` ``MOSI`` ``MOSI``
38-
PB11 ``SCK`` ``SCK`` ``SCK`` ``SCK`` ``SCK``
39-
PA12 ``MISO`` ``REMOTEIN`` / ``IR_RX`` ``MISO`` ``MISO`` ``MISO`` ``MISO``
40-
PA13 ``ACCELEROMETER_INTERRUPT`` ``FLASH_CS``
41-
PA14 ``D2`` ``BUTTON_B`` / ``D5`` ``D2``
42-
PA15 ``D5`` ``SLIDE_SWITCH`` / ``D7`` ``D5`` ``D5`` ``D5`` ``D5``
43-
PA16 ``D11`` ``MISO`` ``D11`` ``D11`` ``D11`` ``D11``
44-
PA17 ``D13`` ``D13`` ``D13`` / ``RED_LED`` ``D13`` ``D13`` ``D13``
45-
PA18 ``D10`` ``D10`` ``D10`` ``D10`` ``D10``
46-
PA19 ``D12`` ``D12`` ``D12`` ``D12`` ``D12``
47-
PA20 ``D6`` ``MOSI`` ``D6`` ``D6`` ``D6`` ``D6``
48-
PA21 ``D7`` ``SCK`` ``D7`` / ``SD_CD`` ``D7``
49-
PA22 ``SDA`` ``SDA`` ``SDA`` ``SDA`` ``SDA``
50-
PA23 ``SCL`` ``REMOTEOUT`` / ``IR_TX`` ``SCL`` ``SCL`` ``SCL`` ``L`` / ``D13`` ``SCL``
34+
PB08 ``L`` ``A1`` ``A7`` / ``TX`` ``A1`` ``A1`` ``A1`` ``A1``
35+
PB09 ``BATTERY`` ``A2`` ``A6`` / ``RX`` ``A2`` ``A2`` ``A2`` ``A2``
36+
PA04 ``A3`` ``A3`` ``IR_PROXIMITY`` ``A3`` ``A3`` ``A3`` ``D0`` / ``TX`` / ``SDA`` ``A3``
37+
PA05 ``A4`` ``A4`` ``A1`` ``A4`` ``A4`` ``A4`` ``D2`` / ``RX`` / ``SCL`` ``A4``
38+
PA06 ``A5`` ``D8`` ``A2`` ``D8`` / ``GREEN_LED`` ``NEOPIXEL`` ``D8`` ``D4`` / ``TX``
39+
PA07 ``A6`` ``D9`` ``A3`` ``D9`` ``D9`` ``D9`` ``D9`` ``D3`` / ``RX``
40+
PA08 ``D11`` / ``SDA`` ``D4`` ``MICROPHONE_DO`` ``D4`` / ``SD_CS`` ``D4`` ``D0`` / ``SDA``
41+
PA09 ``D12`` / ``SCL`` ``D3`` ``TEMPERATURE`` / ``A9`` ``D3`` ``D2`` / ``SCL``
42+
PA10 ``D2`` ``D1`` / ``TX`` ``MICROPHONE_SCK`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D13``
43+
PA11 ``D3`` ``D0`` / ``RX`` ``LIGHT`` / ``A8`` ``D0`` / ``RX`` ``D0`` / ``RX`` ``D0`` / ``RX`` ``D0`` / ``RX``
44+
PB10 ``D4`` ``MOSI`` ``MOSI`` ``MOSI`` ``MOSI`` ``MOSI``
45+
PB11 ``D5`` ``SCK`` ``SCK`` ``SCK`` ``SCK`` ``SCK``
46+
PA12 ``SD_MOSI`` ``MISO`` ``REMOTEIN`` / ``IR_RX`` ``MISO`` ``MISO`` ``MISO`` ``MISO``
47+
PA13 ``SD_SCK`` ``ACCELEROMETER_INTERRUPT`` ``FLASH_CS``
48+
PA14 ``SD_CS`` ``D2`` ``BUTTON_B`` / ``D5`` ``D2``
49+
PA15 ``SD_MISO`` ``D5`` ``SLIDE_SWITCH`` / ``D7`` ``D5`` ``D5`` ``D5`` ``D5``
50+
PA16 ``D8`` / ``MOSI`` ``D11`` ``MISO`` ``D11`` ``D11`` ``D11`` ``D11``
51+
PA17 ``D9`` / ``SCK`` ``D13`` ``D13`` ``D13`` / ``RED_LED`` ``D13`` ``D13`` ``D13``
52+
PA18 ``D10`` ``D10`` ``D10`` ``D10`` ``D10``
53+
PA19 ``D10`` / ``MISO`` ``D12`` ``D12`` ``D12`` ``D12`` ``D12``
54+
PA20 ``D6`` ``D6`` ``MOSI`` ``D6`` ``D6`` ``D6`` ``D6``
55+
PA21 ``D7`` ``D7`` ``SCK`` ``D7`` / ``SD_CD`` ``D7``
56+
PA22 ``D0`` ``SDA`` ``SDA`` ``SDA`` ``SDA`` ``SDA``
57+
PA23 ``D1`` ``SCL`` ``REMOTEOUT`` / ``IR_TX`` ``SCL`` ``SCL`` ``SCL`` ``L`` / ``D13`` ``SCL``
5158
PA24
5259
PA25
53-
PB22 ``FLASH_CS``
54-
PB23 ``NEOPIXEL`` / ``D8``
55-
PA27
56-
PA28 ``BUTTON_A`` / ``D4``
60+
PB22 ``D14`` / ``TX`` ``FLASH_CS``
61+
PB23 ``D13`` / ``RX`` ``NEOPIXEL`` / ``D8``
62+
PA27 ``SD_CD``
63+
PA28 ``BUTTON_A`` / ``D4``
5764
PA29
58-
PA30 ``SPEAKER_ENABLE`` ``NEOPIXEL``
65+
PA30 ``SPEAKER_ENABLE`` ``NEOPIXEL``
5966
PA31
60-
PB02 ``A5`` ``A5`` / ``SDA`` ``A5`` ``A5`` ``A5`` ``A5``
61-
PB03 ``A4`` / ``SCL``
62-
===================== =============== =========================== ====================== ================ ================== ========================= ================ ================
67+
PB02 ``A1`` ``A5`` ``A5`` / ``SDA`` ``A5`` ``A5`` ``A5`` ``A5``
68+
PB03 ``A2`` ``A4`` / ``SCL``
69+
===================== =================== =============== =========================== ====================== ================ ================== ========================= ================ ================
6370

6471
Here is a table about which pins can do what in CircuitPython terms. However,
6572
just because something is listed, doesn't mean it will always work. Existing use
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#include "boards/board.h"
28+
#include "mpconfigboard.h"
29+
#include "hal/include/hal_gpio.h"
30+
31+
void board_init(void) {
32+
}
33+
34+
bool board_requests_safe_mode(void) {
35+
return false;
36+
}
37+
38+
void reset_board(void) {
39+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#define MICROPY_HW_BOARD_NAME "Arduino MKR Zero"
2+
#define MICROPY_HW_MCU_NAME "samd21g18"
3+
4+
#define MICROPY_PORT_A (0)
5+
#define MICROPY_PORT_B (0)
6+
#define MICROPY_PORT_C (0)
7+
8+
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
9+
10+
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
11+
12+
#define DEFAULT_I2C_BUS_SCL (&pin_PA09)
13+
#define DEFAULT_I2C_BUS_SDA (&pin_PA08)
14+
15+
#define DEFAULT_SPI_BUS_SCK (&pin_PA17)
16+
#define DEFAULT_SPI_BUS_MOSI (&pin_PA16)
17+
#define DEFAULT_SPI_BUS_MISO (&pin_PA19)
18+
19+
#define DEFAULT_UART_BUS_RX (&pin_PB23)
20+
#define DEFAULT_UART_BUS_TX (&pin_PB22)
21+
22+
// USB is always used internally so skip the pin objects for it.
23+
#define IGNORE_PIN_PA24 1
24+
#define IGNORE_PIN_PA25 1
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
LD_FILE = boards/samd21x18-bootloader.ld
2+
USB_VID = 0x239A
3+
USB_PID = 0x8035
4+
USB_PRODUCT = "Arduino MKRZero"
5+
USB_MANUFACTURER = "Arduino"
6+
7+
INTERNAL_FLASH_FILESYSTEM = 1
8+
LONGINT_IMPL = NONE
9+
10+
CHIP_VARIANT = SAMD21G18A
11+
CHIP_FAMILY = samd21

0 commit comments

Comments
 (0)