Skip to content

Commit e9fbc55

Browse files
flowergrassdpgeorge
authored andcommitted
stmhal: Add NUCLEO_F767ZI board, with openocd config for stm32f7.
1 parent 517f347 commit e9fbc55

8 files changed

Lines changed: 818 additions & 1 deletion

File tree

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// This board is only confirmed to operate using DFU mode and openocd.
2+
// DFU mode can be accessed by setting BOOT0 (see schematics)
3+
// To use openocd run "OPENOCD_CONFIG=boards/openocd_stm32f7.cfg" in
4+
// the make command.
5+
6+
#define MICROPY_HW_BOARD_NAME "NUCLEO-F767ZI"
7+
#define MICROPY_HW_MCU_NAME "STM32F767"
8+
9+
#define MICROPY_HW_HAS_SWITCH (1)
10+
#define MICROPY_HW_HAS_FLASH (1)
11+
#define MICROPY_HW_HAS_SDCARD (0)
12+
#define MICROPY_HW_HAS_MMA7660 (0)
13+
#define MICROPY_HW_HAS_LIS3DSH (0)
14+
#define MICROPY_HW_HAS_LCD (0)
15+
#define MICROPY_HW_ENABLE_RNG (1)
16+
#define MICROPY_HW_ENABLE_RTC (1)
17+
#define MICROPY_HW_ENABLE_TIMER (1)
18+
#define MICROPY_HW_ENABLE_SERVO (0)
19+
#define MICROPY_HW_ENABLE_DAC (0)
20+
#define MICROPY_HW_ENABLE_CAN (1)
21+
22+
// HSE is 25MHz
23+
// VCOClock = HSE * PLLN / PLLM = 25 MHz * 432 / 25 = 432 MHz
24+
// SYSCLK = VCOClock / PLLP = 432 MHz / 2 = 216 MHz
25+
// USB/SDMMC/RNG Clock = VCOClock / PLLQ = 432 MHz / 9 = 48 MHz
26+
#define MICROPY_HW_CLK_PLLM (4)
27+
#define MICROPY_HW_CLK_PLLN (216)
28+
#define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV2)
29+
#define MICROPY_HW_CLK_PLLQ (9)
30+
31+
// From the reference manual, for 2.7V to 3.6V
32+
// 151-180 MHz => 5 wait states
33+
// 181-210 MHz => 6 wait states
34+
// 211-216 MHz => 7 wait states
35+
#define MICROPY_HW_FLASH_LATENCY FLASH_LATENCY_7 // 210-216 MHz needs 7 wait states
36+
37+
// UART config
38+
#define MICROPY_HW_UART2_TX (pin_D5)
39+
#define MICROPY_HW_UART2_RX (pin_D6)
40+
#define MICROPY_HW_UART2_RTS (pin_D4)
41+
#define MICROPY_HW_UART2_CTS (pin_D3)
42+
#define MICROPY_HW_UART3_TX (pin_D8)
43+
#define MICROPY_HW_UART3_RX (pin_D9)
44+
#define MICROPY_HW_UART6_TX (pin_G14)
45+
#define MICROPY_HW_UART6_RX (pin_G9)
46+
#define MICROPY_HW_UART_REPL PYB_UART_3
47+
#define MICROPY_HW_UART_REPL_BAUD 115200
48+
49+
// I2C busses
50+
#define MICROPY_HW_I2C1_SCL (pin_B8)
51+
#define MICROPY_HW_I2C1_SDA (pin_B9)
52+
#define MICROPY_HW_I2C3_SCL (pin_H7)
53+
#define MICROPY_HW_I2C3_SDA (pin_H8)
54+
55+
// TODO These should go in i2c.c
56+
#define MICROPY_HW_I2C_BAUDRATE_TIMING {{100000, 0x40912732}}
57+
#define MICROPY_HW_I2C_BAUDRATE_DEFAULT 100000
58+
#define MICROPY_HW_I2C_BAUDRATE_MAX 100000
59+
60+
// SPI
61+
#define MICROPY_HW_SPI3_NSS (pin_A4)
62+
#define MICROPY_HW_SPI3_SCK (pin_B3)
63+
#define MICROPY_HW_SPI3_MISO (pin_B4)
64+
#define MICROPY_HW_SPI3_MOSI (pin_B5)
65+
66+
// USRSW is pulled low. Pressing the button makes the input go high.
67+
#define MICROPY_HW_USRSW_PIN (pin_C13)
68+
#define MICROPY_HW_USRSW_PULL (GPIO_NOPULL)
69+
#define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_RISING)
70+
#define MICROPY_HW_USRSW_PRESSED (1)
71+
72+
// LEDs
73+
#define MICROPY_HW_LED1 (pin_B0) // green
74+
#define MICROPY_HW_LED2 (pin_B7) // blue
75+
#define MICROPY_HW_LED3 (pin_B14) // red
76+
#define MICROPY_HW_LED_ON(pin) (mp_hal_pin_high(pin))
77+
#define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_low(pin))
78+
79+
// USB config (CN13 - USB OTG FS)
80+
#define MICROPY_HW_USB_VBUS_DETECT_PIN (pin_A9)
81+
#define MICROPY_HW_USB_OTG_ID_PIN (pin_A10)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
MCU_SERIES = f7
2+
CMSIS_MCU = STM32F767xx
3+
AF_FILE = boards/stm32f767_af.csv
4+
LD_FILE = boards/stm32f767.ld
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
A0,PA0
2+
A1,PF10
3+
A2,PF9
4+
A3,PF8
5+
A4,PF7
6+
A5,PF6
7+
D0,PC7
8+
D1,PC6
9+
D2,PG6
10+
D3,PB4
11+
D4,PG7
12+
D5,PA8
13+
D6,PH6
14+
D7,PI3
15+
D8,PI2
16+
D9,PA15
17+
D10,PI0
18+
D11,PB15
19+
D12,PB14
20+
D13,PI1
21+
D14,PB9
22+
D15,PB8
23+
LED1,PB0
24+
LED2,PB7
25+
LED3,PB14
26+
SW,PC13
27+
TP1,PH2
28+
TP2,PI8
29+
TP3,PH15
30+
AUDIO_INT,PD6
31+
AUDIO_SDA,PH8
32+
AUDIO_SCL,PH7
33+
EXT_SDA,PB9
34+
EXT_SCL,PB8
35+
EXT_RST,PG3
36+
SD_SW,PC13
37+
LCD_BL_CTRL,PK3
38+
LCD_INT,PI13
39+
LCD_SDA,PH8
40+
LCD_SCL,PH7
41+
OTG_FS_POWER,PD5
42+
OTG_FS_OVER_CURRENT,PD4
43+
OTG_HS_OVER_CURRENT,PE3
44+
USB_VBUS,PJ12
45+
USB_ID,PA10
46+
USB_DM,PA11
47+
USB_DP,PA12
48+
VCP_TX,PD8
49+
VCP_RX,PD9
50+
UART2_TX,PD5
51+
UART2_RX,PD6
52+
UART2_RTS,PD4
53+
UART2_CTS,PD3
54+
UART6_TX,PG14
55+
UART6_RX,PG9
56+
SPI_B_NSS,PA4
57+
SPI_B_SCK,PB3
58+
SPI_B_MOSI,PB5

0 commit comments

Comments
 (0)