Skip to content

Commit ecc7bd0

Browse files
committed
tested I2C, SPI #1 (SPI flash chip), SPI #2 (w/TFT display), all GPIO, SD card
couldn't find where to config USB VID/PID
1 parent a069340 commit ecc7bd0

File tree

4 files changed

+166
-0
lines changed

4 files changed

+166
-0
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#define MICROPY_HW_BOARD_NAME "Feather STM32F405"
2+
#define MICROPY_HW_MCU_NAME "STM32F405RG"
3+
4+
#define MICROPY_HW_HAS_SWITCH (0)
5+
#define MICROPY_HW_HAS_FLASH (1)
6+
#define MICROPY_HW_HAS_MMA7660 (0)
7+
#define MICROPY_HW_HAS_LCD (0)
8+
#define MICROPY_HW_ENABLE_RNG (1)
9+
#define MICROPY_HW_ENABLE_RTC (1)
10+
#define MICROPY_HW_ENABLE_SERVO (1)
11+
#define MICROPY_HW_ENABLE_DAC (1)
12+
#define MICROPY_HW_ENABLE_USB (1)
13+
#define MICROPY_HW_ENABLE_SDCARD (1)
14+
15+
// HSE is 12MHz
16+
#define MICROPY_HW_CLK_PLLM (12)
17+
#define MICROPY_HW_CLK_PLLN (336)
18+
#define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV2)
19+
#define MICROPY_HW_CLK_PLLQ (7)
20+
#define MICROPY_HW_CLK_LAST_FREQ (1)
21+
22+
// The Feather has a 32kHz crystal for the RTC
23+
#define MICROPY_HW_RTC_USE_LSE (1)
24+
#define MICROPY_HW_RTC_USE_US (0)
25+
#define MICROPY_HW_RTC_USE_CALOUT (1)
26+
27+
// UART config
28+
#define MICROPY_HW_UART3_NAME "UART3" // on RX / TX
29+
#define MICROPY_HW_UART3_TX (pin_B10) // TX
30+
#define MICROPY_HW_UART3_RX (pin_B11) // RX
31+
#define MICROPY_HW_UART3_RTS (pin_B14) // MISO
32+
#define MICROPY_HW_UART3_CTS (pin_B13) // SCK
33+
34+
#define MICROPY_HW_UART2_NAME "UART2" // on SDA/SCL
35+
#define MICROPY_HW_UART2_TX (pin_B6) // SCL
36+
#define MICROPY_HW_UART2_RX (pin_B7) // SDA
37+
38+
#define MICROPY_HW_UART6_NAME "UART6" // on D5/D6
39+
#define MICROPY_HW_UART6_TX (pin_C6) // D6
40+
#define MICROPY_HW_UART6_RX (pin_C7) // D5
41+
42+
// I2C busses
43+
#define MICROPY_HW_I2C1_NAME "I2C1"
44+
#define MICROPY_HW_I2C1_SCL (pin_B6) // SCL
45+
#define MICROPY_HW_I2C1_SDA (pin_B7) // SDA
46+
#define MICROPY_HW_I2C2_NAME "I2C2"
47+
#define MICROPY_HW_I2C2_SCL (pin_B10) // TX
48+
#define MICROPY_HW_I2C2_SDA (pin_B11) // RX
49+
50+
// SPI busses
51+
#define MICROPY_HW_SPI1_NAME "SPIFLASH"
52+
#define MICROPY_HW_SPI1_NSS (pin_A15) // FLASH CS
53+
#define MICROPY_HW_SPI1_SCK (pin_B3) // FLASH CLK
54+
#define MICROPY_HW_SPI1_MISO (pin_B4) // FLASH MISO
55+
#define MICROPY_HW_SPI1_MOSI (pin_B5) // FLASH MOSI
56+
#define MICROPY_HW_SPI2_NAME "SPI1"
57+
#define MICROPY_HW_SPI2_NSS (pin_B12) // SD DETECT
58+
#define MICROPY_HW_SPI2_SCK (pin_B13) // SCK
59+
#define MICROPY_HW_SPI2_MISO (pin_B14) // MISO
60+
#define MICROPY_HW_SPI2_MOSI (pin_B15) // MOSI
61+
62+
// CAN busses
63+
#define MICROPY_HW_CAN1_NAME "CAN1"
64+
#define MICROPY_HW_CAN1_TX (pin_B9) // D10
65+
#define MICROPY_HW_CAN1_RX (pin_B8) // D9
66+
67+
// The Feather has 1 LED
68+
#define MICROPY_HW_LED1 (pin_C1) // red
69+
#define MICROPY_HW_LED_ON(pin) (mp_hal_pin_high(pin))
70+
#define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_low(pin))
71+
72+
// SD card detect switch
73+
#define MICROPY_HW_SDCARD_DETECT_PIN (pin_B12)
74+
#define MICROPY_HW_SDCARD_DETECT_PULL (GPIO_PULLUP)
75+
#define MICROPY_HW_SDCARD_DETECT_PRESENT (GPIO_PIN_RESET)
76+
77+
// USB config
78+
#define MICROPY_HW_USB_FS (1)
79+
#define MICROPY_HW_USB_VBUS_DETECT_PIN (pin_A9)
80+
#define MICROPY_HW_USB_OTG_ID_PIN (pin_A10)
81+
82+
// Bootloader configuration (only needed if Mboot is used)
83+
#define MBOOT_I2C_PERIPH_ID 1
84+
#define MBOOT_I2C_SCL (pin_B8)
85+
#define MBOOT_I2C_SDA (pin_B9)
86+
#define MBOOT_I2C_ALTFUNC (4)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
MCU_SERIES = f4
2+
CMSIS_MCU = STM32F405xx
3+
AF_FILE = boards/stm32f405_af.csv
4+
ifeq ($(USE_MBOOT),1)
5+
# When using Mboot all the text goes together after the filesystem
6+
LD_FILES = boards/stm32f405.ld boards/common_blifs.ld
7+
TEXT0_ADDR = 0x08020000
8+
else
9+
# When not using Mboot the ISR text goes first, then the rest after the filesystem
10+
LD_FILES = boards/stm32f405.ld boards/common_ifs.ld
11+
TEXT0_ADDR = 0x08000000
12+
TEXT1_ADDR = 0x08020000
13+
endif
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
POWER,3.3V
2+
GND,GND
3+
USB_ID,PA10
4+
USB_DM,PA11
5+
USB_DP,PA12
6+
SWDIO,PA13
7+
SWCLK,PA14
8+
FLASH_CS,PA15
9+
BATTERY_MONITOR,PA3
10+
A0,PA4
11+
A1,PA5
12+
A2,PA6
13+
A3,PA7
14+
USB_VBUS,PA9
15+
TX,PB10
16+
D1,PB10
17+
RX,PB11
18+
D0,PB11
19+
SD_DETECT,PB12
20+
SCK,PB13
21+
MISO,PB14
22+
MOSI,PB15
23+
BOOT1,PB2
24+
FLASH_SCK,PB3
25+
FLASH_MISO,PB4
26+
FLASH_MOSI,PB5
27+
SCL,PB6
28+
SDA,PB7
29+
D9,PB8
30+
D10,PB9
31+
D8,PC0
32+
NEOPIXEL,PC0
33+
D13,PC1
34+
SD_D2,PC10
35+
SD_D3,PC11
36+
SD_CK,PC12
37+
D12,PC2
38+
D11,PC3
39+
A4,PC4
40+
A5,PC5
41+
D6,PC6
42+
D5,PC7
43+
SD_D0,PC8
44+
SD_D1,PC9
45+
SD_CMD,PD2
46+
NC_A0,PA0
47+
NC_A1,PA1
48+
NC_A2,PA2
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* This file is part of the MicroPython project, http://micropython.org/
2+
* The MIT License (MIT)
3+
* Copyright (c) 2019 Damien P. George
4+
*/
5+
#ifndef MICROPY_INCLUDED_STM32F4XX_HAL_CONF_H
6+
#define MICROPY_INCLUDED_STM32F4XX_HAL_CONF_H
7+
8+
#include "boards/stm32f4xx_hal_conf_base.h"
9+
10+
// Oscillator values in Hz
11+
#define HSE_VALUE (12000000)
12+
#define LSE_VALUE (32768)
13+
#define EXTERNAL_CLOCK_VALUE (12288000)
14+
15+
// Oscillator timeouts in ms
16+
#define HSE_STARTUP_TIMEOUT (100)
17+
#define LSE_STARTUP_TIMEOUT (5000)
18+
19+
#endif // MICROPY_INCLUDED_STM32F4XX_HAL_CONF_H

0 commit comments

Comments
 (0)