Skip to content

Commit

Permalink
stmhal: Add board BLACK STM32F407VE
Browse files Browse the repository at this point in the history
  • Loading branch information
mcauser committed Mar 12, 2017
0 parents commit 9200f96
Show file tree
Hide file tree
Showing 4 changed files with 654 additions and 0 deletions.
144 changes: 144 additions & 0 deletions mpconfigboard.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
#define BLACK_F407VE

#define MICROPY_HW_BOARD_NAME "BLACK STM32F407VE"
#define MICROPY_HW_MCU_NAME "STM32F407VE"

#define MICROPY_HW_HAS_SWITCH (1) // has 2 buttons KEY0=PE4, KEY1=PE3
#define MICROPY_HW_HAS_FLASH (1)
#define MICROPY_HW_HAS_SDCARD (0) // it has a sd scard, but i am not sure what the detect pin is, yet
#define MICROPY_HW_HAS_MMA7660 (0)
#define MICROPY_HW_HAS_LIS3DSH (0)
#define MICROPY_HW_HAS_LCD (0) // has a ILI9341 TFT connector
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_ENABLE_RTC (1)
#define MICROPY_HW_ENABLE_TIMER (1)
#define MICROPY_HW_ENABLE_SERVO (0)
#define MICROPY_HW_ENABLE_DAC (1)
#define MICROPY_HW_ENABLE_CAN (1)

// HSE is 8MHz
#define MICROPY_HW_CLK_PLLM (8) // divide external clock by this to get 1MHz
#define MICROPY_HW_CLK_PLLN (336) // PLL clock in MHz
#define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV2) // divide PLL clock by this to get core clock
#define MICROPY_HW_CLK_PLLQ (7) // divide core clock by this to get 48MHz

// The board 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) // turn on/off PC13 512Hz output

// USART1
#define MICROPY_HW_UART1_TX (pin_A9) // PA9,PB6
#define MICROPY_HW_UART1_RX (pin_A10) // PA10,PB7

// USART2
#define MICROPY_HW_UART2_TX (pin_A2) // PA2,PD5
#define MICROPY_HW_UART2_RX (pin_A3) // PA3,PD6
#define MICROPY_HW_UART2_RTS (pin_A1) // PA1,PD4
#define MICROPY_HW_UART2_CTS (pin_A0) // PA0,PD3

// USART3
#define MICROPY_HW_UART3_TX (pin_D8) // PB10,PC10,PD8
#define MICROPY_HW_UART3_RX (pin_D9) // PB11,PC11,PD9
#define MICROPY_HW_UART3_RTS (pin_D12) // PB14,PD12
#define MICROPY_HW_UART3_CTS (pin_D11) // PB13,PD11

// UART4
#define MICROPY_HW_UART4_TX (pin_C10) // PC10
#define MICROPY_HW_UART4_RX (pin_C11) // PC11

// UART5
#define MICROPY_HW_UART5_TX (pin_C12) // PC12
#define MICROPY_HW_UART5_RX (pin_D2) // PD2

// USART6
//#define MICROPY_HW_UART6_TX (pin_C6) // PC6,PG14
//#define MICROPY_HW_UART6_RX (pin_C7) // PC7,PG9

// UART7
// #define MICROPY_HW_UART7_TX (pin_E8) // PE8,PF7
// #define MICROPY_HW_UART7_RX (pin_E7) // PE7,PF6

// UART8
// #define MICROPY_HW_UART8_TX (pin_E1) // PE1
// #define MICROPY_HW_UART8_RX (pin_E0) // PE0

// I2C busses
#define MICROPY_HW_I2C1_SCL (pin_B6) // PB8,PB6
#define MICROPY_HW_I2C1_SDA (pin_B7) // PB9,PB7

#define MICROPY_HW_I2C2_SCL (pin_B10) // PB10
#define MICROPY_HW_I2C2_SDA (pin_B11) // PB11

//#define MICROPY_HW_I2C3_SCL (pin_A8) // PA8
//#define MICROPY_HW_I2C3_SDA (pin_C9) // PC9

// I2S busses
// I2S2_CK PB13
// I2S2_MCK PC6
// I2S2_SD PB15
// I2S2_WS PB12

// I2S3_CK PB3
// I2S3_MCK PC7
// I2S3_SD PB5
// I2S3_WS PA15

// SPI busses
#define MICROPY_HW_SPI1_NSS (pin_A4) // PA4
#define MICROPY_HW_SPI1_SCK (pin_A5) // PA5,PB3
#define MICROPY_HW_SPI1_MISO (pin_A6) // PA6,PB4
#define MICROPY_HW_SPI1_MOSI (pin_A7) // PA7,PB5

