[SOLVED] How to flash STM32_F4VE

Lennyz1988
Tue Jul 25, 2017 8:18 am
UPDATE: 08-22-2017

It appears this board has a wrong resistor value. That’s why I could not get the usb port to work. See this thread for more info:

http://www.stm32duino.com/viewtopic.php?f=39&t=2484

Flashing the board works using the following methods:

This core: https://github.com/rogerclarkmelbourne/Arduino_STM32

1. Using an ST-link

This core: https://github.com/danieleff/STM32GENERIC (This core has my personal preference because of the good documentation.)

1. Using an ST-link
2. Using a Serial-to-USB

*OLD POST*

I am sorry if this is a really noob question, but how does one flash a STM32_F4VE (STM32F4XX STM32_F4VE V2.0 1509)

http://wiki.stm32duino.com/index.php?title=STM32F407

I tried to read all the information I could find in this section, but what am I missing here?

– I tried using the mini-usb port connected to my Windows 10 x64 and Linux Mint using all the boot jumper combinations. In Windows 10 I always get the “USB device descriptor failed (VID 0x000 PID 0x0002).” So it never loads the DFU mode. I tried to install the drivers from the Arduino_STM32 core, same result. I tried to install the drivers from the STM32 website, same result.

The wiki describes that this board has mini USB which provides USB Serial (VCP) via the ST VCP driver. But after installing still the descriptor failed error. So I tried this driver from the STM32 website:

http://www.st.com/en/development-tools/ … 32102.html

This post explains that the STM32F4 already has a built in bootloader, thus it should give me DFU mode. So what am I doing wrong here?

http://www.stm32duino.com/viewtopic.php … 215#p15447

– I also tried to hook up a FT232 USB-to-serial adapter, but I still cannot upload sketches through the Arduino IDE. So what am I doing wrong or what am I missing here?


stevestrong
Tue Jul 25, 2017 8:41 am
Upload possibilities:

1. DFU over USB or any of Serial 1,2,3
– set BOOT0 jumper (BT0 on the black F4 board) to 3.3V
– reset the board
Now the F4 chip should enter DFU upload mode, the device manager should show you “STM32F4 DFU device” or similar.
If not, then you have to try other drivers.
– flash the chip
– set the BOOT0 jumper back to GND
– reset the board.
https://youtu.be/Kx7yWVi8kbU?t=203

2. STLink V2
– preferred method as no jumper setting is required, works on-the-fly
– you can buy one for ~2USD from Aliexpress or Ebay.

Which OS are you running?


Lennyz1988
Tue Jul 25, 2017 8:57 am
[stevestrong – Tue Jul 25, 2017 8:41 am] –
Upload possibilities:

1. DFU over USB or any of Serial 1,2,3
– set BOOT0 jumper (BT0 on the black F4 board) to 3.3V
– reset the board
Now the F4 chip should enter DFU upload mode, the device manager should show you “STM32F4 DFU device” or similar.
If not, then you have to try other drivers.
– flash the chip
– set the BOOT0 jumper back to GND
– reset the board.

2. STLink V2
– you can buy one for ~2USD from Aliexpress or Ebay.

Which OS are you running?

Hi, thank you for replying. This is a picture of the board when connected to the pc. As you can see I the jumper from Boot0 is set to 1 and Boot1 is set to 0. I set them before connecting the device to the pc.

Image

After that I hook it up to Windows 10 x64 and get this error. Pressing the reset button has no alternative effect. The translation is: USB device descriptor failed. Linux Mint also fails to detect the board. STM32F4 DFU device never appears in my list.

Image

What drivers should I try? I already tried multiple drivers, but the error remains.

These are the drivers I tried:

1. http://www.st.com/en/development-tools/ … 32102.html

2. The drivers provided in the STM32_Arduino core.

3. http://www.st.com/en/development-tools/ … 32080.html


stevestrong
Tue Jul 25, 2017 9:32 am
Try another USB2.0 port, avoid USB 3.x ports.
Or try any of the Serial 1,2,3 ports.

You can also try to connect the board via an USB hub, sometimes it helps.

What does the board in the initial state (BOOT0 to GND)? LED blinks? Any output on serial ports?

