stm32/boards: Add new board ADAFRUIT_F405_EXPRESS.

This commit is contained in:
ladyada 2019-10-03 02:54:47 -04:00 committed by Damien George
parent 98c2eabaff
commit 06ae818f93
4 changed files with 166 additions and 0 deletions

View File

@ -0,0 +1,86 @@
#define MICROPY_HW_BOARD_NAME "Adafruit Feather STM32F405"
#define MICROPY_HW_MCU_NAME "STM32F405RG"
#define MICROPY_HW_HAS_SWITCH (0)
#define MICROPY_HW_HAS_FLASH (1)
#define MICROPY_HW_HAS_MMA7660 (0)
#define MICROPY_HW_HAS_LCD (0)
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_ENABLE_RTC (1)
#define MICROPY_HW_ENABLE_SERVO (1)
#define MICROPY_HW_ENABLE_DAC (1)
#define MICROPY_HW_ENABLE_USB (1)
#define MICROPY_HW_ENABLE_SDCARD (1)
// HSE is 12MHz
#define MICROPY_HW_CLK_PLLM (12)
#define MICROPY_HW_CLK_PLLN (336)
#define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV2)
#define MICROPY_HW_CLK_PLLQ (7)
#define MICROPY_HW_CLK_LAST_FREQ (1)
// The Feather has a 32kHz crystal for the RTC
#define MICROPY_HW_RTC_USE_LSE (1)
#define MICROPY_HW_RTC_USE_US (0)
#define MICROPY_HW_RTC_USE_CALOUT (1)
// UART config
#define MICROPY_HW_UART3_NAME "UART3" // on RX / TX
#define MICROPY_HW_UART3_TX (pin_B10) // TX
#define MICROPY_HW_UART3_RX (pin_B11) // RX
#define MICROPY_HW_UART3_RTS (pin_B14) // MISO
#define MICROPY_HW_UART3_CTS (pin_B13) // SCK
#define MICROPY_HW_UART2_NAME "UART2" // on SDA/SCL
#define MICROPY_HW_UART2_TX (pin_B6) // SCL
#define MICROPY_HW_UART2_RX (pin_B7) // SDA
#define MICROPY_HW_UART6_NAME "UART6" // on D5/D6
#define MICROPY_HW_UART6_TX (pin_C6) // D6
#define MICROPY_HW_UART6_RX (pin_C7) // D5
// I2C busses
#define MICROPY_HW_I2C1_NAME "I2C1"
#define MICROPY_HW_I2C1_SCL (pin_B6) // SCL
#define MICROPY_HW_I2C1_SDA (pin_B7) // SDA
#define MICROPY_HW_I2C2_NAME "I2C2"
#define MICROPY_HW_I2C2_SCL (pin_B10) // TX
#define MICROPY_HW_I2C2_SDA (pin_B11) // RX
// SPI busses
#define MICROPY_HW_SPI1_NAME "SPIFLASH"
#define MICROPY_HW_SPI1_NSS (pin_A15) // FLASH CS
#define MICROPY_HW_SPI1_SCK (pin_B3) // FLASH CLK
#define MICROPY_HW_SPI1_MISO (pin_B4) // FLASH MISO
#define MICROPY_HW_SPI1_MOSI (pin_B5) // FLASH MOSI
#define MICROPY_HW_SPI2_NAME "SPI1"
#define MICROPY_HW_SPI2_NSS (pin_B12) // SD DETECT
#define MICROPY_HW_SPI2_SCK (pin_B13) // SCK
#define MICROPY_HW_SPI2_MISO (pin_B14) // MISO
#define MICROPY_HW_SPI2_MOSI (pin_B15) // MOSI
// CAN busses
#define MICROPY_HW_CAN1_NAME "CAN1"
#define MICROPY_HW_CAN1_TX (pin_B9) // D10
#define MICROPY_HW_CAN1_RX (pin_B8) // D9
// The Feather has 1 LED
#define MICROPY_HW_LED1 (pin_C1) // red
#define MICROPY_HW_LED_ON(pin) (mp_hal_pin_high(pin))
#define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_low(pin))
// SD card detect switch
#define MICROPY_HW_SDCARD_DETECT_PIN (pin_B12)
#define MICROPY_HW_SDCARD_DETECT_PULL (GPIO_PULLUP)
#define MICROPY_HW_SDCARD_DETECT_PRESENT (GPIO_PIN_RESET)
// USB config
#define MICROPY_HW_USB_FS (1)
#define MICROPY_HW_USB_VBUS_DETECT_PIN (pin_A9)
#define MICROPY_HW_USB_OTG_ID_PIN (pin_A10)
// Bootloader configuration (only needed if Mboot is used)
#define MBOOT_I2C_PERIPH_ID 1
#define MBOOT_I2C_SCL (pin_B8)
#define MBOOT_I2C_SDA (pin_B9)
#define MBOOT_I2C_ALTFUNC (4)

View File

@ -0,0 +1,13 @@
MCU_SERIES = f4
CMSIS_MCU = STM32F405xx
AF_FILE = boards/stm32f405_af.csv
ifeq ($(USE_MBOOT),1)
# When using Mboot all the text goes together after the filesystem
LD_FILES = boards/stm32f405.ld boards/common_blifs.ld
TEXT0_ADDR = 0x08020000
else
# When not using Mboot the ISR text goes first, then the rest after the filesystem
LD_FILES = boards/stm32f405.ld boards/common_ifs.ld
TEXT0_ADDR = 0x08000000
TEXT1_ADDR = 0x08020000
endif

View File

@ -0,0 +1,48 @@
POWER,3.3V
GND,GND
USB_ID,PA10
USB_DM,PA11
USB_DP,PA12
SWDIO,PA13
SWCLK,PA14
FLASH_CS,PA15
BATTERY_MONITOR,PA3
A0,PA4
A1,PA5
A2,PA6
A3,PA7
USB_VBUS,PA9
TX,PB10
D1,PB10
RX,PB11
D0,PB11
SD_DETECT,PB12
SCK,PB13
MISO,PB14
MOSI,PB15
BOOT1,PB2
FLASH_SCK,PB3
FLASH_MISO,PB4
FLASH_MOSI,PB5
SCL,PB6
SDA,PB7
D9,PB8
D10,PB9
D8,PC0
NEOPIXEL,PC0
D13,PC1
SD_D2,PC10
SD_D3,PC11
SD_CK,PC12
D12,PC2
D11,PC3
A4,PC4
A5,PC5
D6,PC6
D5,PC7
SD_D0,PC8
SD_D1,PC9
SD_CMD,PD2
NC_A0,PA0
NC_A1,PA1
NC_A2,PA2
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

View File

@ -0,0 +1,19 @@
/* This file is part of the MicroPython project, http://micropython.org/
* The MIT License (MIT)
* Copyright (c) 2019 Damien P. George
*/
#ifndef MICROPY_INCLUDED_STM32F4XX_HAL_CONF_H
#define MICROPY_INCLUDED_STM32F4XX_HAL_CONF_H
#include "boards/stm32f4xx_hal_conf_base.h"
// Oscillator values in Hz
#define HSE_VALUE (12000000)
#define LSE_VALUE (32768)
#define EXTERNAL_CLOCK_VALUE (12288000)
// Oscillator timeouts in ms
#define HSE_STARTUP_TIMEOUT (100)
#define LSE_STARTUP_TIMEOUT (5000)
#endif // MICROPY_INCLUDED_STM32F4XX_HAL_CONF_H