diff --git a/ports/stm32/boards/NUCLEO_WL55/board.json b/ports/stm32/boards/NUCLEO_WL55/board.json new file mode 100644 index 0000000000..d756a4cdbb --- /dev/null +++ b/ports/stm32/boards/NUCLEO_WL55/board.json @@ -0,0 +1,15 @@ +{ + "deploy": [ + "../deploy.md" + ], + "docs": "", + "features": [], + "images": [ + "nucleo_wl55.jpg" + ], + "mcu": "stm32wl", + "product": "Nucleo WL55", + "thumbnail": "", + "url": "", + "vendor": "ST Microelectronics" +} diff --git a/ports/stm32/boards/NUCLEO_WL55/mpconfigboard.h b/ports/stm32/boards/NUCLEO_WL55/mpconfigboard.h new file mode 100644 index 0000000000..baf1f023be --- /dev/null +++ b/ports/stm32/boards/NUCLEO_WL55/mpconfigboard.h @@ -0,0 +1,63 @@ +/* This file is part of the MicroPython project, https://micropython.org/ + * MIT License; Copyright (c) 2021 Damien P. George + */ + +#define MICROPY_HW_BOARD_NAME "NUCLEO-WL55" +#define MICROPY_HW_MCU_NAME "STM32WL55JCI7" + +#define MICROPY_EMIT_THUMB (0) +#define MICROPY_EMIT_INLINE_THUMB (0) +#define MICROPY_PY_BUILTINS_COMPLEX (0) +#define MICROPY_PY_GENERATOR_PEND_THROW (0) +#define MICROPY_PY_MATH (0) +#define MICROPY_PY_FRAMEBUF (0) +#define MICROPY_PY_USOCKET (0) +#define MICROPY_PY_NETWORK (0) +#define MICROPY_PY_ONEWIRE (0) +#define MICROPY_PY_STM (0) +#define MICROPY_PY_PYB_LEGACY (0) +#define MICROPY_PY_UHEAPQ (0) +#define MICROPY_PY_UTIMEQ (0) + +#define MICROPY_HW_HAS_FLASH (1) +#define MICROPY_HW_ENABLE_RTC (1) +#define MICROPY_HW_ENABLE_RNG (1) +#define MICROPY_HW_ENABLE_ADC (0) // use machine.ADC instead +#define MICROPY_HW_HAS_SWITCH (1) + +// There is an external 32kHz oscillator +#define MICROPY_HW_RTC_USE_LSE (1) +#define MICROPY_HW_RTC_USE_US (1) + +// UART buses +#define MICROPY_HW_UART1_TX (pin_B6) // Arduino D1, pin 7 on CN9 +#define MICROPY_HW_UART1_RX (pin_B7) // Arduino D0, pin 8 on CN9 +#define MICROPY_HW_LPUART1_TX (pin_A2) // ST-link +#define MICROPY_HW_LPUART1_RX (pin_A3) // ST-link +#define MICROPY_HW_UART_REPL PYB_LPUART_1 +#define MICROPY_HW_UART_REPL_BAUD 115200 + +// I2C buses +#define MICROPY_HW_I2C1_SCL (pin_A12) // Arduino D15, pin 10 on CN5 +#define MICROPY_HW_I2C1_SDA (pin_A11) // Arduino D14, pin 9 on CN5 +#define MICROPY_HW_I2C3_SCL (pin_B13) // Arduino A5, pin 6 on CN8 +#define MICROPY_HW_I2C3_SDA (pin_B14) // Arduino A4, pin 5 on CN8 + +// SPI buses +#define MICROPY_HW_SPI1_NSS (pin_A4) // Arduino D10 pin 3 on CN5 +#define MICROPY_HW_SPI1_SCK (pin_A5) // Arduino D13, pin 6 on CN5 +#define MICROPY_HW_SPI1_MISO (pin_A6) // Arduino D12, pin 5 on CN5 +#define MICROPY_HW_SPI1_MOSI (pin_A7) // Arduino D11, pin 4 on CN5 + +// User switch; pressing the button makes the input go low +#define MICROPY_HW_USRSW_PIN (pin_A0) +#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_B15) // blue +#define MICROPY_HW_LED2 (pin_B9) // green +#define MICROPY_HW_LED3 (pin_B11) // red +#define MICROPY_HW_LED_ON(pin) (mp_hal_pin_high(pin)) +#define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_low(pin)) diff --git a/ports/stm32/boards/NUCLEO_WL55/mpconfigboard.mk b/ports/stm32/boards/NUCLEO_WL55/mpconfigboard.mk new file mode 100644 index 0000000000..210f3058c1 --- /dev/null +++ b/ports/stm32/boards/NUCLEO_WL55/mpconfigboard.mk @@ -0,0 +1,13 @@ +MCU_SERIES = wl +CMSIS_MCU = STM32WL55xx +AF_FILE = boards/stm32wl55_af.csv +STARTUP_FILE = $(STM32LIB_CMSIS_BASE)/Source/Templates/gcc/startup_stm32wl55xx_cm4.o +LD_FILES = boards/stm32wl55xc.ld boards/common_basic.ld +TEXT0_ADDR = 0x08000000 + +# MicroPython settings +MICROPY_VFS_FAT = 0 +MICROPY_VFS_LFS2 = 1 + +# Don't include default frozen modules because MCU is tight on flash space +FROZEN_MANIFEST ?= diff --git a/ports/stm32/boards/NUCLEO_WL55/pins.csv b/ports/stm32/boards/NUCLEO_WL55/pins.csv new file mode 100644 index 0000000000..afcf34df11 --- /dev/null +++ b/ports/stm32/boards/NUCLEO_WL55/pins.csv @@ -0,0 +1,46 @@ +,PA0 +,PA1 +,PA2 +,PA3 +,PA4 +,PA5 +,PA6 +,PA7 +,PA8 +,PA9 +,PA10 +,PA11 +,PA12 +,PA13 +,PA14 +,PA15 +,PB0 +,PB1 +,PB2 +,PB3 +,PB4 +,PB5 +,PB6 +,PB7 +,PB8 +,PB9 +,PB10 +,PB11 +,PB12 +,PB13 +,PB14 +,PB15 +,PC0 +,PC1 +,PC2 +,PC3 +,PC4 +,PC5 +,PC6 +SW,PA0 +SW1,PA0 +SW2,PA1 +SW3,PC6 +LED_GREEN,PB9 +LED_RED,PB11 +LED_BLUE,PB15 diff --git a/ports/stm32/boards/NUCLEO_WL55/stm32wlxx_hal_conf.h b/ports/stm32/boards/NUCLEO_WL55/stm32wlxx_hal_conf.h new file mode 100644 index 0000000000..2c28cc3d2a --- /dev/null +++ b/ports/stm32/boards/NUCLEO_WL55/stm32wlxx_hal_conf.h @@ -0,0 +1,18 @@ +/* This file is part of the MicroPython project, https://micropython.org/ + * The MIT License (MIT) + * Copyright (c) 2021 Damien P. George + */ +#ifndef MICROPY_INCLUDED_STM32WLXX_HAL_CONF_H +#define MICROPY_INCLUDED_STM32WLXX_HAL_CONF_H + +// Oscillator values in Hz +#define HSE_VALUE (32000000) +#define LSE_VALUE (32768) + +// Oscillator timeouts in ms +#define HSE_STARTUP_TIMEOUT (100) +#define LSE_STARTUP_TIMEOUT (5000) + +#include "boards/stm32wlxx_hal_conf_base.h" + +#endif // MICROPY_INCLUDED_STM32WLXX_HAL_CONF_H