#define MICROPY_HW_SPI2_NSS (pin_B12) // PB12
#define MICROPY_HW_SPI2_SCK (pin_B13) // PB13
#define MICROPY_HW_SPI2_MISO (pin_B14) // PB14
#define MICROPY_HW_SPI2_MOSI (pin_B15) // PB15

#define MICROPY_HW_SPI3_NSS (pin_A15) // PA15
#define MICROPY_HW_SPI3_SCK (pin_B3) // PB3
#define MICROPY_HW_SPI3_MISO (pin_B4) // PB4
#define MICROPY_HW_SPI3_MOSI (pin_B5) // PB5

// CAN busses
// CAN_TX PB9,PD1,PA12
// CAN_RX PB8,PD0,PA11

// DAC
// DAC_OUT1 PA4
// DAC_OUT2 PA5

// KEY0 has no pullup or pulldown, and pressing the switch makes the input go low
#define MICROPY_HW_USRSW_PIN (pin_E4)
#define MICROPY_HW_USRSW_PULL (GPIO_PULLUP)
#define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_FALLING)
#define MICROPY_HW_USRSW_PRESSED (0)

// KEY1 - no support for multiple user buttons, yet
// pin_E3

// LEDs
// Red LED D1 is the power LED and always on
#define MICROPY_HW_LED1 (pin_A6) // Red LED D2
#define MICROPY_HW_LED2 (pin_A7) // Red LED D3
#define MICROPY_HW_LED_ON(pin) (mp_hal_pin_low(pin))
#define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_high(pin))

// SD card detect switch
// #define MICROPY_HW_SDCARD_DETECT_PIN (pin_A8) // nope
// #define MICROPY_HW_SDCARD_DETECT_PULL (GPIO_PULLUP)
// #define MICROPY_HW_SDCARD_DETECT_PRESENT (GPIO_PIN_RESET)
// 1 - PC10 - DAT2/RES
// 2 - PC11 - CD/DAT3/CS
// 3 - PD2 - CMD/DI
// 4 - VCC - VDD
// 5 - PC12 - CLK/SCLK
// 6 - GND - VSS
// 7 - PC8 - DAT0/D0
// 8 - PC9 - DAT1/RES
// 9 SW2 - GND
// 10 SW1 - GND

// USB config
// #define MICROPY_HW_USB_VBUS_DETECT_PIN (pin_A9)
// #define MICROPY_HW_USB_OTG_ID_PIN (pin_A10)
4 changes: 4 additions & 0 deletions mpconfigboard.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
MCU_SERIES = f4
CMSIS_MCU = STM32F407xx
AF_FILE = boards/stm32f405_af.csv
LD_FILE = boards/stm32f405.ld
95 changes: 95 additions & 0 deletions pins.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
PA0,PA0
PA1,PA1
PA2,PA2
PA3,PA3
PA4,PA4
PA5,PA5
PA6,PA6
PA7,PA7
PA8,PA8
PA9,PA9
PA10,PA10
PA11,PA11
PA12,PA12
PA13,PA13
PA14,PA14
PA15,PA15
PB0,PB0
PB1,PB1
PB2,PB2
PB3,PB3
PB4,PB4
PB5,PB5
PB6,PB6
PB7,PB7
PB8,PB8
PB9,PB9
PB10,PB10
PB11,PB11
PB12,PB12
PB13,PB13
PB14,PB14
PB15,PB15
PC0,PC0
PC1,PC1
PC2,PC2
PC3,PC3
PC4,PC4
PC5,PC5
PC6,PC6
PC7,PC7
PC8,PC8
PC9,PC9
PC10,PC10
PC11,PC11
PC12,PC12
PC13,PC13
PC14,PC14
PC15,PC15
PD0,PD0
PD1,PD1
PD2,PD2
PD3,PD3
PD4,PD4
PD5,PD5
PD6,PD6
PD7,PD7
PD8,PD8
PD9,PD9
PD10,PD10
PD11,PD11
PD12,PD12
PD13,PD13
PD14,PD14
PD15,PD15
PE0,PE0
PE1,PE1
PE2,PE2
PE3,PE3
PE4,PE4
PE5,PE5
PE6,PE6
PE7,PE7
PE8,PE8
PE9,PE9
PE10,PE10
PE11,PE11
PE12,PE12
PE13,PE13
PE14,PE14
PE15,PE15
RED_LED,PA6
LED_D2,PA6
LED_D3,PA7
USB_VBUS,PA9
USB_ID,PA10
USB_DM,PA11
USB_DP,PA12
OSC32_IN,PC14
OSC32_OUT,PC15
SD_D0,PC8
SD_D1,PC9
SD_D2,PC10
SD_D3,PC11
SD_CK,PC12
SD_CMD,PD2
Loading

0 comments on commit 9200f96

Please sign in to comment.