stm32/boards: Add PYBSTICK26 F411 board definition.

This commit is contained in:
Frédéric Pierson 2021-10-28 19:12:09 +02:00 committed by Damien George
parent c422ca3da1
commit fdb925c4c1
6 changed files with 179 additions and 0 deletions

View File

@ -0,0 +1,13 @@
{
"deploy": [
"../deploy.md"
],
"docs": "",
"features": [],
"images": [],
"mcu": "stm32f4",
"product": "GARATRONIC_PYBSTICK26_F411",
"thumbnail": "",
"url": "https://shop.mchobby.be/product.php?id_product=1844",
"vendor": "McHobby"
}

View File

@ -0,0 +1,2 @@
include("$(MPY_DIR)/extmod/uasyncio/manifest.py")
freeze("$(MPY_DIR)/drivers/", ("display/ssd1306.py"))

View File

@ -0,0 +1,84 @@
#define MICROPY_HW_BOARD_NAME "PYBSTICK26_STD"
#define MICROPY_HW_MCU_NAME "STM32F411RE"
#define MICROPY_PY_THREAD (1)
#define MICROPY_HW_HAS_SWITCH (1)
#define MICROPY_HW_HAS_FLASH (1)
#define MICROPY_HW_HAS_KXTJ3 (0)
#define MICROPY_HW_HAS_LCD (0)
#define MICROPY_HW_ENABLE_RTC (1)
#define MICROPY_HW_ENABLE_USB (1)
#define MICROPY_HW_ENABLE_SERVO (1)
#define MICROPY_HW_ENABLE_SDCARD (1)
// HSE is 16MHz
#define MICROPY_HW_CLK_PLLM (16)
#define MICROPY_HW_CLK_PLLN (192)
#define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV2)
#define MICROPY_HW_CLK_PLLQ (4)
#define MICROPY_HW_CLK_LAST_FREQ (1)
// Pybstick26 STD has an optional 32kHz crystal
#define MICROPY_HW_RTC_USE_LSE (1)
#define MICROPY_HW_RTC_USE_US (1)
#define MICROPY_HW_RTC_USE_CALOUT (0)
// UART config
#define MICROPY_HW_UART1_NAME "XB"
#define MICROPY_HW_UART1_TX (pin_A15)
#define MICROPY_HW_UART1_RX (pin_A10)
#define MICROPY_HW_UART2_NAME "XA"
#define MICROPY_HW_UART2_TX (pin_A2)
#define MICROPY_HW_UART2_RX (pin_A3)
//#define MICROPY_HW_UART2_RTS (pin_A1)
//#define MICROPY_HW_UART2_CTS (pin_A0)
#define MICROPY_HW_UART6_NAME "YA"
#define MICROPY_HW_UART6_TX (pin_C6)
#define MICROPY_HW_UART6_RX (pin_C7)
// I2C buses
#define MICROPY_HW_I2C1_NAME "X"
#define MICROPY_HW_I2C1_SCL (pin_B8) // S5
#define MICROPY_HW_I2C1_SDA (pin_B9) // S3
#define MICROPY_HW_I2C2_NAME "Y"
#define MICROPY_HW_I2C2_SCL (pin_B10) //S13
#define MICROPY_HW_I2C2_SDA (pin_B3) // S11
// SPI buses
#define MICROPY_HW_SPI1_NAME "X"
#define MICROPY_HW_SPI1_NSS (pin_A4) // S26
#define MICROPY_HW_SPI1_SCK (pin_A5) // S23
#define MICROPY_HW_SPI1_MISO (pin_B4) // S21
#define MICROPY_HW_SPI1_MOSI (pin_A7) // S19
#define MICROPY_HW_SPI2_NAME "Y"
#define MICROPY_HW_SPI2_NSS (pin_B12) // S15
#define MICROPY_HW_SPI2_SCK (pin_B13) // S16
#define MICROPY_HW_SPI2_MISO (pin_B14) // S18
#define MICROPY_HW_SPI2_MOSI (pin_C3) // S13
// USRSW has no pullup or pulldown, and pressing the switch makes the input go low
#define MICROPY_HW_USRSW_PIN (pin_C13)
#define MICROPY_HW_USRSW_PULL (GPIO_PULLUP)
#define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_FALLING)
#define MICROPY_HW_USRSW_PRESSED (0)
// The board has 4 LEDs
#define MICROPY_HW_LED1 (pin_A13) // red
#define MICROPY_HW_LED2 (pin_A14) // green
#define MICROPY_HW_LED3 (pin_B0) // yellow
#define MICROPY_HW_LED4 (pin_B1) // blue
#define MICROPY_HW_LED3_PWM { TIM3, 3, TIM_CHANNEL_3, GPIO_AF2_TIM3 }
#define MICROPY_HW_LED4_PWM { TIM3, 4, TIM_CHANNEL_4, GPIO_AF2_TIM3 }
#define MICROPY_HW_LED_ON(pin) (mp_hal_pin_high(pin))
#define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_low(pin))
// SD card with custom SDIO pins
#define MICROPY_HW_SDCARD_D0 (pin_B7)
#define MICROPY_HW_SDCARD_D1 (pin_A8)
#define MICROPY_HW_SDCARD_D2 (pin_A9)
#define MICROPY_HW_SDCARD_D3 (pin_B5)
#define MICROPY_HW_SDCARD_CK (pin_B15)
#define MICROPY_HW_SDCARD_CMD (pin_A6)
// USB config
#define MICROPY_HW_USB_FS (1)

