Hi.
I bought a similar board to this one quite some time ago:
https://www.diymore.cc/products/stm32f4-discovery-stm32f407vgt6-microcontroller-32bit-flash-mcu-arm-cortex-m4-core-development-boardI say similar because the one I bought seems not available anymore there and, instead, they have that VGT6 instead of VET6 (mine).
I never used it before but today I decided to spend some time with it.
I found this example code to make PC8 blink. I just changed the frequency to be able to check the blinking/toggling with a DMM becaus emy scope is actually at work.
void setup() {
pinMode(PC8, OUTPUT);
}
void loop() {
digitalWrite(PC8,HIGH);
delay(10);
digitalWrite(PC8,LOW);
delay(10);
}
I compiled it with Arduino IDE and used the generated
.elf file to upload it to the board.
To program the board we wactually must pull BOOT1 pin to LOW and only then plug in the USB cable. Then we can see the device in DFU mode with:
$ lsusb
Bus 002 Device 070: ID 0483:df11 STMicroelectronics STM Device in DFU Mode
$_
Then I installed
dfu-util and tried to talk with the device:
$ sudo dfu-util --list
Found DFU: [0483:df11] ver=2200, devnum=70, cfg=1, intf=0, path="2-1", alt=3, name="@Device Feature/0xFFFF0000/01*004 e", serial="3962374B3238"
Found DFU: [0483:df11] ver=2200, devnum=70, cfg=1, intf=0, path="2-1", alt=2, name="@OTP Memory /0x1FFF7800/01*512 e,01*016 e", serial="3962374B3238"
Found DFU: [0483:df11] ver=2200, devnum=70, cfg=1, intf=0, path="2-1", alt=1, name="@Option Bytes /0x1FFFC000/01*016 e", serial="3962374B3238"
Found DFU: [0483:df11] ver=2200, devnum=70, cfg=1, intf=0, path="2-1", alt=0, name="@Internal Flash /0x08000000/04*016Kg,01*064Kg,07*128Kg", serial="3962374B3238"
$_
$ sudo dfu-util --download /tmp/arduino/sketches/565B457541832EAED9889914CDFB6C29/test.ino.elf --device=0483:df11 -a "@Internal Flash /0x08000000/04*016Kg,01*064Kg,07*128Kg" --dfuse-address 0x08000000
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!!!
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 = 619612
Download [=========================] 100% 619612 bytes
Download done.
File downloaded successfully
$_
This is exactly the same:
sudo dfu-util --download /tmp/arduino/sketches/565B457541832EAED9889914CDFB6C29/test.ino.elf --device=0483:df11 -a 0 --dfuse-address 0x08000000
The
-a 0 is just an alias for the longer version above.
After this, we need to remove the pull-down from BOOT1, pull down BOOT0, unplug and plugin the USB cable and press the reset button to make the program run. So I did, and then I checked with the DMM if PC8 was toggling or not.
It wasn't.
So, next I tried STM32CubeProgrammer. BOOT1 to low, unplug and plugin USB cable, press reset and connect to the device in STM32CubeProgrammer. Then selected the file and hit "Start programming". When it finished, again remove BOOT1 pull down, pull down BOOT0, unplug and plugin USB and press reset. Check PC8 with DMM and
it is actually toggling.
So, where did I go wrong with
dfu-util?