stm32/boards: Add NADHAT_PYB405 board.
This commit is contained in:
parent
28062b5108
commit
925f244ab3
105
ports/stm32/boards/NADHAT_PYBF405/mpconfigboard.h
Normal file
105
ports/stm32/boards/NADHAT_PYBF405/mpconfigboard.h
Normal file
@ -0,0 +1,105 @@
|
||||
#define MICROPY_HW_BOARD_NAME "NADHAT_PYBF405"
|
||||
#define MICROPY_HW_MCU_NAME "STM32F405RG"
|
||||
|
||||
#define MICROPY_HW_HAS_SWITCH (1)
|
||||
#define MICROPY_HW_HAS_FLASH (1)
|
||||
#define MICROPY_HW_HAS_KXTJ3 (1)
|
||||
#define MICROPY_HW_HAS_LCD (1)
|
||||
#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 16MHz
|
||||
#define MICROPY_HW_CLK_PLLM (16)
|
||||
#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 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)
|
||||
|
||||
// UART config
|
||||
#define MICROPY_HW_UART1_NAME "XB"
|
||||
#define MICROPY_HW_UART1_TX (pin_B6)
|
||||
#define MICROPY_HW_UART1_RX (pin_B7)
|
||||
#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_UART3_NAME "YB"
|
||||
#define MICROPY_HW_UART3_TX (pin_B10)
|
||||
#define MICROPY_HW_UART3_RX (pin_B11)
|
||||
#define MICROPY_HW_UART3_RTS (pin_B14)
|
||||
#define MICROPY_HW_UART3_CTS (pin_B13)
|
||||
#define MICROPY_HW_UART4_NAME "XA"
|
||||
#define MICROPY_HW_UART4_TX (pin_A0)
|
||||
#define MICROPY_HW_UART4_RX (pin_A1)
|
||||
#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_B6)
|
||||
#define MICROPY_HW_I2C1_SDA (pin_B7)
|
||||
#define MICROPY_HW_I2C2_NAME "Y"
|
||||
#define MICROPY_HW_I2C2_SCL (pin_B10)
|
||||
#define MICROPY_HW_I2C2_SDA (pin_B11)
|
||||
|
||||
// SPI buses
|
||||
#define MICROPY_HW_SPI1_NAME "X"
|
||||
#define MICROPY_HW_SPI1_NSS (pin_A4) // X5
|
||||
#define MICROPY_HW_SPI1_SCK (pin_A5) // X6
|
||||
#define MICROPY_HW_SPI1_MISO (pin_A6) // X7
|
||||
#define MICROPY_HW_SPI1_MOSI (pin_A7) // X8
|
||||
#define MICROPY_HW_SPI2_NAME "Y"
|
||||
#define MICROPY_HW_SPI2_NSS (pin_B12) // Y5
|
||||
#define MICROPY_HW_SPI2_SCK (pin_B13) // Y6
|
||||
#define MICROPY_HW_SPI2_MISO (pin_B14) // Y7
|
||||
#define MICROPY_HW_SPI2_MOSI (pin_B15) // Y8
|
||||
|
||||
// CAN buses
|
||||
#define MICROPY_HW_CAN1_NAME "YA"
|
||||
#define MICROPY_HW_CAN1_TX (pin_B9) // Y4
|
||||
#define MICROPY_HW_CAN1_RX (pin_B8) // Y3
|
||||
#define MICROPY_HW_CAN2_NAME "YB"
|
||||
#define MICROPY_HW_CAN2_TX (pin_B13) // Y6
|
||||
#define MICROPY_HW_CAN2_RX (pin_B12) // Y5
|
||||
|
||||
// USRSW has no pullup or pulldown, and pressing the switch makes the input go low
|
||||
#define MICROPY_HW_USRSW_PIN (pin_B3)
|
||||
#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_A15) // yellow
|
||||
#define MICROPY_HW_LED4 (pin_B4) // blue
|
||||
#define MICROPY_HW_LED3_PWM { TIM2, 2, TIM_CHANNEL_1, GPIO_AF1_TIM2 }
|
||||
#define MICROPY_HW_LED4_PWM { TIM3, 3, TIM_CHANNEL_1, 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 detect switch
|
||||
#define MICROPY_HW_SDCARD_DETECT_PIN (pin_A8)
|
||||
#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)
|
13
ports/stm32/boards/NADHAT_PYBF405/mpconfigboard.mk
Normal file
13
ports/stm32/boards/NADHAT_PYBF405/mpconfigboard.mk
Normal 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
|
58
ports/stm32/boards/NADHAT_PYBF405/pins.csv
Normal file
58
ports/stm32/boards/NADHAT_PYBF405/pins.csv
Normal file
@ -0,0 +1,58 @@
|
||||
X1,PA0
|
||||
X2,PA1
|
||||
X3,PA2
|
||||
X4,PA3
|
||||
X5,PA4
|
||||
X6,PA5
|
||||
X7,PA6
|
||||
X8,PA7
|
||||
X9,PB6
|
||||
X10,PB7
|
||||
X11,PC4
|
||||
X12,PC5
|
||||
X13,Reset
|
||||
X14,GND
|
||||
X15,3.3V
|
||||
X16,VIN
|
||||
X17,PB3
|
||||
X18,PC13
|
||||
X19,PC0
|
||||
X20,PC1
|
||||
X21,PC2
|
||||
X22,PC3
|
||||
X23,A3.3V
|
||||
X24,AGND
|
||||
Y1,PC6
|
||||
Y2,PC7
|
||||
Y3,PB8
|
||||
Y4,PB9
|
||||
Y5,PB12
|
||||
Y6,PB13
|
||||
Y7,PB14
|
||||
Y8,PB15
|
||||
Y9,PB10
|
||||
Y10,PB11
|
||||
Y11,PB0
|
||||
Y12,PB1
|
||||
Y13,PB2
|
||||
Y14,GND
|
||||
Y15,3.3V
|
||||
Y16,VIN
|
||||
SW,PB3
|
||||
LED_RED,PA13
|
||||
LED_GREEN,PA14
|
||||
LED_YELLOW,PA15
|
||||
LED_BLUE,PB4
|
||||
NC,PB5
|
||||
SD_D0,PC8
|
||||
SD_D1,PC9
|
||||
SD_D2,PC10
|
||||
SD_D3,PC11
|
||||
SD_CMD,PD2
|
||||
SD_CK,PC12
|
||||
SD,PA8
|
||||
SD_SW,PA8
|
||||
USB_VBUS,PA9
|
||||
USB_ID,PA10
|
||||
USB_DM,PA11
|
||||
USB_DP,PA12
|
|
19
ports/stm32/boards/NADHAT_PYBF405/stm32f4xx_hal_conf.h
Normal file
19
ports/stm32/boards/NADHAT_PYBF405/stm32f4xx_hal_conf.h
Normal 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
|
Loading…
Reference in New Issue
Block a user