stm32/boards: Add OLIMEX H407 board definition.

This change adds the OLIMEX H407 support to the STM32 port.  The H407
(https://www.olimex.com/Products/ARM/ST/STM32-H407/) is simliar to the
already existing E407
(https://www.olimex.com/Products/ARM/ST/STM32-E407) but does not support
Ethernet and has a full-size USB-A port instead of a Mini-USB socket.

Both boards use the STM32F407ZGT6 CPU.

This port is basically a copy of the E407 but with changed pinmux:
* Removed Ethernet pin definition
* Removed UART1 (pins are used for other functions)
* Removed UART3 flow control pins (pins are used for other functions)
* Removed SD-Card detect pin (since it is not connected on the H407)

A REPL on UART3 is connected to the U3BOOT-header, a 3-pin header with RX,
TX and GND that is intended for the serial terminal.

Tested:
* Micro-SD Card is detected when inserted on RESET
* REPL on UART3 works
* Serial port on the mini USB socket

Signed-off-by: Chris Fiege <cfi@pengutronix.de>
This commit is contained in:
Chris Fiege 2021-09-14 11:50:53 +02:00 committed by Damien George
parent 4cfd85eb4a
commit 6e39f2cc1e
5 changed files with 213 additions and 0 deletions

View File

@ -0,0 +1,18 @@
OLIMEX H407 board
=================
This board definition supports the OLIMEX H407 board:
https://www.olimex.com/Products/ARM/ST/STM32-H407/
A REPL is available at the U3BOOT connector with 115200 baud and on the
micro USB socket.
What works
----------
* REPL
* UART
* SD-Card
* Timer
* GPIOs
* USB device on the mini USB socket

View File

@ -0,0 +1,81 @@
#define MICROPY_HW_BOARD_NAME "OLIMEX STM32-H407"
#define MICROPY_HW_MCU_NAME "STM32F407"
#define MICROPY_HW_HAS_SWITCH (1)
#define MICROPY_HW_HAS_FLASH (1)
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_ENABLE_RTC (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)
// UART config
#define MICROPY_HW_UART2_TX (pin_A2)
#define MICROPY_HW_UART2_RX (pin_A3)
#define MICROPY_HW_UART3_TX (pin_B10)
#define MICROPY_HW_UART3_RX (pin_B11)
#define MICROPY_HW_UART3_RTS (pin_D12)
#define MICROPY_HW_UART3_CTS (pin_D11)
#if MICROPY_HW_HAS_SWITCH == 0
// NOTE: A0 also connects to the user switch. To use UART4 you should
// set MICROPY_HW_HAS_SWITCH to 0, and also remove SB20 (on the back
// of the board near the USER switch).
#define MICROPY_HW_UART4_TX (pin_A0)
#define MICROPY_HW_UART4_RX (pin_A1)
#endif
#define MICROPY_HW_UART6_TX (pin_C6)
#define MICROPY_HW_UART6_RX (pin_C7)
// REPL mapping
#define MICROPY_HW_UART_REPL PYB_UART_3
#define MICROPY_HW_UART_REPL_BAUD 115200
// I2C buses
#define MICROPY_HW_I2C1_SCL (pin_B8)
#define MICROPY_HW_I2C1_SDA (pin_B9)
#define MICROPY_HW_I2C2_SCL (pin_B10)
#define MICROPY_HW_I2C2_SDA (pin_B11)
// SPI buses
#define MICROPY_HW_SPI1_NSS (pin_A4)
#define MICROPY_HW_SPI1_SCK (pin_A5)
#define MICROPY_HW_SPI1_MISO (pin_A6)
#define MICROPY_HW_SPI1_MOSI (pin_A7)
#define MICROPY_HW_SPI2_NSS (pin_B12)
#define MICROPY_HW_SPI2_SCK (pin_B13)
#define MICROPY_HW_SPI2_MISO (pin_B14)
#define MICROPY_HW_SPI2_MOSI (pin_B15)
// CAN buses
#define MICROPY_HW_CAN1_TX (pin_B9)
#define MICROPY_HW_CAN1_RX (pin_B8)
#define MICROPY_HW_CAN2_TX (pin_B13)
#define MICROPY_HW_CAN2_RX (pin_B12)
// USRSW is pulled low. Pressing the button makes the input go high.
#define MICROPY_HW_USRSW_PIN (pin_A0)
#define MICROPY_HW_USRSW_PULL (GPIO_NOPULL)
#define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_RISING)
#define MICROPY_HW_USRSW_PRESSED (1)
// LEDs
#define MICROPY_HW_LED1 (pin_C13)
#define MICROPY_HW_LED_ON(pin) (mp_hal_pin_low(pin))
#define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_high(pin))
// USB config
#define MICROPY_HW_USB_HS (1)
#define MICROPY_HW_USB_HS_IN_FS (1)
#define MICROPY_HW_USB_VBUS_DETECT_PIN (pin_B13)
#define MICROPY_HW_USB_OTG_ID_PIN (pin_B12)

View File

@ -0,0 +1,6 @@
MCU_SERIES = f4
CMSIS_MCU = STM32F407xx
AF_FILE = boards/stm32f405_af.csv
LD_FILES = boards/stm32f405.ld boards/common_ifs.ld
TEXT0_ADDR = 0x08000000
TEXT1_ADDR = 0x08020000

View File

@ -0,0 +1,89 @@
PC0,PC0
PC1,PC1
PC2,PC2
PC3,PC3
PA0,PA0
PA1,PA1
PA2,PA2
PA3,PA3
PA4,PA4
PA5,PA5
PA6,PA6
PA7,PA7
PC4,PC4
PC5,PC5
PB0,PB0
PB1,PB1
PB2,PB2
PE7,PE7
PE8,PE8
PE9,PE9
PE10,PE10
PE11,PE11
PE12,PE12
PE13,PE13
PE14,PE14
PE15,PE15
PB10,PB10
PB11,PB11
PB12,PB12
PB13,PB13
PB14,PB14
PB15,PB15
PD8,PD8
PD9,PD9
PD10,PD10
PD11,PD11
PD12,PD12
PD13,PD13
PD14,PD14
PD15,PD15
PC6,PC6
PC7,PC7
PC8,PC8
PC9,PC9
PA8,PA8
PA9,PA9
PA10,PA10
PA13,PA13
PA14,PA14
PA15,PA15
PC10,PC10
PC11,PC11
PC12,PC12
PD0,PD0
PD1,PD1
PD2,PD2
PD3,PD3
PD4,PD4
PD5,PD5
PD6,PD6
PD7,PD7
PB4,PB4
PB5,PB5
PB6,PB6
PB7,PB7
PB8,PB8
PB9,PB9
PE0,PE0
PE1,PE1
PE2,PE2
PE3,PE3
PE4,PE4
PE5,PE5
PE6,PE6
LED_GREEN,PC13
PC14,PC14
PC15,PC15
PH0,PH0
PH1,PH1
PD12,PD12
PD13,PD13
PD14,PD14
PD15,PD15
PA0,PA0
USB_DM,PA11
USB_DP,PA12
PG11,PG11
PG13,PG13
PG14,PG14
1 PC0 PC0
2 PC1 PC1
3 PC2 PC2
4 PC3 PC3
5 PA0 PA0
6 PA1 PA1
7 PA2 PA2
8 PA3 PA3
9 PA4 PA4
10 PA5 PA5
11 PA6 PA6
12 PA7 PA7
13 PC4 PC4
14 PC5 PC5
15 PB0 PB0
16 PB1 PB1
17 PB2 PB2
18 PE7 PE7
19 PE8 PE8
20 PE9 PE9
21 PE10 PE10
22 PE11 PE11
23 PE12 PE12
24 PE13 PE13
25 PE14 PE14
26 PE15 PE15
27 PB10 PB10
28 PB11 PB11
29 PB12 PB12
30 PB13 PB13
31 PB14 PB14
32 PB15 PB15
33 PD8 PD8
34 PD9 PD9
35 PD10 PD10
36 PD11 PD11
37 PD12 PD12
38 PD13 PD13
39 PD14 PD14
40 PD15 PD15
41 PC6 PC6
42 PC7 PC7
43 PC8 PC8
44 PC9 PC9
45 PA8 PA8
46 PA9 PA9
47 PA10 PA10
48 PA13 PA13
49 PA14 PA14
50 PA15 PA15
51 PC10 PC10
52 PC11 PC11
53 PC12 PC12
54 PD0 PD0
55 PD1 PD1
56 PD2 PD2
57 PD3 PD3
58 PD4 PD4
59 PD5 PD5
60 PD6 PD6
61 PD7 PD7
62 PB4 PB4
63 PB5 PB5
64 PB6 PB6
65 PB7 PB7
66 PB8 PB8
67 PB9 PB9
68 PE0 PE0
69 PE1 PE1
70 PE2 PE2
71 PE3 PE3
72 PE4 PE4
73 PE5 PE5
74 PE6 PE6
75 LED_GREEN PC13
76 PC14 PC14
77 PC15 PC15
78 PH0 PH0
79 PH1 PH1
80 PD12 PD12
81 PD13 PD13
82 PD14 PD14
83 PD15 PD15
84 PA0 PA0
85 USB_DM PA11
86 USB_DP PA12
87 PG11 PG11
88 PG13 PG13
89 PG14 PG14

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