From 7c2e83324b1abfbec2bfaee2c60b50ceb3f9185a Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 5 Jul 2019 17:28:54 +1000 Subject: [PATCH] stm32/boards/NUCLEO_L073RZ: Add definition files for new board. --- .../boards/NUCLEO_L073RZ/mpconfigboard.h | 53 +++++++++++ .../boards/NUCLEO_L073RZ/mpconfigboard.mk | 7 ++ ports/stm32/boards/NUCLEO_L073RZ/pins.csv | 87 +++++++++++++++++++ .../boards/NUCLEO_L073RZ/stm32l0xx_hal_conf.h | 18 ++++ 4 files changed, 165 insertions(+) create mode 100644 ports/stm32/boards/NUCLEO_L073RZ/mpconfigboard.h create mode 100644 ports/stm32/boards/NUCLEO_L073RZ/mpconfigboard.mk create mode 100644 ports/stm32/boards/NUCLEO_L073RZ/pins.csv create mode 100644 ports/stm32/boards/NUCLEO_L073RZ/stm32l0xx_hal_conf.h diff --git a/ports/stm32/boards/NUCLEO_L073RZ/mpconfigboard.h b/ports/stm32/boards/NUCLEO_L073RZ/mpconfigboard.h new file mode 100644 index 0000000000..ff4be4a277 --- /dev/null +++ b/ports/stm32/boards/NUCLEO_L073RZ/mpconfigboard.h @@ -0,0 +1,53 @@ +/* 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-L073RZ" +#define MICROPY_HW_MCU_NAME "STM32F073RZT6" + +#define MICROPY_EMIT_THUMB (0) +#define MICROPY_EMIT_INLINE_THUMB (0) +#define MICROPY_PY_BUILTINS_COMPLEX (0) +#define MICROPY_PY_MATH (0) +#define MICROPY_PY_FRAMEBUF (0) +#define MICROPY_PY_USOCKET (0) +#define MICROPY_PY_NETWORK (0) +#define MICROPY_PY_STM (0) +#define MICROPY_PY_PYB_LEGACY (0) +#define MICROPY_VFS_FAT (0) + +#define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (0) +#define MICROPY_HW_ENABLE_RTC (1) +#define MICROPY_HW_ENABLE_ADC (0) +#define MICROPY_HW_HAS_SWITCH (1) + +// UART config +#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) + +// USART2 is connected to the ST-LINK USB VCP +#define MICROPY_HW_UART_REPL PYB_UART_2 +#define MICROPY_HW_UART_REPL_BAUD 115200 + +// I2C busses +#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 + +// SPI busses +#define MICROPY_HW_SPI1_NSS (pin_A15) // pin 17 on CN7 +#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 + +// USER B1 has a pull-up and is active low +#define MICROPY_HW_USRSW_PIN (pin_C13) +#define MICROPY_HW_USRSW_PULL (0) +#define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_FALLING) +#define MICROPY_HW_USRSW_PRESSED (0) + +// NUCLEO-64 has one user LED +#define MICROPY_HW_LED1 (pin_A5) // green +#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_L073RZ/mpconfigboard.mk b/ports/stm32/boards/NUCLEO_L073RZ/mpconfigboard.mk new file mode 100644 index 0000000000..69601f8602 --- /dev/null +++ b/ports/stm32/boards/NUCLEO_L073RZ/mpconfigboard.mk @@ -0,0 +1,7 @@ +MCU_SERIES = l0 +CMSIS_MCU = STM32L073xx +AF_FILE = boards/stm32l072_af.csv +LD_FILES = boards/stm32l072xz.ld boards/common_basic.ld + +# Don't include default frozen modules because MCU is tight on flash space +FROZEN_MPY_DIR ?= diff --git a/ports/stm32/boards/NUCLEO_L073RZ/pins.csv b/ports/stm32/boards/NUCLEO_L073RZ/pins.csv new file mode 100644 index 0000000000..36d3141083 --- /dev/null +++ b/ports/stm32/boards/NUCLEO_L073RZ/pins.csv @@ -0,0 +1,87 @@ +D0,PA3 +D1,PA2 +D2,PA10 +D3,PB3 +D4,PB5 +D5,PB4 +D6,PB10 +D7,PA8 +D8,PA9 +D9,PC7 +D10,PB6 +D11,PA7 +D12,PA6 +D13,PA5 +D14,PB9 +D15,PB8 +A0,PA0 +A1,PA1 +A2,PA4 +A3,PB0 +A4,PC1 +A5,PC0 +RX,PA3 +TX,PA2 +SCL,PB8 +SDA,PB9 +SCK,PA5 +MISO,PA6 +MOSI,PA7 +CS,PB6 +BOOT0,PF11 +SWDIO,PA13 +SWCLK,PA14 +USER_B1,PC13 +LED_GREEN,PA5 +PA0,PA0 +PA1,PA1 +PA2,PA2 +PA3,PA3 +PA4,PA4 +PA5,PA5 +PA6,PA6 +PA7,PA7 +PA8,PA8 +PA9,PA9 +PA10,PA10 +PA11,PA11 +PA12,PA12 +PA13,PA13 +PA14,PA14 +PA15,PA15 +PB0,PB0 +PB1,PB1 +PB2,PB2 +PB3,PB3 +PB4,PB4 +PB5,PB5 +PB6,PB6 +PB7,PB7 +PB8,PB8 +PB9,PB9 +PB10,PB10 +PB11,PB11 +PB12,PB12 +PB13,PB13 +PB14,PB14 +PB15,PB15 +PC0,PC0 +PC1,PC1 +PC2,PC2 +PC3,PC3 +PC4,PC4 +PC5,PC5 +PC6,PC6 +PC7,PC7 +PC8,PC8 +PC9,PC9 +PC10,PC10 +PC11,PC11 +PC12,PC12 +PC13,PC13 +PC14,PC14 +PC15,PC15 +PD2,PD2 +PF0,PF0 +PF1,PF1 +PF11,PF11 diff --git a/ports/stm32/boards/NUCLEO_L073RZ/stm32l0xx_hal_conf.h b/ports/stm32/boards/NUCLEO_L073RZ/stm32l0xx_hal_conf.h new file mode 100644 index 0000000000..c88a706510 --- /dev/null +++ b/ports/stm32/boards/NUCLEO_L073RZ/stm32l0xx_hal_conf.h @@ -0,0 +1,18 @@ +/* This file is part of the MicroPython project, http://micropython.org/ + * The MIT License (MIT) + * Copyright (c) 2019 Damien P. George + */ +#ifndef MICROPY_INCLUDED_STM32L0XX_HAL_CONF_H +#define MICROPY_INCLUDED_STM32L0XX_HAL_CONF_H + +#include "boards/stm32l0xx_hal_conf_base.h" + +// Oscillator values in Hz +#define HSE_VALUE (8000000) +#define LSE_VALUE (32768) + +// Oscillator timeouts in ms +#define HSE_STARTUP_TIMEOUT (100) +#define LSE_STARTUP_TIMEOUT (5000) + +#endif // MICROPY_INCLUDED_STM32L0XX_HAL_CONF_H