Giter Club home page Giter Club logo

weact_f411ceu6's Introduction

WeAct STM32F411CEU6

MicroPython board definition files for the WeAct V1.3 STM32F411CEU6 dev board.

board

Build the firmware

Clone the board definitions to your MicroPython ports/stm32/boards folder.

cd micropython/ports/stm32/boards
git clone https://github.com/mcauser/WEACT_F411CEU6.git

cd ..
make BOARD=WEACT_F411CEU6

Flashing via DFU

This board can be flashed using DFU. To put the board in DFU mode, disconnect USB, connect A9 to A10 and reconnect USB. Press and hold BOOT0. Press and release RESET. Wait 0.5 seconds. Release BOOT0.

List attached DFU capable devices to check you are in DFU mode.

dfu-util -l

Found DFU: [0483:df11] ver=2200, devnum=12, cfg=1, intf=0, path="20-2", alt=3, name="@Device Feature/0xFFFF0000/01*004 e", serial="328A37623437"
Found DFU: [0483:df11] ver=2200, devnum=12, cfg=1, intf=0, path="20-2", alt=2, name="@OTP Memory /0x1FFF7800/01*512 e,01*016 e", serial="328A37623437"
Found DFU: [0483:df11] ver=2200, devnum=12, cfg=1, intf=0, path="20-2", alt=1, name="@Option Bytes  /0x1FFFC000/01*016 e", serial="328A37623437"
Found DFU: [0483:df11] ver=2200, devnum=12, cfg=1, intf=0, path="20-2", alt=0, name="@Internal Flash  /0x08000000/04*016Kg,01*064Kg,03*128Kg", serial="328A37623437"

Now you can flash the board using USB with the command:

make BOARD=WEACT_F411CEU6 deploy

Once the upload is complete, disconnect USB, remove jumper between A9 and A10, then reconnect USB.

Alternatively, you can use the MicroPython command pyb.bootloader() to get into DFU mode without needing to use the switch.

Currently, you need to unplug and replug the board in order to switch from DFU mode back to regular mode.

Accessing the board

Once built and deployed, you can access the MicroPython REPL (the Python prompt) via USB serial.

screen /dev/tty.usbmodem1422 115200
# or
screen /dev/ttyACM0 115200

Flash

In mpconfigboard.h you can configure the board to use F411CE internal flash or if you add a SPI flash chip to the bottom of the board you can use it instead.

If you use internal, there's only around 45kb free. With external you can have 4-16 MB.

// Use internal flash (512 KByte):
#define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (1)

// Or use external SPI flash:
#define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (0)

Tested with:

  • Winbond W25Q32 (4 MByte)
  • Winbond W25Q64 (8 MByte)
  • Winbond W25Q128 (16 MByte)

Define the size that matches your flash chip.

// Winbond W25Q32 (4 MByte)
#define MICROPY_HW_SPIFLASH_SIZE_BITS (32 * 1024 * 1024)

// Or Winbond W25Q64 (8 MByte)
#define MICROPY_HW_SPIFLASH_SIZE_BITS (64 * 1024 * 1024)

// Or Winbond W25Q128 (16 MByte)
#define MICROPY_HW_SPIFLASH_SIZE_BITS (128 * 1024 * 1024)

If you use the wrong one, say 8 MB but you only have a 4 MB chip, it will appear as an 8 MB volume and let you write more than 4 MB, but you absolutely will get data corruption.

You can also use external SPI flash modules. Most modules have WP/IO2 and HOLD/RESET/IO3 pulled high, so you can't use Quad SPI mode, only SPI.

spi flash

Specifications

  • STM32F411CEU6 ARM Cortex M4
  • 100MHz, 125 DMIPS / 1.25 DMIPS / MHz
  • 1.7V - 3.6V operating voltage
  • 25MHz system crystal
  • 32.768KHz RTC crystal
  • 2.54mm pitch pins
  • JTAG/SWD header
  • 512 KByte Flash, 128 KByte SRAM
  • 5x SPI, 3x USART, 5x I2S, 3x I2C
  • 1x SDIO
  • 1x USB 2.0 FS
  • (Unpopulated) Winbond W25Q32 32Mbit SPI Flash
  • 1x ADC (12-bit / 16-channel)
  • 6x general timers, 2x advanced timers
  • USB-C for power and comms
  • Red power LED
  • Blue user LED (PC13) active low
  • 1x button for bootloader selection
  • Reset button, 1x user buttons KEY (PA0)
  • 2x20 side pins + 1x4 ISP pins
  • no mounting holes
  • Dimensions: 52.81mm x 20.78mm