Finally the board can be faulty.

I would definitely buy an STLink V2 probe, it would also help later for debugging.


Lennyz1988
Tue Jul 25, 2017 10:02 am
No there is not any output on the serial. I attached a usb-to-serial to the TX, RX, GND, 5v and there wasn’t any output. I tried multiple baudrates. The LED at D1 is always on. It is constant on and never blinks. I tried all the usb ports in my pc, usb2.0 and usb3.0 but that doesn’t make any difference.

In the Youtube video you posted there are blinking leds, but not at my board. Do you think I got a faulty board? I will order a ST-Link, but that will take a few weeks to arrive.

BOOT0 = 1
BOOT1 = 0
LED = Constant on

Image

BOOT0 = 0
BOOT1 = 1
Led = Constant on

Image

BOOT0 = 0
BOOT1 = 0
Led = Constant on

Image


stevestrong
Tue Jul 25, 2017 11:24 am
[stevestrong – Tue Jul 25, 2017 9:32 am] –
What does the board in the initial state (BOOT0 to GND)? LED blinks? Any output on serial ports?

I asked this because on my board originally there was an application flashed which blinked the D2 and D3 LEDs (bottom left part of the pictures) and sent some data over serial 1.
Set both BOOT0 and BOOT1 to GND (original setting) and reset the board.
The D1 LED you pointed out just signalizes that the board is powered, and it should not blink.
Measure the 3.3V supply, maybe is lower than needed.
Change the USB cable.
Re-solder the USB connections on the board.


vitor_boss
Tue Jul 25, 2017 4:16 pm
[Lennyz1988 – Tue Jul 25, 2017 10:02 am] –
LED = Constant on

That LED is power indicator, for flash mine I use a USB serial(FTDI) adaptes connected on TX RX GND 5V header and boot0 to 3.3V using ST flash loader demo.

Or using https://github.com/danieleff/STM32GENERIC library, there is an option to use serial adapter to upload trough serial

EDIT: Try remove battery before power the board if still giving errors, happened here.


Lennyz1988
Wed Jul 26, 2017 9:19 am
[stevestrong – Tue Jul 25, 2017 11:24 am] –

[stevestrong – Tue Jul 25, 2017 9:32 am] –
What does the board in the initial state (BOOT0 to GND)? LED blinks? Any output on serial ports?

I asked this because on my board originally there was an application flashed which blinked the D2 and D3 LEDs (bottom left part of the pictures) and sent some data over serial 1.
Set both BOOT0 and BOOT1 to GND (original setting) and reset the board.
The D1 LED you pointed out just signalizes that the board is powered, and it should not blink.
Measure the 3.3V supply, maybe is lower than needed.
Change the USB cable.
Re-solder the USB connections on the board.

I measured the pins with a multimeter and I get a solid 3.3v output on the pins. I also tried to reflow the solderpaths for the USB connector, but that didn’t change anything. The last thing I am going to try is changing the USB cable. I ordered a new one. I got plenty of micro-USB cables, but I couldn’t find another mini-USB cable. The cable came with the board, but maybe it’s just a crappy cable. I will report back if I have tried the new cable.

I manged to flash the board using the USB-to-Serial using the options @vitor_boss gave me. So the board itself is working fine :)

[vitor_boss – Tue Jul 25, 2017 4:16 pm] –

[Lennyz1988 – Tue Jul 25, 2017 10:02 am] –
LED = Constant on

That LED is power indicator, for flash mine I use a USB serial(FTDI) adaptes connected on TX RX GND 5V header and boot0 to 3.3V using ST flash loader demo.

Or using https://github.com/danieleff/STM32GENERIC library, there is an option to use serial adapter to upload trough serial

EDIT: Try remove battery before power the board if still giving errors, happened here.

Thanks! I managed to flash the board with the “ST FLash Loader” and the library you posted. I am still figuring out what the difference is between this core and the one you posted.


stevestrong
Wed Jul 26, 2017 9:37 am
The flashing process as such should not make any difference on the used core.

So once you are able to flash, you can use any of the available cores:

Arduino_STM32 = https://github.com/rogerclarkmelbourne/Arduino_STM32
or
stm32duino = https://github.com/stm32duino/Arduino_Core_STM32F1
or
STM32GENERIC = https://github.com/danieleff/STM32GENERIC

This forum started initially with the Arduino_STM32 core, even if the forum name hints maybe something different.


ag123
Thu Jul 27, 2017 3:02 pm
it is actually hidden in this thread
http://www.stm32duino.com/viewtopic.php … =10#p26203
that’s how i did it

Lennyz1988
Wed Aug 02, 2017 12:41 pm
[stevestrong – Wed Jul 26, 2017 9:37 am] –
The flashing process as such should not make any difference on the used core.

So once you are able to flash, you can use any of the available cores:

Arduino_STM32 = https://github.com/rogerclarkmelbourne/Arduino_STM32
or
stm32duino = https://github.com/stm32duino/Arduino_Core_STM32F1
or
STM32GENERIC = https://github.com/danieleff/STM32GENERIC

This forum started initially with the Arduino_STM32 core, even if the forum name hints maybe something different.

Thank you for the list. I appreciate your hard work on this core!

I also found some clarification here:

http://www.stm32duino.com/viewtopic.php?f=42&t=97

[ag123 – Thu Jul 27, 2017 3:02 pm] –
it is actually hidden in this thread
http://www.stm32duino.com/viewtopic.php … =10#p26203
that’s how i did it

Thank you for pointing this out. Unfortionally this is not the issue that I am having. The board never loads the DFU drivers. I always get the error “USB device descriptor failed” when connecting the blackboard.

For now I am giving up on programming my device using the usb port. I’ve resoldered the contacts, changed pc’s, tried different os, different cable and different drivers. I just think I got a faulty board.


Pito
Wed Aug 02, 2017 1:21 pm
My current understanding is you can use Serial upload with the built in eternal STM32 bootloader via Serial UART, when configured via the jumpers.
Why do you try it with USB when issues, try with Serial Uart..

UPDATE: I’ve tried with my Black F407ZE first time over USB DFU, basically the same board as yours. Win7 64bit.
1. I set Boot0 to 3.3V (was to GND)
2. unplug/plug usb (power off/on the board)
3. It recognized usb device and it installed STM32 BOOTLOADER (libusbK driver, 12/1/2014, v 3.0.7.0, dig signer USB\VID_0483&PID_DF11 (libwdi autogenerated) )
4. I ran dfu-util and uploaded a “d.bin” OK

C:\Users\pito\Desktop\ProgDev\dfu-util-0.9-win64>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/

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

C:\Users\pito\Desktop\ProgDev\dfu-util-0.9-win64>dfu-util -a 0 -s 0x8000000 -D d
.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/

Invalid DFU suffix signature
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 = 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 = 28276
Download [=========================] 100% 28276 bytes
Download done.
File downloaded successfully

C:\Users\pito\Desktop\ProgDev\dfu-util-0.9-win64>


Lennyz1988
Thu Aug 03, 2017 12:11 pm
[Pito – Wed Aug 02, 2017 1:21 pm] –
My current understanding is you can use Serial upload with the built in eternal STM32 bootloader via Serial UART, when configured via the jumpers.
Why do you try it with USB when issues, try with Serial Uart..

UPDATE: I’ve tried with my Black F407ZE first time over USB DFU, basically the same board as yours. Win7 64bit.
1. I set Boot0 to 3.3V (was to GND)
2. unplug/plug usb (power off/on the board)
3. It recognized usb device and it installed STM32 BOOTLOADER (libusbK driver, 12/1/2014, v 3.0.7.0, dig signer USB\VID_0483&PID_DF11 (libwdi autogenerated) )
4. I ran dfu-util and uploaded a “d.bin” OK

AFAIK I had to install the libusbK driver for the STM32 DFU BOOTLOADER via latest zadig tool. Maybe I reported in a post in past what was the issue..
Yep, I did it with F103ZET in past
http://www.stm32duino.com/viewtopic.php … 188#p26207

