WeActStudio / WeActStudio.MiniSTM32F4x1

MiniF4-STM32F401CEU6/STM32F411CEU6 Product Literature
667 stars 149 forks source link

Documentation : how to flash blink example and run it using WeAct_HID_Bootloader #8

Open XavierBerger opened 4 years ago

XavierBerger commented 4 years ago

A documentation explaining how to upload a simple blink program could be a great value for this board. Such example is very valuable for people starting using such a new board. I looked for such example but I didn't find it. After few tries, I manage to see the LED blinking, but I think I finally accidentally erase the bootloader.

A additional valuable documentation could be how to install WeACT_HID_Bootloader using USBtoSerial adapter.


To help you in doc writing, here is what I did. You may find some mistakes to be documented:

Running on Linux (Ubuntu Fosa) I plugged the F401 and saw WeAct_HID_bootloader with LED fading up and down. I press tke KEY and led turned OFF. I saw STM32_HID_bootloader. I did configure platformio to use dfu to upload the blink (framework adruino) example. The DFU gave ma an error (see bellow). After reboot, the LED is blinking but I cannot see anymore the boot loaders...

[...]
Linking .pio/build/blackpill_f401cc/firmware.elf
Checking size .pio/build/blackpill_f401cc/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   1.3% (used 880 bytes from 65536 bytes)
Flash: [          ]   3.9% (used 10220 bytes from 262144 bytes)
Building .pio/build/blackpill_f401cc/firmware.bin
Adding dfu suffix to firmware.bin
dfu-suffix (dfu-util) 0.9

Copyright 2011-2012 Stefan Schmidt, 2013-2014 Tormod Volden
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Suffix successfully added to file
Configuring upload protocol...
AVAILABLE: blackmagic, dfu, jlink, serial, stlink
CURRENT: upload_protocol = dfu
Uploading .pio/build/blackpill_f401cc/firmware.bin
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2020 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Match vendor ID from file: 0483
Match product ID from file: df11
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuERROR, status = 10
dfuERROR, clearing status
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
DfuSe interface name: "Internal Flash  "
Downloading to address = 0x08000000, size = 10656

Erase           [                         ]   0%            0 bytes
Erase           [====                     ]  19%         2048 bytes
Erase           [=========                ]  38%         4096 bytes
Erase           [==============           ]  57%         6144 bytes
Erase           [===================      ]  76%         8192 bytes
Erase           [======================== ]  96%        10240 bytes
Download        [                         ]   0%            0 bytes
Download        [====                     ]  19%         2048 bytes
Download        [=========                ]  38%         4096 bytes
Download        [==============           ]  57%         6144 bytes
Download        [===================      ]  76%         8192 bytes
Download        [======================== ]  96%        10240 bytesdfu-util: Error during download get_status

Download        [=========================] 100%        10656 bytes
Download done.
File downloaded successfully
*** [upload] Error 74
XavierBerger commented 4 years ago

Let me answer to my second question: How to flash Weact HID Bootloader (using DFU)?

On Linux, download WeAct_HID_Bootloader_F4x1.hex from this repoitory and execute the following command:

objcopy -Iihex -j .sec1 -Obinary WeAct_HID_Bootloader_F4x1.hex WeAct_HID_Bootloader_F4x1.bin
dfu-suffix -a WeAct_HID_Bootloader_F4x1.bin
dfu-util -a 0 -s 0x08000000 -D WeAct_HID_Bootloader_F4x1.bin