Skip to content

Commit 90e6d0c

Browse files
committed
stmhal: Add support for Espruino Pico board.
To build: make BOARD=ESPRUINO_PICO To deploy: short the BOOT0/BTN contact on the back of the board (eg by drawing over it with a graphite pencil), then hold down BTN while inserting the board into the USB port. The board should then enter DFU mode, and the firmware can be downloaded using: make BOARD=ESPRUINO_PICO deploy
1 parent e4b4e5a commit 90e6d0c

5 files changed

Lines changed: 495 additions & 5 deletions

File tree

stmhal/.gitignore

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
build-PYBV3/
2-
build-PYBV4/
3-
build-PYBV10/
4-
build-STM32F4DISC/
5-
build-NETDUINO_PLUS_2/
1+
build-*/
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#define MICROPY_HW_BOARD_NAME "Espruino Pico"
2+
#define MICROPY_HW_MCU_NAME "STM32F401CD"
3+
#define MICROPY_PY_SYS_PLATFORM "pyboard"
4+
5+
#define MICROPY_HW_HAS_SWITCH (1)
6+
#define MICROPY_HW_HAS_SDCARD (0)
7+
#define MICROPY_HW_HAS_MMA7660 (0)
8+
#define MICROPY_HW_HAS_LIS3DSH (0)
9+
#define MICROPY_HW_HAS_LCD (0)
10+
#define MICROPY_HW_ENABLE_RNG (0)
11+
#define MICROPY_HW_ENABLE_RTC (1)
12+
#define MICROPY_HW_ENABLE_TIMER (1)
13+
#define MICROPY_HW_ENABLE_SERVO (1)
14+
#define MICROPY_HW_ENABLE_DAC (0)
15+
#define MICROPY_HW_ENABLE_SPI1 (1)
16+
#define MICROPY_HW_ENABLE_SPI2 (1)
17+
#define MICROPY_HW_ENABLE_SPI3 (0)
18+
#define MICROPY_HW_ENABLE_CAN (0)
19+
20+
// Pico has an 8 MHz HSE and the F401 does 84 MHz max
21+
#define MICROPY_HW_CLK_PLLM (5)
22+
#define MICROPY_HW_CLK_PLLN (210)
23+
#define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV4)
24+
#define MICROPY_HW_CLK_PLLQ (7)
25+
26+
// does not have a 32kHz crystal
27+
#define MICROPY_HW_RTC_USE_LSE (0)
28+
29+
// I2C busses
30+
#define MICROPY_HW_I2C1_SCL (pin_B6)
31+
#define MICROPY_HW_I2C1_SDA (pin_B7)
32+
#define MICROPY_HW_I2C2_SCL (pin_B10)
33+
#define MICROPY_HW_I2C2_SDA (pin_B3)
34+
#define MICROPY_HW_I2C3_SCL (pin_A8)
35+
#define MICROPY_HW_I2C3_SDA (pin_B4)
36+
37+
// BTN1 has no pullup or pulldown; it is active high and broken out on a header
38+
#define MICROPY_HW_USRSW_PIN (pin_C13)
39+
#define MICROPY_HW_USRSW_PULL (GPIO_PULLDOWN)
40+
#define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_RISING)
41+
#define MICROPY_HW_USRSW_PRESSED (1)
42+
43+
// Pico has 2 LEDs
44+
#define MICROPY_HW_LED1 (pin_B2) // red
45+
#define MICROPY_HW_LED2 (pin_B12) // green
46+
#define MICROPY_HW_LED3 (pin_B12) // green
47+
#define MICROPY_HW_LED4 (pin_B12) // green
48+
#define MICROPY_HW_LED_OTYPE (GPIO_MODE_OUTPUT_PP)
49+
#define MICROPY_HW_LED_ON(pin) (pin->gpio->BSRRL = pin->pin_mask)
50+
#define MICROPY_HW_LED_OFF(pin) (pin->gpio->BSRRH = pin->pin_mask)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
AF_FILE = boards/stm32f401_af.csv
2+
LD_FILE = boards/stm32f401.ld
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
B3,PB3
2+
B4,PB4
3+
B5,PB5
4+
B6,PB6
5+
B7,PB7
6+
A8,PA8
7+
B8,PB8
8+
B9,PB9
9+
A10,PA10
10+
A0,PA0
11+
A1,PA1
12+
A2,PA2
13+
A3,PA3
14+
A4,PA4
15+
A5,PA5
16+
A6,PA6
17+
A7,PA7
18+
B1,PB1
19+
B10,PB10
20+
B13,PB13
21+
B14,PB14
22+
B15,PB15
23+
B0,PB0
24+
SW,PC13
25+
LED_RED,PB2
26+
LED_GREEN,PB12
27+
USB_VBUS,PA9
28+
USB_DM,PA11
29+
USB_DP,PA12
30+
OSC32_IN,PC14
31+
OSC32_OUT,PC15
32+
NC1,PA13
33+
NC2,PA14
34+
NC3,PA15

0 commit comments

Comments
 (0)