Exposed Port Pins

  • PA0-PA12, PA15
  • PB0-PB10, PB12-PB15
  • PC13-C15

Peripherals

SPI Flash (U3) Unpopulated

  • 1 PA4 CS
  • 2 PA6 MISO
  • 3 3V3 WP
  • 4 GND GND
  • 5 PA7 MOSI
  • 6 PA5 SCK
  • 7 3V3 HOLD
  • 8 3V3 VCC

SWD debug (P3)

  • 1 GND GND
  • 2 PA14 SWCLK
  • 3 PA13 SWDIO
  • 4 3V3 VCC

USB-C (J1)

  • 1 GND
  • 2 VBUS 5V
  • 3 PA11 USB_DN
  • 4 PA12 USB_DP

User LED

  • PC13 Blue LED

Links

Related boards

License

Licensed under the MIT License.

weact_f411ceu6's People

Contributors

mcauser avatar rmaia3d avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

weact_f411ceu6's Issues

make error

Hi, when I use the code:
make BOARD=WEACT_F411CEU6
I get this error:
[build-WEACT_F411CEU6/genhdr/pins.h] Error 128
What I've done wrong?

64 kB flash wasted?

Hello,

the following is rather a question than an issue.
I noticed that the two parts of firmware, firmware0 and firmware 1 are burnt to the addresses 0x8000000 and
0x8020000. Firmware 0 is only about 14 kBytes (bootloader?). The rest of the first 64 kBytes is used by the internal flash filesystem. The following 64kB Block is not used (0xFFs), I checked this by reading out with
STM32CubeProgrammer.
So we could in principle start with program code at 0x8010000 and have 64 kByte more
program space. Or we could extend the size of the internal flash by 64 kB.

Is this right or are there other reasons/ constraints preventing this?

compile time error in main.c

A recent change (in main.c?) causes a compile error:

main.c:57:10: fatal error: mpbthciport.h: No such file or directory
57 | #include "mpbthciport.h"
| ^~~~~~~~~~~~~~~
compilation terminated.

building firmware V1.13-266

When trying to build v1.13-266 the messages below appear. It seems related to a recent change in Micropython:
drivers/memory/spiflash: Add MICROPY_HW_SPIFLASH_ENABLE_CACHE option.

boards/WEACT_F411CEU6/bdev.c:16:8: error: unknown type name 'mp_spiflash_cache_t'
   16 | STATIC mp_spiflash_cache_t spi_bdev_cache;
      |        ^~~~~~~~~~~~~~~~~~~
boards/WEACT_F411CEU6/bdev.c:23:6: error: 'const struct _mp_spiflash_config_t' has no member named 'cache'
   23 |     .cache = &spi_bdev_cache,
      |      ^~~~~
boards/WEACT_F411CEU6/bdev.c:23:14: error: excess elements in struct initializer [-Werror]
   23 |     .cache = &spi_bdev_cache,
      |              ^
boards/WEACT_F411CEU6/bdev.c:23:14: note: (near initialization for 'spiflash_config')
cc1: all warnings being treated as errors
make: *** [../../py/mkrules.mk:77: build-WEACT_F411CEU6/boards/WEACT_F411CEU6/bdev.o] Error 1

STM Virtual Serial Port USB Issue

Dear all,

I followed all the steps in this guide and could access the REPL prompt a few times. However, most times the board is not properly detected (showing "Error 43" in Windows device manager). This could be related to a USB clock issue and people from "STM32duino" seem to have fixed it here by setting the clock to 96 instead of 100 MHz (USB needs 48 MHz): stm32duino/Arduino_Core_STM32@a5baee3
Would it be possible to include this fix here? Unfortunately I have no idea how to do that...

Compiling v 1.14 with Winbond W25Q128 external flash

Hello,

I compiled with Micropython v 1.14 under Manjaro Linux.

After

sudo pacman -S arm-none-eabi-gcc arm-none-eabi-newlib
sudo pacman -S stlink

I had no Problem compiling with the predefined settings.
I noticed (too) that it was necessary to change into mpy-cross directory and execute make there before going to stm32 directory and making with
make BOARD=WEACT_F411CEU6 .

I could use
make BOARD=WEACT_F411CEU6 deploy-stlink
with my STLink v2 connected to the Blackpill board.
It gave an error first but repeating a second time I had success.

Now my Problem:
In a second attempt I wanted to make binaries for my Blackpill boards from Canaduino which have Winbond W25Q128 (16 MByte) external flash added.

Following instructions here I set
#define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (0)
and later uncommented
#define MICROPY_HW_SPIFLASH_SIZE_BITS (128 * 1024 * 1024)

