Skip to content

Commit f308d7d

Browse files
committed
machine/badger2040: support for Badger 2040
Signed-off-by: deadprogram <[email protected]>
1 parent 7729a36 commit f308d7d

File tree

3 files changed

+102
-0
lines changed

3 files changed

+102
-0
lines changed

src/machine/board_badger2040.go

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
//go:build badger2040
2+
// +build badger2040
3+
4+
// This contains the pin mappings for the Badger 2040 Connect board.
5+
//
6+
// For more information, see: https://shop.pimoroni.com/products/badger-2040
7+
// Also
8+
// - Badger 2040 schematic: https://cdn.shopify.com/s/files/1/0174/1800/files/badger_2040_schematic.pdf?v=1645702148
9+
//
10+
package machine
11+
12+
const (
13+
LED Pin = GPIO25
14+
15+
BUTTON_A Pin = GPIO12
16+
BUTTON_B Pin = GPIO13
17+
BUTTON_C Pin = GPIO14
18+
BUTTON_UP Pin = GPIO15
19+
BUTTON_DOWN Pin = GPIO11
20+
BUTTON_USER Pin = GPIO23
21+
22+
EPD_BUSY_PIN Pin = GPIO26
23+
EPD_RESET_PIN Pin = GPIO21
24+
EPD_DC_PIN Pin = GPIO20
25+
EPD_CS_PIN Pin = GPIO17
26+
EPD_SCK_PIN Pin = GPIO18
27+
EPD_SDO_PIN Pin = GPIO19
28+
29+
VBUS_DETECT Pin = GPIO24
30+
BATTERY Pin = GPIO29
31+
ENABLE_3V3 Pin = GPIO10
32+
)
33+
34+
// I2C pins
35+
const (
36+
I2C0_SDA_PIN Pin = GPIO4
37+
I2C0_SCL_PIN Pin = GPIO5
38+
39+
I2C1_SDA_PIN Pin = NoPin
40+
I2C1_SCL_PIN Pin = NoPin
41+
)
42+
43+
// SPI pins.
44+
const (
45+
SPI0_SCK_PIN Pin = GPIO18
46+
SPI0_SDO_PIN Pin = GPIO19
47+
SPI0_SDI_PIN Pin = GPIO16
48+
49+
SPI1_SCK_PIN Pin = NoPin
50+
SPI1_SDO_PIN Pin = NoPin
51+
SPI1_SDI_PIN Pin = NoPin
52+
)
53+
54+
// QSPI pins¿?
55+
const (
56+
/* TODO
57+
SPI0_SD0_PIN Pin = QSPI_SD0
58+
SPI0_SD1_PIN Pin = QSPI_SD1
59+
SPI0_SD2_PIN Pin = QSPI_SD2
60+
SPI0_SD3_PIN Pin = QSPI_SD3
61+
SPI0_SCK_PIN Pin = QSPI_SCLKGPIO6
62+
SPI0_CS_PIN Pin = QSPI_CS
63+
64+
*/
65+
)
66+
67+
// Onboard crystal oscillator frequency, in MHz.
68+
const (
69+
xoscFreq = 12 // MHz
70+
)
71+
72+
// USB CDC identifiers
73+
const (
74+
usb_STRING_PRODUCT = "Badger 2040"
75+
usb_STRING_MANUFACTURER = "Pimoroni"
76+
)
77+
78+
var (
79+
usb_VID uint16 = 0x2e8a
80+
usb_PID uint16 = 0x0003
81+
)

targets/badger2040.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"inherits": [
3+
"rp2040"
4+
],
5+
"serial": "uart",
6+
"build-tags": ["badger2040"],
7+
"linkerscript": "targets/badger2040.ld",
8+
"extra-files": [
9+
"targets/pico-boot-stage2.S"
10+
]
11+
}

targets/badger2040.ld

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
MEMORY
3+
{
4+
/* Reserve exactly 256 bytes at start of flash for second stage bootloader */
5+
BOOT2_TEXT (rx) : ORIGIN = 0x10000000, LENGTH = 256
6+
FLASH_TEXT (rx) : ORIGIN = 0x10000000 + 256, LENGTH = 1020K - 256
7+
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256k
8+
}
9+
10+
INCLUDE "targets/rp2040.ld"

0 commit comments

Comments
 (0)