├── LICENSE ├── board_init.c ├── mpconfigboard.mk ├── stm32f4xx_hal_conf.h ├── bdev.c ├── pins.csv ├── README-zh.md ├── README.md └── mpconfigboard.h /LICENSE: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /board_init.c: -------------------------------------------------------------------------------- 1 | #include "py/mphal.h" 2 | 3 | void WeAct_Core_board_early_init(void) { 4 | // mp_hal_pin_output(pin_A4); 5 | // mp_hal_pin_write(pin_A4, 1); 6 | } 7 | -------------------------------------------------------------------------------- /mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F411xE 3 | AF_FILE = boards/stm32f411_af.csv 4 | LD_FILES = boards/stm32f411.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | 8 | # MicroPython settings 9 | MICROPY_VFS_LFS2 = 1 10 | -------------------------------------------------------------------------------- /stm32f4xx_hal_conf.h: -------------------------------------------------------------------------------- 1 | #ifndef MICROPY_INCLUDED_STM32F4XX_HAL_CONF_H 2 | #define MICROPY_INCLUDED_STM32F4XX_HAL_CONF_H 3 | 4 | #include "boards/stm32f4xx_hal_conf_base.h" 5 | 6 | // Oscillator values in Hz 7 | #define HSE_VALUE (25000000) 8 | #define LSE_VALUE (32768) 9 | #define EXTERNAL_CLOCK_VALUE (12288000) 10 | 11 | // Oscillator timeouts in ms 12 | #define HSE_STARTUP_TIMEOUT (100) 13 | #define LSE_STARTUP_TIMEOUT (5000) 14 | 15 | #endif // MICROPY_INCLUDED_STM32F4XX_HAL_CONF_H 16 | -------------------------------------------------------------------------------- /bdev.c: -------------------------------------------------------------------------------- 1 | #include "storage.h" 2 | 3 | // External SPI flash uses standard SPI interface 4 | 5 | STATIC const mp_soft_spi_obj_t soft_spi_bus = { 6 | .delay_half = MICROPY_HW_SOFTSPI_MIN_DELAY, 7 | .polarity = 0, 8 | .phase = 0, 9 | .sck = MICROPY_HW_SPIFLASH_SCK, 10 | .mosi = MICROPY_HW_SPIFLASH_MOSI, 11 | .miso = MICROPY_HW_SPIFLASH_MISO, 12 | }; 13 | 14 | #if MICROPY_HW_SPIFLASH_ENABLE_CACHE 15 | STATIC mp_spiflash_cache_t spi_bdev_cache; 16 | #endif 17 | 18 | const mp_spiflash_config_t spiflash_config = { 19 | .bus_kind = MP_SPIFLASH_BUS_SPI, 20 | .bus.u_spi.cs = MICROPY_HW_SPIFLASH_CS, 21 | .bus.u_spi.data = (void*)&soft_spi_bus, 22 | .bus.u_spi.proto = &mp_soft_spi_proto, 23 | #if MICROPY_HW_SPIFLASH_ENABLE_CACHE 24 | .cache = &spi_bdev_cache, 25 | #endif 26 | }; 27 | 28 | spi_bdev_t spi_bdev; 29 | -------------------------------------------------------------------------------- /pins.csv: -------------------------------------------------------------------------------- 1 | A0,PA0 2 | A1,PA1 3 | A2,PA2 4 | A3,PA3 5 | A4,PA4 6 | A5,PA5 7 | A6,PA6 8 | A7,PA7 9 | A8,PA8 10 | A9,PA9 11 | A10,PA10 12 | A11,PA11 13 | A12,PA12 14 | A15,PA15 15 | B0,PB0 16 | B1,PB1 17 | B2,PB2 18 | B3,PB3 19 | B4,PB4 20 | B5,PB5 21 | B6,PB6 22 | B7,PB7 23 | B8,PB8 24 | B9,PB9 25 | B10,PB10 26 | B12,PB12 27 | B13,PB13 28 | B14,PB14 29 | B15,PB15 30 | C13,PC13 31 | C14,PC14 32 | C15,PC15 33 | PA0,PA0 34 | PA1,PA1 35 | PA2,PA2 36 | PA3,PA3 37 | PA4,PA4 38 | PA5,PA5 39 | PA6,PA6 40 | PA7,PA7 41 | PA8,PA8 42 | PA9,PA9 43 | PA10,PA10 44 | PA11,PA11 45 | PA12,PA12 46 | PA15,PA15 47 | PB0,PB0 48 | PB1,PB1 49 | PB2,PB2 50 | PB3,PB3 51 | PB4,PB4 52 | PB5,PB5 53 | PB6,PB6 54 | PB7,PB7 55 | PB8,PB8 56 | PB9,PB9 57 | PB10,PB10 58 | PB12,PB12 59 | PB13,PB13 60 | PB14,PB14 61 | PB15,PB15 62 | PC13,PC13 63 | PC14,PC14 64 | PC15,PC15 65 | PH0,PH0 66 | PH1,PH1 67 | LED_BLUE,PC13 68 | -------------------------------------------------------------------------------- /README-zh.md: -------------------------------------------------------------------------------- 1 | # WeAct Studio STM32F411CEU6 核心板 2 | 3 | * [English Version](./README.md) 4 | 5 | ## Important note 6 | 7 | If there is no `WeAct` and `version number` on the back of the board, the chip batch is `537` or old, the stitches and board are packaged in one bag, `the board screen printing is wrong`(`3V3` is going to be labeled `V3V`), it is definitely pirated.Please comment on issues or let us know by email (WeAct_TC@163.com). 8 | 9 | ## 如何编译micropython 需使用linux (ubuntu或Win10企业版linux子系统) 10 | 11 | 不建议自己编译固件,使用我们提供的固件即可,如确实需要编译,请自备linux基础使用知识,以下均为linux下的操作 12 | 13 | ``` sh 14 | git clone https://github.com/micropython/micropython.git 15 | cd micropython 16 | git submodule update --init 17 | cd mpy-cross 18 | make -j4 19 | cd ../ports/stm32/boards 20 | git clone https://github.com/WeActTC/WeAct_F411CE-MicroPython.git WeAct_F411CE 21 | cd .. 22 | make BOARD=WeAct_F411CE CROSS_COMPILE=/mnt/e/MCU/tools/gcc-arm-none-eabi-8-2018-q4-major/bin/arm-none-eabi- -j 23 | # 或者 24 | make BOARD=WeAct_F411CE -j 25 | ``` 26 | 27 | > 注意:CROSS_COMPILE 修改为自己的编译器路径 28 | 29 | ## mpconfigboard.h 相应修改 30 | 31 | ``` c 32 | /* 板子版本为 V2.0 设置为 1 ,其他设置为 0 例如.V1.3,V2.1 V3.0 */ 33 | #define VERSION_V20 (1) 34 | 35 | /* 使用内置flash改1 使用外置flash改0 */ 36 | #define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (1) 37 | 38 | // Flash Size: 39 | // 4MB Flash 32Mbit 40 | // 8MB Flash 64Mbit 41 | // 16MB Flash 128Mbit 42 | #define MICROPY_HW_SPIFLASH_SIZE_BITS (32 * 1024 * 1024) 43 | ``` 44 | 45 | SPI FLASH: 46 | 47 | ``` c 48 | #define MICROPY_HW_SPIFLASH_CS (pin_A4) 49 | #define MICROPY_HW_SPIFLASH_SCK (pin_A5) 50 | #if VERSION_V20 51 | #define MICROPY_HW_SPIFLASH_MISO (pin_B4) 52 | #else 53 | #define MICROPY_HW_SPIFLASH_MISO (pin_A6) 54 | #endif 55 | #define MICROPY_HW_SPIFLASH_MOSI (pin_A7) 56 | ``` 57 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WeAct Studio STM32F411CEU6 Core Board 2 | 3 | * [中文版本](./README-zh.md) 4 | 5 | ## 重要说明 6 | 7 | 如果板子背面没有`WeAct`和`版本号`,芯片批次是`537`或旧的,插针和板子是装在一个袋子里,`丝印印刷是错误的`(`3V3`印成了`V3V`),肯定是盗版。可以issues我们或通过电子邮件(WeAct_TC@163.com)告知我们。 8 | 9 | ## How to build micropython need ubuntu or Win10 subsystem Linux 10 | 11 | It is not recommended to compile the firmware yourself, just use the firmware provided by us. If you really need to compile, please bring your own basic Linux knowledge. The following are the operations under Linux 12 | 13 | ``` sh 14 | git clone https://github.com/micropython/micropython.git 15 | cd micropython 16 | git submodule update --init 17 | cd mpy-cross 18 | make -j4 19 | cd ../ports/stm32/boards 20 | git clone https://github.com/WeActTC/WeAct_F411CE-MicroPython.git WeAct_F411CE 21 | cd .. 22 | make BOARD=WeAct_F411CE CROSS_COMPILE=/mnt/e/MCU/tools/gcc-arm-none-eabi-8-2018-q4-major/bin/arm-none-eabi- -j 23 | # or 24 | make BOARD=WeAct_F411CE -j 25 | ``` 26 | 27 | > Note: `CROSS_COMPILE` Change to your own compiler path 28 | 29 | ## mpconfigboard.h 30 | 31 | ``` c 32 | /* BOARD Ver 2.0 set 1 ,other set 0 ex.V1.3,V2.1 V3.0 */ 33 | #define VERSION_V20 (1) 34 | 35 | /* Use the built-in flash to change to 1 , use the external flash to change to 0 */ 36 | #define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (1) 37 | 38 | // Flash Size: 39 | // 4MB Flash 32Mbit 40 | // 8MB Flash 64Mbit 41 | // 16MB Flash 128Mbit 42 | #define MICROPY_HW_SPIFLASH_SIZE_BITS (32 * 1024 * 1024) 43 | ``` 44 | 45 | SPI FLASH: 46 | 47 | ``` c 48 | #define MICROPY_HW_SPIFLASH_CS (pin_A4) 49 | #define MICROPY_HW_SPIFLASH_SCK (pin_A5) 50 | #if VERSION_V20 51 | #define MICROPY_HW_SPIFLASH_MISO (pin_B4) 52 | #else 53 | #define MICROPY_HW_SPIFLASH_MISO (pin_A6) 54 | #endif 55 | #define MICROPY_HW_SPIFLASH_MOSI (pin_A7) 56 | ``` 57 | -------------------------------------------------------------------------------- /mpconfigboard.h: -------------------------------------------------------------------------------- 1 | #define MICROPY_HW_BOARD_NAME "WeAct Studio Core" 2 | #define MICROPY_HW_MCU_NAME "STM32F411CE" 3 | 4 | /* 启用 THREAD */ 5 | #define MICROPY_PY_THREAD (1) 6 | 7 | #define MICROPY_BOARD_EARLY_INIT WeAct_Core_board_early_init 8 | void WeAct_Core_board_early_init(void); 9 | 10 | /* BOARD Ver 2.0 set 1 ,other set 0 ex.V1.3,V2.1 */ 11 | #define VERSION_V20 (0) 12 | 13 | /* 使用内置flash改1 使用外置flash改0 */ 14 | /* Use the built-in flash to change to 1 15 | use the external flash to change to 0 */ 16 | #define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (1) 17 | 18 | #define MICROPY_HW_HAS_SWITCH (1) 19 | #define MICROPY_HW_HAS_FLASH (1) 20 | #define MICROPY_HW_ENABLE_RTC (1) 21 | #define MICROPY_HW_ENABLE_USB (1) 22 | #define MICROPY_HW_ENABLE_ADC (1) 23 | #define MICROPY_HW_ENABLE_SERVO (1) 24 | #define MICROPY_HW_ENABLE_SDCARD (0) 25 | #define MICROPY_HW_ENABLE_RNG (0) 26 | #define MICROPY_HW_ENABLE_DAC (0) 27 | 28 | // HSE is 25MHz, CPU freq set to 96MHz 29 | #define MICROPY_HW_CLK_PLLM (25) 30 | #define MICROPY_HW_CLK_PLLN (192) 31 | #define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV2) 32 | #define MICROPY_HW_CLK_PLLQ (4) 33 | 34 | // UART config 35 | #define MICROPY_HW_UART1_TX (pin_A9) 36 | #define MICROPY_HW_UART1_RX (pin_A10) 37 | 38 | #define MICROPY_HW_UART2_TX (pin_A2) 39 | #define MICROPY_HW_UART2_RX (pin_A3) 40 | 41 | #define MICROPY_HW_UART6_TX (pin_A11) 42 | #define MICROPY_HW_UART6_RX (pin_A12) 43 | 44 | // #define MICROPY_HW_UART_REPL PYB_UART_1 45 | // #define MICROPY_HW_UART_REPL_BAUD 115200 46 | 47 | // I2C busses 48 | #define MICROPY_HW_I2C1_SCL (pin_B6) // Arduino D15, pin 3 on CN10 49 | #define MICROPY_HW_I2C1_SDA (pin_B7) // D14, pin 5 on CN10 50 | #define MICROPY_HW_I2C2_SCL (pin_B10) // Arduino D6, pin 25 on CN10 51 | #define MICROPY_HW_I2C2_SDA (pin_B9) // Arduino D3, pin 31 on CN10 52 | #define MICROPY_HW_I2C3_SCL (pin_A8) // Arduino D7, pin 23 on CN10 53 | #define MICROPY_HW_I2C3_SDA (pin_B8) // pin 1 on CN10 54 | 55 | // SPI busses 56 | #define MICROPY_HW_SPI1_NSS (pin_A4) // pin 17 on CN7 57 | #define MICROPY_HW_SPI1_SCK (pin_A5) // Arduino D13, pin 11 on CN10 58 | #define MICROPY_HW_SPI1_MISO (pin_A6) // Arduino D12, pin 13 on CN10 59 | #define MICROPY_HW_SPI1_MOSI (pin_A7) // Arduino D11, pin 15 on CN10 60 | 61 | #define MICROPY_HW_SPI2_NSS (pin_B12) // pin 16 on CN10 62 | #define MICROPY_HW_SPI2_SCK (pin_B13) // pin 30 on CN10 63 | #define MICROPY_HW_SPI2_MISO (pin_B14) // pin 28 on CN10 64 | #define MICROPY_HW_SPI2_MOSI (pin_B15) // pin 26 on CN10 65 | 66 | #define MICROPY_HW_SPI3_NSS (pin_A15) // Arduino A2, pin 32 on CN7 67 | #define MICROPY_HW_SPI3_SCK (pin_B3) // Arduino D3, pin 31 on CN10 68 | #define MICROPY_HW_SPI3_MISO (pin_B4) // Arduino D5, pin 27 on CN10 69 | #define MICROPY_HW_SPI3_MOSI (pin_B5) // Arduino D4, pin 29 on CN10 70 | 71 | #define MICROPY_HW_SPI4_NSS (pin_B12) // pin 16 on CN10 72 | #define MICROPY_HW_SPI4_SCK (pin_B13) // pin 30 on CN10 73 | #define MICROPY_HW_SPI4_MISO (pin_A1) // pin 30 on CN7 74 | #define MICROPY_HW_SPI4_MOSI (pin_A11) // pin 14 on CN10 75 | 76 | 77 | #define MICROPY_HW_SPI5_NSS (pin_B1) // pin 24 on CN10 78 | #define MICROPY_HW_SPI5_SCK (pin_A10) // pin 33 on CN10 79 | #define MICROPY_HW_SPI5_MISO (pin_A12) // pin 12 on CN10 80 | #define MICROPY_HW_SPI5_MOSI (pin_B0) // pin 34 on CN7 81 | 82 | // USRSW is pulled low. Pressing the button makes the input go high. 83 | #define MICROPY_HW_USRSW_PIN (pin_A0) 84 | #define MICROPY_HW_USRSW_PULL (GPIO_PULLUP) 85 | #define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_RISING) 86 | #define MICROPY_HW_USRSW_PRESSED (0) 87 | 88 | // LEDs 89 | #define MICROPY_HW_LED1 (pin_C13) // Blue C13 LED on board 90 | #define MICROPY_HW_LED_ON(pin) (mp_hal_pin_low(pin)) 91 | #define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_high(pin)) 92 | 93 | // The pyboard has a 32.768kHz crystal for the RTC 94 | #define MICROPY_HW_RTC_USE_LSE (1) 95 | #define MICROPY_HW_RTC_USE_US (0) 96 | #define MICROPY_HW_RTC_USE_CALOUT (1) 97 | 98 | // use external SPI flash for storage 99 | // 4MB Flash 32Mbit 100 | // 8MB Flash 64Mbit 101 | // 16MB Flash 128Mbit 102 | #define MICROPY_HW_SPIFLASH_SIZE_BITS (32 * 1024 * 1024) 103 | 104 | #define MICROPY_HW_SPIFLASH_CS (pin_A4) 105 | #define MICROPY_HW_SPIFLASH_SCK (pin_A5) 106 | 107 | #if VERSION_V20 108 | #define MICROPY_HW_SPIFLASH_MISO (pin_B4) 109 | #else 110 | #define MICROPY_HW_SPIFLASH_MISO (pin_A6) 111 | #endif 112 | 113 | #define MICROPY_HW_SPIFLASH_MOSI (pin_A7) 114 | 115 | 116 | // 使用外置spi flash 117 | #if !MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE 118 | 119 | #define MICROPY_HW_SPIFLASH_ENABLE_CACHE (1) 120 | extern const struct _mp_spiflash_config_t spiflash_config; 121 | extern struct _spi_bdev_t spi_bdev; 122 | #define MICROPY_HW_BDEV_IOCTL(op, arg) ( \ 123 | (op) == BDEV_IOCTL_NUM_BLOCKS ? (MICROPY_HW_SPIFLASH_SIZE_BITS / 8 / FLASH_BLOCK_SIZE) : \ 124 | (op) == BDEV_IOCTL_INIT ? spi_bdev_ioctl(&spi_bdev, (op), (uint32_t)&spiflash_config) : \ 125 | spi_bdev_ioctl(&spi_bdev, (op), (arg)) \ 126 | ) 127 | #define MICROPY_HW_BDEV_READBLOCKS(dest, bl, n) spi_bdev_readblocks(&spi_bdev, (dest), (bl), (n)) 128 | #define MICROPY_HW_BDEV_WRITEBLOCKS(src, bl, n) spi_bdev_writeblocks(&spi_bdev, (src), (bl), (n)) 129 | #define MICROPY_HW_BDEV_SPIFLASH_EXTENDED (&spi_bdev) // for extended block protocol 130 | 131 | #endif 132 | 133 | // USB config 134 | #define MICROPY_HW_USB_FS (1) 135 | #define MICROPY_HW_FLASH_FS_LABEL "WeActF411CE" 136 | --------------------------------------------------------------------------------