After executing the make command I ran into the Error that the type
mp_spiflash_cache_t was not defined.

Therefore I had to adapt the sources a very little bit:

I included
#include "../../drivers/memory/spiflash.h"
in line 2 of bdev.c (after #include "storage.h")

and
#define MICROPY_HW_SPIFLASH_ENABLE_CACHE (1)
in line 104 of mpconfigport.h (after #define MICROPY_HW_SPIFLASH_MOSI (pin_A7) ).

And then it compiled and worked.

@mcauser : Sorry, I'm not familiar enough with git to make a pull-request.
I hope you read this and make these changes.

A question: Do we need cache for the spiflash at all?

Greetings and thank you for your work.

rkompass

F401 support

Hi,
I have the STM32F401CCU6 version of the weact v2.0 board and I'm getting the following error.

Do you have any idea whether this is due to the board definition being different or some other issue. Tried with 2 boards and both are the same.

Thank you!

[nix-shell:~/Documents/mpy/micropython/ports/stm32]$ make BOARD=WEACT_F411CEU6 deploy V=1
python3 ../../py/makeversionhdr.py build-WEACT_F411CEU6/genhdr/mpversion.h
python3 ../../tools/makemanifest.py -o build-WEACT_F411CEU6/frozen_content.c -v "MPY_DIR=../.." -v "MPY_LIB_DIR=../../../micropython-lib" -v "PORT_DIR=/home/jaanus/Documents/mpy/micropython/ports/stm32" -v "BOARD_DIR=boards/WEACT_F411CEU6" -b "build-WEACT_F411CEU6" -f"-march=armv7m" boards/manifest.py
Writing build-WEACT_F411CEU6/firmware.dfu to the board
python3 ../../tools/pydfu.py --vid 0x0483 --pid 0xDF11 -u build-WEACT_F411CEU6/firmware.dfu
File: build-WEACT_F411CEU6/firmware.dfu
b'DfuSe' v1, image size: 321965, targets: 1
b'Target' 0, alt setting: 0, name: "ST...", size: 321680, elements: 2
0, address: 0x08000000, size: 14784
1, address: 0x08020000, size: 306880
usb: 0483:df11, device: 0x0000, dfu: 0x011a, b'UFD', 16, 0x777af580
Writing memory...
0x08000000 14784 [=========================] 100%
0x08020000 306880 [========== ] 42% DFU: set address failed (STATE_DFU_ERROR)
make: *** [Makefile:554: deploy] Error 1

Build error with use external Flash.

When I modify micropython/ports/stm32/boards/WEACT_F411CEU6/mpconfigboard.h

#define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (0)

Then build with make BOARD=WEACT_F411CEU6, appear error:

...

CC boards/WEACT_F411CEU6/bdev.c
boards/WEACT_F411CEU6/bdev.c:16:8: error: unknown type name 'mp_spiflash_cache_t'
16 | STATIC mp_spiflash_cache_t spi_bdev_cache;
| ^~~~~~~~~~~~~~~~~~~
boards/WEACT_F411CEU6/bdev.c:23:6: error: 'const struct _mp_spiflash_config_t' has no member named 'cache'
23 | .cache = &spi_bdev_cache,
| ^~~~~
boards/WEACT_F411CEU6/bdev.c:23:14: error: excess elements in struct initializer [-Werror]
23 | .cache = &spi_bdev_cache,
| ^
boards/WEACT_F411CEU6/bdev.c:23:14: note: (near initialization for 'spiflash_config')
cc1: all warnings being treated as errors
See https://github.com/micropython/micropython/wiki/Build-Troubleshooting
make: *** [../../py/mkrules.mk:83: build-WEACT_F411CEU6/boards/WEACT_F411CEU6/bdev.o] Error 1

When use

#define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (1)

have not this issue.

Can't get into DFU mode.

My board is a newer v2.0. I can't get it to work in DFU mode, following all the steps described. DFU-util shows nothing. The board itself works for sure, it can be flashed using SWD with ST-Link. Is there an alternative way of uploading MicroPython firmware, like with SWD? There's clearly some problem with the boot selection, that I don't know how to solve.

the board is constantly mounting to the computer via USB

I just bought the board, I'm trying to start working with it. Installed micropython, loaded the bootloader onto the board. The board is automatically mounted to the computer and its contents are displayed. I added the program to the main.py file, saved it, and pressed the reset button. I wait for the program to work, but instead the board connects to the computer again. I use Linux.
Please tell me how you can control the work of mounting the board to a PC?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.