Thanks for the suggestion. The reason that I didn’t upload through Serial UART was because Arduino_STM32 core does not support serial upload via the Arduino IDE. I didn’t know that when I started this thread. I am able to upload to the board using ST Flash Loader or through Serial using the core from Danieleff.

I also tried your suggestion but the same error remains. I am suspecting that the board is faulty.


RogerClark
Thu Aug 03, 2017 10:57 pm
I have all sorts of issues with drivers and DFU to a similar board.

But We have serial upload in the libmaple tools

Which Core are you using ?


Lennyz1988
Fri Aug 04, 2017 7:02 am
[RogerClark – Thu Aug 03, 2017 10:57 pm] –
I have all sorts of issues with drivers and DFU to a similar board.

But We have serial upload in the libmaple tools

Which Core are you using ?

I am using the core from your repository:

https://github.com/rogerclarkmelbourne/Arduino_STM32

There is no option to select upload via usb serial so I assume it’s not supported yet in this core.

Image


stevestrong
Fri Aug 04, 2017 7:20 am
Yea, currently is only upload over STLink supported for F4.
I assume the DFU upload with ST flash utility should also work, but it is a bit cumbersome, you have to set the BOOT0 jumper to 3.3V, upload the sw, and set back the jumper to GND. As we don’t have a working DFU utility, we have no menu for selecting upload modality.

Using on long term the F4 boards you will sooner or later need debugging, so that getting a STLink probe is anyway useful, I recommend to get one and then all your problems are gone :)


RogerClark
Fri Aug 04, 2017 7:44 am
It would be easy to add Serial upload, but like @stevestrong says, I don’t think hardly anyone would use it

Lennyz1988
Fri Aug 04, 2017 9:12 am
[stevestrong – Fri Aug 04, 2017 7:20 am] –
Yea, currently is only upload over STLink supported for F4.
I assume the DFU upload with ST flash utility should also work, but it is a bit cumbersome, you have to set the BOOT0 jumper to 3.3V, upload the sw, and set back the jumper to GND. As we don’t have a working DFU utility, we have no menu for selecting upload modality.

Using on long term the F4 boards you will sooner or later need debugging, so that getting a STLink probe is anyway useful, I recommend to get one and then all your problems are gone :)

Yes, I ordered the STLink a week ago based on your recommendation. I am still waiting for it to arrive :)

[RogerClark – Fri Aug 04, 2017 7:44 am] –
It would be easy to add Serial upload, but like @stevestrong says, I don’t think hardly anyone would use it

I understand :)


Pito
Fri Aug 04, 2017 10:39 am
I am using j-link clone with Black F407ZET exclusively (the black jtag connector), works great (you have to upgrade the j-link’s fw, not easy exercise though).
ST-Link is a “mandatory tool” when messing with stm32 stuff, indeed.
I still think your usb dfu as described above may work, maybe your driver for STM BOOTLOADER has not been installed properly.

vitor_boss
Mon Aug 07, 2017 10:50 am
[RogerClark – Fri Aug 04, 2017 7:44 am] –
It would be easy to add Serial upload, but like @stevestrong says, I don’t think hardly anyone would use it

I’m using it from STM32GENERIC, stm32flash flash utility run the program after flashing without touch the boot jumper


stevestrong
Mon Aug 07, 2017 11:07 am
You mean, the software will jump to the bootloader (in ROM?) and execute it without setting the BOOT0 jumper?
How can this be implemented?

RogerClark
Mon Aug 07, 2017 12:06 pm
Steve

I have seem some code on STM’s forum that claimed to be able to jump main application to to the internal DFU, but I’ve never tried it.

(Note, its was on the old STM forum not the new “community” one.


vitor_boss
Mon Aug 07, 2017 2:45 pm
[stevestrong – Mon Aug 07, 2017 11:07 am] –
You mean, the software will jump to the bootloader (in ROM?) and execute it without setting the BOOT0 jumper?
How can this be implemented?

Exactly, after flash(in DFU mode) via Serial1 it run the code.
Image

Maybe you can found the answer here: https://github.com/ARMinARM/stm32flash
I’m just starting on arduino, I have low knowledge on C, mostly my codding was in BASIC.


Leave a Reply

Your email address will not be published. Required fields are marked *