summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/stm32/boards/MIKROE_CLICKER2_STM32/mpconfigboard.h85
-rw-r--r--ports/stm32/boards/MIKROE_CLICKER2_STM32/mpconfigboard.mk13
-rw-r--r--ports/stm32/boards/MIKROE_CLICKER2_STM32/pins.csv88
-rw-r--r--ports/stm32/boards/MIKROE_CLICKER2_STM32/stm32f4xx_hal_conf.h19
4 files changed, 205 insertions, 0 deletions
diff --git a/ports/stm32/boards/MIKROE_CLICKER2_STM32/mpconfigboard.h b/ports/stm32/boards/MIKROE_CLICKER2_STM32/mpconfigboard.h
new file mode 100644
index 000000000..eb622cd29
--- /dev/null
+++ b/ports/stm32/boards/MIKROE_CLICKER2_STM32/mpconfigboard.h
@@ -0,0 +1,85 @@
+#define MICROPY_HW_BOARD_NAME "MIKROE_CLICKER2_STM32"
+#define MICROPY_HW_MCU_NAME "STM32F407"
+
+#define MICROPY_HW_HAS_SWITCH (1)
+#define MICROPY_HW_HAS_FLASH (1)
+#define MICROPY_HW_ENABLE_RNG (1)
+#define MICROPY_HW_ENABLE_RTC (1)
+#define MICROPY_HW_ENABLE_DAC (1)
+#define MICROPY_HW_ENABLE_USB (1)
+
+// HSE is 25MHz
+#define MICROPY_HW_CLK_PLLM (25)
+#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 (0) // turn on/off PC13 512Hz output
+
+// UART config
+// mikroBUS slot 1
+#define MICROPY_HW_UART2_NAME "SLOT1"
+#define MICROPY_HW_UART2_TX (pin_D5)
+#define MICROPY_HW_UART2_RX (pin_D6)
+// mikroBUS slot 2
+#define MICROPY_HW_UART3_NAME "SLOT2"
+#define MICROPY_HW_UART3_TX (pin_D8)
+#define MICROPY_HW_UART3_RX (pin_D9)
+// HDR2
+#define MICROPY_HW_UART4_NAME "HDR2"
+#define MICROPY_HW_UART4_TX (pin_A0)
+#define MICROPY_HW_UART4_RX (pin_A1)
+
+// I2C buses
+// mikroBUS slot 2 / HDR2
+#define MICROPY_HW_I2C2_NAME "SLOT2"
+#define MICROPY_HW_I2C2_SCL (pin_B10)
+#define MICROPY_HW_I2C2_SDA (pin_B11)
+// mikroBUS slot 1
+#define MICROPY_HW_I2C3_NAME "SLOT1"
+#define MICROPY_HW_I2C3_SCL (pin_A8)
+#define MICROPY_HW_I2C3_SDA (pin_C9)
+
+// SPI buses
+// mikroBUS slot 2 / HDR1
+#define MICROPY_HW_SPI2_NAME "SLOT2"
+#define MICROPY_HW_SPI2_NSS (pin_E11)
+#define MICROPY_HW_SPI2_SCK (pin_B13)
+#define MICROPY_HW_SPI2_MISO (pin_B14)
+#define MICROPY_HW_SPI2_MOSI (pin_B15)
+// mikroBUS slot 1
+#define MICROPY_HW_SPI3_NAME "SLOT1"
+#define MICROPY_HW_SPI3_NSS (pin_E8)
+#define MICROPY_HW_SPI3_SCK (pin_C10)
+#define MICROPY_HW_SPI3_MISO (pin_C11)
+#define MICROPY_HW_SPI3_MOSI (pin_C12)
+
+// USRSW is pulled high; pressing the button makes the input go low
+#define MICROPY_HW_USRSW_PIN (pin_E0)
+#define MICROPY_HW_USRSW_PULL (GPIO_NOPULL)
+#define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_FALLING)
+#define MICROPY_HW_USRSW_PRESSED (0)
+
+// LEDs
+#define MICROPY_HW_LED1 (pin_E12) // red
+#define MICROPY_HW_LED2 (pin_E15) // red
+#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_VBUS_DETECT_PIN (pin_A9)
+
+// Bootloader configuration (only needed if Mboot is used)
+#define MBOOT_I2C_PERIPH_ID 2
+#define MBOOT_I2C_SCL (pin_B10)
+#define MBOOT_I2C_SDA (pin_B11)
+#define MBOOT_I2C_ALTFUNC (4)
+#define MBOOT_BOOTPIN_PIN (pin_A10)
+#define MBOOT_BOOTPIN_PULL (MP_HAL_PIN_PULL_NONE)
+#define MBOOT_BOOTPIN_ACTIVE (0)
+#define MBOOT_FSLOAD (1)
diff --git a/ports/stm32/boards/MIKROE_CLICKER2_STM32/mpconfigboard.mk b/ports/stm32/boards/MIKROE_CLICKER2_STM32/mpconfigboard.mk
new file mode 100644
index 000000000..aa52f2116
--- /dev/null
+++ b/ports/stm32/boards/MIKROE_CLICKER2_STM32/mpconfigboard.mk
@@ -0,0 +1,13 @@
+MCU_SERIES = f4
+CMSIS_MCU = STM32F407xx
+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
diff --git a/ports/stm32/boards/MIKROE_CLICKER2_STM32/pins.csv b/ports/stm32/boards/MIKROE_CLICKER2_STM32/pins.csv
new file mode 100644
index 000000000..09e1ccfb4
--- /dev/null
+++ b/ports/stm32/boards/MIKROE_CLICKER2_STM32/pins.csv
@@ -0,0 +1,88 @@
+MB1_AN,PA2
+MB1_RST,PE7
+MB1_CS,PE8
+MB1_SCK,PC10
+MB1_MISO,PC11
+MB1_MOSI,PC12
+MB1_PWM,PE9
+MB1_INT,PE10
+MB1_RX,PD6
+MB1_TX,PD5
+MB1_SCL,PA8
+MB1_SDA,PC9
+MB2_AN,PA3
+MB2_RST,PE13
+MB2_CS,PE11
+MB2_SCK,PB13
+MB2_MISO,PB14
+MB2_MOSI,PB15
+MB2_PWM,PD12
+MB2_INT,PE14
+MB2_RX,PD9
+MB2_TX,PD8
+MB2_SCL,PB10
+MB2_SDA,PB11
+PIN1,VSYS
+PIN2,GND
+PIN3,PC0
+PIN4,PC1
+PIN5,PC2
+PIN6,PC3
+PIN7,PB1
+PIN8,PA4
+PIN9,PC4
+PIN10,PD3
+PIN11,PD1
+PIN12,PD2
+PIN13,PD0
+PIN14,PC8
+PIN15,PD15
+PIN16,PD14
+PIN17,PD13
+PIN18,PB7
+PIN19,PC7
+PIN20,PD11
+PIN21,PD10
+PIN22,PB13
+PIN23,PB14
+PIN24,PB15
+PIN25,3.3V
+PIN26,GND
+PIN27,RST
+PIN28,GND
+PIN30,NC
+PIN31,PB9
+PIN32,PB8
+PIN33,PE5
+PIN34,PB0
+PIN35,PA5
+PIN36,PA6
+PIN37,PA7
+PIN38,PE1
+PIN39,PE2
+PIN40,PE3
+PIN41,PE4
+PIN42,PE6
+PIN43,PB6
+PIN44,PB5
+PIN45,PD7
+PIN46,PC13
+PIN47,PA1
+PIN48,PA0
+PIN49,PB10
+PIN50,PB11
+PIN51,3.3V
+PIN52,GND
+OSC32_OUT,PC15
+OSC32_IN,PC14
+VSENSE,PC5
+SENSEL,PB12
+FAULT,PC6
+BATSTAT,PD4
+LD1,PE12
+LD2,PE15
+T2,PE0
+T3,PA10
+USB_VBUS,PA9
+USB_DM,PA11
+USB_DP,PA12 \ No newline at end of file
diff --git a/ports/stm32/boards/MIKROE_CLICKER2_STM32/stm32f4xx_hal_conf.h b/ports/stm32/boards/MIKROE_CLICKER2_STM32/stm32f4xx_hal_conf.h
new file mode 100644
index 000000000..f186d5a29
--- /dev/null
+++ b/ports/stm32/boards/MIKROE_CLICKER2_STM32/stm32f4xx_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_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 (25000000)
+#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