View File

@ -0,0 +1,6 @@
MCU_SERIES = f4
CMSIS_MCU = STM32F411xE
AF_FILE = boards/stm32f411_af.csv
LD_FILES = boards/stm32f411.ld boards/common_ifs.ld
TEXT0_ADDR = 0x08000000
TEXT1_ADDR = 0x08020000

View File

@ -0,0 +1,55 @@
S1,3.3V
S2,VBUS
S3,PB9
S4,VIN
S5,PB8
S6,GND
S7,PB6
S8,PA2
S9,GND
S10,PA3
S11,PB3
S12,PA0
S13,PB10
S13A,PC3
S14,Reset
S15,PB12
S15A,PC5
S16,PB13
S16A,PC6
S17,GND
S18,PB14
S18A,PC7
S19,PA7
S20,GND
S21,PB4
S22,PA10
S23,PA5
S24,PA15
S25,GND
S26,PA4
SW,PC13
SW2,PB6
LED_GREEN,PA14
LED_YELLOW,PB0
LED_RED,PA13
LED_BLUE,PB1
SD_D0,PB7
SD_D1,PA8
SD_D2,PA9
SD_D3,PB5
SD_CMD,PA6
SD_CK,PB15
USB_DM,PA11
USB_DP,PA12
OSC_IN,PH0
OSC_OUT,PH1
OSC32_IN,PC14
OSC32_OUT,PC15
QSPI_BK1_IO3,PA1
SDIO_CMD,PA6
SDIO_D1,PA8
SDIO_D2,PA9
SDIO_D3,PB5
SDIO_D0,PB7
SDIO_CK,PB15
1 S1 3.3V
2 S2 VBUS
3 S3 PB9
4 S4 VIN
5 S5 PB8
6 S6 GND
7 S7 PB6
8 S8 PA2
9 S9 GND
10 S10 PA3
11 S11 PB3
12 S12 PA0
13 S13 PB10
14 S13A PC3
15 S14 Reset
16 S15 PB12
17 S15A PC5
18 S16 PB13
19 S16A PC6
20 S17 GND
21 S18 PB14
22 S18A PC7
23 S19 PA7
24 S20 GND
25 S21 PB4
26 S22 PA10
27 S23 PA5
28 S24 PA15
29 S25 GND
30 S26 PA4
31 SW PC13
32 SW2 PB6
33 LED_GREEN PA14
34 LED_YELLOW PB0
35 LED_RED PA13
36 LED_BLUE PB1
37 SD_D0 PB7
38 SD_D1 PA8
39 SD_D2 PA9
40 SD_D3 PB5
41 SD_CMD PA6
42 SD_CK PB15
43 USB_DM PA11
44 USB_DP PA12
45 OSC_IN PH0
46 OSC_OUT PH1
47 OSC32_IN PC14
48 OSC32_OUT PC15
49 QSPI_BK1_IO3 PA1
50 SDIO_CMD PA6
51 SDIO_D1 PA8
52 SDIO_D2 PA9
53 SDIO_D3 PB5
54 SDIO_D0 PB7
55 SDIO_CK PB15

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 (16000000)
#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