Browse Source

stm32/boards/MIKROE_CLICKER2_STM32: Add MikroElektronika Clicker2 board.

- STM32F407VGT6 (1MB of Flash, 192+4 Kbytes of SRAM)
- 5V (via USB) or Li-Polymer Battery (3.7V) power input
- 2 x LEDs
- 2 x user switches
- 2 x mikroBUS sockets
- 2 x 1x26 mikromedia-compatible headers (52 pins)

https://www.mikroe.com/clicker-2-stm32f4
pull/5088/head
Christopher Wilson 5 years ago
committed by Damien George
parent
commit
f9d142523c
  1. 85
      ports/stm32/boards/MIKROE_CLICKER2_STM32/mpconfigboard.h
  2. 13
      ports/stm32/boards/MIKROE_CLICKER2_STM32/mpconfigboard.mk
  3. 88
      ports/stm32/boards/MIKROE_CLICKER2_STM32/pins.csv
  4. 19
      ports/stm32/boards/MIKROE_CLICKER2_STM32/stm32f4xx_hal_conf.h

85
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)

13
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

88
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
1 MB1_AN PA2
2 MB1_RST PE7
3 MB1_CS PE8
4 MB1_SCK PC10
5 MB1_MISO PC11
6 MB1_MOSI PC12
7 MB1_PWM PE9
8 MB1_INT PE10
9 MB1_RX PD6
10 MB1_TX PD5
11 MB1_SCL PA8
12 MB1_SDA PC9
13 MB2_AN PA3
14 MB2_RST PE13
15 MB2_CS PE11
16 MB2_SCK PB13
17 MB2_MISO PB14
18 MB2_MOSI PB15
19 MB2_PWM PD12
20 MB2_INT PE14
21 MB2_RX PD9
22 MB2_TX PD8
23 MB2_SCL PB10
24 MB2_SDA PB11
25 PIN1 VSYS
26 PIN2 GND
27 PIN3 PC0
28 PIN4 PC1
29 PIN5 PC2
30 PIN6 PC3
31 PIN7 PB1
32 PIN8 PA4
33 PIN9 PC4
34 PIN10 PD3
35 PIN11 PD1
36 PIN12 PD2
37 PIN13 PD0
38 PIN14 PC8
39 PIN15 PD15
40 PIN16 PD14
41 PIN17 PD13
42 PIN18 PB7
43 PIN19 PC7
44 PIN20 PD11
45 PIN21 PD10
46 PIN22 PB13
47 PIN23 PB14
48 PIN24 PB15
49 PIN25 3.3V
50 PIN26 GND
51 PIN27 RST
52 PIN28 GND
53 PIN30 NC
54 PIN31 PB9
55 PIN32 PB8
56 PIN33 PE5
57 PIN34 PB0
58 PIN35 PA5
59 PIN36 PA6
60 PIN37 PA7
61 PIN38 PE1
62 PIN39 PE2
63 PIN40 PE3
64 PIN41 PE4
65 PIN42 PE6
66 PIN43 PB6
67 PIN44 PB5
68 PIN45 PD7
69 PIN46 PC13
70 PIN47 PA1
71 PIN48 PA0
72 PIN49 PB10
73 PIN50 PB11
74 PIN51 3.3V
75 PIN52 GND
76 OSC32_OUT PC15
77 OSC32_IN PC14
78 VSENSE PC5
79 SENSEL PB12
80 FAULT PC6
81 BATSTAT PD4
82 LD1 PE12
83 LD2 PE15
84 T2 PE0
85 T3 PA10
86 USB_VBUS PA9
87 USB_DM PA11
88 USB_DP PA12

19
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
Loading…
Cancel
Save