Skip to content

Commit 75aca0f

Browse files
authored
Board support for Adafruit Gemma M0 (#3903)
machine, targets: Board support for Adafruit Gemma M0
1 parent bb9a9be commit 75aca0f

File tree

3 files changed

+108
-0
lines changed

3 files changed

+108
-0
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,8 @@ endif
558558
@$(MD5SUM) test.hex
559559
$(TINYGO) build -size short -o test.hex -target=trinket-m0 examples/blinky1
560560
@$(MD5SUM) test.hex
561+
$(TINYGO) build -size short -o test.hex -target=gemma-m0 examples/blinky1
562+
@$(MD5SUM) test.hex
561563
$(TINYGO) build -size short -o test.hex -target=circuitplay-express examples/blinky1
562564
@$(MD5SUM) test.hex
563565
$(TINYGO) build -size short -o test.hex -target=circuitplay-bluefruit examples/blinky1

src/machine/board_gemma-m0.go

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
//go:build sam && atsamd21 && gemma_m0
2+
3+
package machine
4+
5+
// Used to reset into bootloader.
6+
const resetMagicValue = 0xf01669ef
7+
8+
// GPIO Pins.
9+
const (
10+
D0 = PA04 // SERCOM0/PAD[0]
11+
D1 = PA02
12+
D2 = PA05 // SERCOM0/PAD[1]
13+
D3 = PA00 // DotStar LED: SERCOM1/PAD[0]: APA102/MOSI
14+
D4 = PA01 // DotStar LED: SERCOM1/PAD[1]: APA102/SCK
15+
D11 = PA30 // Flash Access: SERCOM1/PAD[2]
16+
D12 = PA31 // Flash Access: SERCOM1/PAD[3]
17+
D13 = PA23 // LED: SERCOM3/PAD[1] SERCOM5/PAD[1]
18+
)
19+
20+
// Analog pins.
21+
const (
22+
A0 = D1
23+
A1 = D2
24+
A2 = D0
25+
)
26+
27+
const (
28+
LED = PA23
29+
)
30+
31+
// USBCDC pins.
32+
const (
33+
USBCDC_DM_PIN = PA24
34+
USBCDC_DP_PIN = PA25
35+
)
36+
37+
// UART0 pins.
38+
const (
39+
UART_TX_PIN = PA04 // TX: SERCOM0/PAD[0]
40+
UART_RX_PIN = PA05 // RX: SERCOM0/PAD[1]
41+
)
42+
43+
// UART0s on the Gemma M0.
44+
var UART0 = &sercomUSART0
45+
46+
// SPI pins.
47+
const (
48+
SPI0_SCK_PIN = PA05 // SCK: SERCOM0/PAD[1]
49+
SPI0_SDO_PIN = PA04 // MOSI: SERCOM0/PAD[0]
50+
SPI0_SDI_PIN = NoPin
51+
SPI0_CS_PIN = NoPin
52+
)
53+
54+
// SPI on the Gemma M0.
55+
var SPI0 = sercomSPIM0
56+
57+
// SPI pins for DotStar LED (using APA102 software SPI) and Flash.
58+
const (
59+
SPI1_SCK_PIN = PA01 // SCK: SERCOM1/PAD[0]
60+
SPI1_SDO_PIN = PA00 // MOSI: SERCOM1/PAD[1]
61+
SPI1_SDI_PIN = PA31 // MISO: SERCOM1/PAD[3]
62+
SPI1_CS_PIN = PA30 // CS: SERCOM1/PAD[2]
63+
)
64+
65+
// I2C pins.
66+
const (
67+
SDA_PIN = PA04 // SDA: SERCOM0/PAD[0]
68+
SCL_PIN = PA05 // SCL: SERCOM0/PAD[1]
69+
)
70+
71+
// I2C on the Gemma M0.
72+
var (
73+
I2C0 = sercomI2CM0
74+
)
75+
76+
// I2S (not connected, needed for atsamd21).
77+
const (
78+
I2S_SCK_PIN = NoPin
79+
I2S_SD_PIN = NoPin
80+
I2S_WS_PIN = NoPin
81+
)
82+
83+
// USB CDC identifiers.
84+
const (
85+
usb_STRING_PRODUCT = "Adafruit Gemma M0"
86+
usb_STRING_MANUFACTURER = "Adafruit"
87+
)
88+
89+
var (
90+
usb_VID uint16 = 0x239A
91+
usb_PID uint16 = 0x801E
92+
)
93+
94+
var (
95+
DefaultUART = UART0
96+
)

targets/gemma-m0.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"inherits": ["atsamd21e18a"],
3+
"build-tags": ["gemma_m0"],
4+
"serial": "usb",
5+
"serial-port": ["239a:801e"],
6+
"flash-1200-bps-reset": "true",
7+
"flash-method": "msd",
8+
"msd-volume-name": ["GEMMABOOT"],
9+
"msd-firmware-name": "firmware.uf2"
10+
}

0 commit comments

Comments
 (0)