Tracing issues with WeAct STM32F411
Posted: Sat Jul 11, 2020 1:18 pm
Background
I have the WeAct BlackPill STM32F411CEU6. I don't have any meaningful prior experience with stm32 or microcontrollor/embedded systems other than a bit of playing around with an AdaFruit Feather nRF52832 with the Arduino IDE. As for tools, I have the aforementioned BlackPill, the aforemetioned `Feather nRF52832`, a Segger JLink Edu Mini with its cables, a decent beginner's soldering iron and the USB cables to connect them to my programming system, which runs Ubuntu 20.04. I don't have any other tools at all.
What I Did
- Add the https://github.com/stm32duino/Arduino_Core_STM32/ core release v1.9.0 to Arduino IDE as per instruction therein.
- First connection of the BlackPill with Arduino IDE to flash blinky did nothing.
- `dmesg` showed that the device was connected as `WeAct HID bootloader`
- Google gave me viewtopic.php?p=1640#p1640 and Blinky was up and running, using dfu-util to flash the Blinky.ino.bin created by the IDE in /tmp/arduino_build_xxx/
- More reading of the thread implied that I could use the fork of the HID_bootloader from WEACT to get seamless writing via the IDE without resorting to dfu-util
This is where I made my mistake: I used dfu-util to write the bootloader to the application area:
Why I did it: all documentation seemed to imply that the HID_bootloader code was application code, and the real application code would be loaded 16K up from 0x8000000. Even in the readme, the commands to flash the bootloader used the same address.
Why I think this is a mistake: after this, I am unable to get the board to work correctly. When not in DFU mode, the board does not register with the OS. DFU mode works perfectly, but nothing else works. I tried to re-write blinky via DFU-mode as previously, but no dice:
Given my meager skills, and even worse variety of equipment, can I get suggestions of what I need to do to check what I can do to fix whatever issue I created?
I have the WeAct BlackPill STM32F411CEU6. I don't have any meaningful prior experience with stm32 or microcontrollor/embedded systems other than a bit of playing around with an AdaFruit Feather nRF52832 with the Arduino IDE. As for tools, I have the aforementioned BlackPill, the aforemetioned `Feather nRF52832`, a Segger JLink Edu Mini with its cables, a decent beginner's soldering iron and the USB cables to connect them to my programming system, which runs Ubuntu 20.04. I don't have any other tools at all.
What I Did
- Add the https://github.com/stm32duino/Arduino_Core_STM32/ core release v1.9.0 to Arduino IDE as per instruction therein.
- First connection of the BlackPill with Arduino IDE to flash blinky did nothing.
- `dmesg` showed that the device was connected as `WeAct HID bootloader`
- Google gave me viewtopic.php?p=1640#p1640 and Blinky was up and running, using dfu-util to flash the Blinky.ino.bin created by the IDE in /tmp/arduino_build_xxx/
- More reading of the thread implied that I could use the fork of the HID_bootloader from WEACT to get seamless writing via the IDE without resorting to dfu-util
This is where I made my mistake: I used dfu-util to write the bootloader to the application area:
Code: Select all
dfu-util -a 0 -s 0x8000000 -RD hid_bootloader.bin
Why I think this is a mistake: after this, I am unable to get the board to work correctly. When not in DFU mode, the board does not register with the OS. DFU mode works perfectly, but nothing else works. I tried to re-write blinky via DFU-mode as previously, but no dice:
Code: Select all
samveen@work:/tmp/arduino_build_967$ dfu-util -l
dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 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/
dfu-util: Cannot open DFU device 0a5c:21e6
Found DFU: [0483:df11] ver=2200, devnum=12, cfg=1, intf=0, path="3-2", alt=3, name="@Device Feature/0xFFFF0000/01*004 e", serial="395D367A3339"
Found DFU: [0483:df11] ver=2200, devnum=12, cfg=1, intf=0, path="3-2", alt=2, name="@OTP Memory /0x1FFF7800/01*512 e,01*016 e", serial="395D367A3339"
Found DFU: [0483:df11] ver=2200, devnum=12, cfg=1, intf=0, path="3-2", alt=1, name="@Option Bytes /0x1FFFC000/01*016 e", serial="395D367A3339"
Found DFU: [0483:df11] ver=2200, devnum=12, cfg=1, intf=0, path="3-2", alt=0, name="@Internal Flash /0x08000000/04*016Kg,01*064Kg,03*128Kg", serial="395D367A3339"
samveen@work:/tmp/arduino_build_967$ dfu-util -a 0 -s 0x8000000 -R -D Blink.ino.bin
dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 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/
dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
dfu-util: Cannot open DFU device 0a5c:21e6
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 = 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 = 11236
Download [=========================] 100% 11236 bytes
Download done.
File downloaded successfully
dfu-util: can't detach
Resetting USB to switch back to runtime mode