From d2a8fb747fbe2ac67cd266f6bc0fcccd9a5874e6 Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 17 Jul 2019 16:50:59 +1000 Subject: [PATCH] stm32/boards/NUCLEO_WB55: Add definition files for new board. --- .../stm32/boards/NUCLEO_WB55/mpconfigboard.h | 64 +++++++++++++++++++ .../stm32/boards/NUCLEO_WB55/mpconfigboard.mk | 5 ++ ports/stm32/boards/NUCLEO_WB55/pins.csv | 34 ++++++++++ .../boards/NUCLEO_WB55/stm32wbxx_hal_conf.h | 19 ++++++ 4 files changed, 122 insertions(+) create mode 100644 ports/stm32/boards/NUCLEO_WB55/mpconfigboard.h create mode 100644 ports/stm32/boards/NUCLEO_WB55/mpconfigboard.mk create mode 100644 ports/stm32/boards/NUCLEO_WB55/pins.csv create mode 100644 ports/stm32/boards/NUCLEO_WB55/stm32wbxx_hal_conf.h diff --git a/ports/stm32/boards/NUCLEO_WB55/mpconfigboard.h b/ports/stm32/boards/NUCLEO_WB55/mpconfigboard.h new file mode 100644 index 0000000000..fc047880d1 --- /dev/null +++ b/ports/stm32/boards/NUCLEO_WB55/mpconfigboard.h @@ -0,0 +1,64 @@ +/* This file is part of the MicroPython project, http://micropython.org/ + * MIT License; Copyright (c) 2019 Damien P. George + */ + +#define MICROPY_HW_BOARD_NAME "NUCLEO-WB55" +#define MICROPY_HW_MCU_NAME "STM32WB55RGV6" + +#define MICROPY_PY_PYB_LEGACY (0) + +#define MICROPY_HW_ENABLE_RTC (1) +#define MICROPY_HW_ENABLE_RNG (1) +#define MICROPY_HW_ENABLE_ADC (0) +#define MICROPY_HW_ENABLE_USB (1) +#define MICROPY_HW_HAS_SWITCH (1) + +// There is an external 32kHz oscillator +#define RTC_ASYNCH_PREDIV (0) +#define RTC_SYNCH_PREDIV (0x7fff) +#define MICROPY_HW_RTC_USE_LSE (1) +#define MICROPY_HW_RTC_USE_US (1) + +// UART buses +#define MICROPY_HW_UART1_TX (pin_B6) +#define MICROPY_HW_UART1_RX (pin_B7) +// USART 1 is connected to the virtual com port on the ST-LINK +#define MICROPY_HW_UART_REPL PYB_UART_1 +#define MICROPY_HW_UART_REPL_BAUD 115200 + +// I2C buses +#define MICROPY_HW_I2C1_SCL (pin_B8) // Arduino D15, pin 3 on CN10 +#define MICROPY_HW_I2C1_SDA (pin_B9) // Arduino D14, pin 5 on CN10 +#define MICROPY_HW_I2C3_SCL (pin_C0) // Arduino A0, pin 28 on CN7 +#define MICROPY_HW_I2C3_SDA (pin_C1) // Arduino A1, pin 30 on CN7 + +// SPI buses +#if 0 // TODO need working DMA +#define MICROPY_HW_SPI1_NSS (pin_A4) // Arduino D10 pin 17 on CN10 +#define MICROPY_HW_SPI1_SCK (pin_A5) // Arduino D13, pin 11 on CN10 +#define MICROPY_HW_SPI1_MISO (pin_A6) // Arduino D12, pin 13 on CN10 +#define MICROPY_HW_SPI1_MOSI (pin_A7) // Arduino D11, pin 15 on CN10 +#define MICROPY_HW_SPI2_NSS (pin_B12) // pin 16 on CN10 +#define MICROPY_HW_SPI2_SCK (pin_B13) // pin 30 on CN10 +#define MICROPY_HW_SPI2_MISO (pin_B14) // pin 28 on CN10 +#define MICROPY_HW_SPI2_MOSI (pin_B15) // pin 26 on CN10 +#endif + +// User switch; pressing the button makes the input go low +#define MICROPY_HW_USRSW_PIN (pin_C4) +#define MICROPY_HW_USRSW_PULL (GPIO_PULLUP) +#define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_FALLING) +#define MICROPY_HW_USRSW_PRESSED (0) + +// LEDs +#define MICROPY_HW_LED1 (pin_B1) // red +#define MICROPY_HW_LED2 (pin_B0) // green +#define MICROPY_HW_LED3 (pin_B5) // blue +#define MICROPY_HW_LED_ON(pin) (mp_hal_pin_high(pin)) +#define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_low(pin)) + +// USB config +#define MICROPY_HW_USB_FS (1) +#define MICROPY_HW_USB_HID (0) +#define USBD_CDC_RX_DATA_SIZE (512) +#define USBD_CDC_TX_DATA_SIZE (512) diff --git a/ports/stm32/boards/NUCLEO_WB55/mpconfigboard.mk b/ports/stm32/boards/NUCLEO_WB55/mpconfigboard.mk new file mode 100644 index 0000000000..b0f93c006f --- /dev/null +++ b/ports/stm32/boards/NUCLEO_WB55/mpconfigboard.mk @@ -0,0 +1,5 @@ +MCU_SERIES = wb +CMSIS_MCU = STM32WB55xx +AF_FILE = boards/stm32wb55_af.csv +LD_FILES = boards/stm32wb55xg.ld boards/common_basic.ld +STARTUP_FILE = lib/stm32lib/CMSIS/STM32WBxx/Source/Templates/gcc/startup_stm32wb55xx_cm4.o diff --git a/ports/stm32/boards/NUCLEO_WB55/pins.csv b/ports/stm32/boards/NUCLEO_WB55/pins.csv new file mode 100644 index 0000000000..49fdab0c28 --- /dev/null +++ b/ports/stm32/boards/NUCLEO_WB55/pins.csv @@ -0,0 +1,34 @@ +,PA0 +,PA1 +,PA2 +,PA3 +,PA4 +,PA5 +,PA6 +,PA7 +,PB0 +,PB1 +,PB2 +,PB3 +,PB4 +,PB5 +,PB6 +,PB7 +,PB8 +,PB9 +,PB10 +,PB11 +,PB12 +,PB13 +,PB14 +,PB15 +,PC0 +,PC1 +,PC2 +,PC3 +SW,PC4 +LED_GREEN,PB0 +LED_RED,PB1 +LED_BLUE,PB5 +USB_DM,PA11 +USB_DP,PA12 diff --git a/ports/stm32/boards/NUCLEO_WB55/stm32wbxx_hal_conf.h b/ports/stm32/boards/NUCLEO_WB55/stm32wbxx_hal_conf.h new file mode 100644 index 0000000000..176857220e --- /dev/null +++ b/ports/stm32/boards/NUCLEO_WB55/stm32wbxx_hal_conf.h @@ -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_STM32WBXX_HAL_CONF_H +#define MICROPY_INCLUDED_STM32WBXX_HAL_CONF_H + +// Oscillator values in Hz +#define HSE_VALUE (32000000) +#define LSE_VALUE (32768) +#define EXTERNAL_SAI1_CLOCK_VALUE (48000) + +// Oscillator timeouts in ms +#define HSE_STARTUP_TIMEOUT (100) +#define LSE_STARTUP_TIMEOUT (5000) + +#include "boards/stm32wbxx_hal_conf_base.h" + +#endif // MICROPY_INCLUDED_STM32WBXX_HAL_CONF_H