STM32 DFU Programming
The time is currently 21:42 and I’ve been sitting in front of my computer in 2 hours to get the DFU programming to work.
Now it is working, and I’m able to make one of my excisting projects into a DFU loadable project (compiled it’s a .dfu filed)
I’ve also changed the DFU bootloader code to use GPIOA_0 as DFU Enable pin, and GPIOA_1 as USB Disconnect – this makes me able to use the GPIOB and GPIOC for my display without any interferrance!
Here is how you make a Ride7 project DFU loadable:
The Default Startup script (in settings) has been set to No, as we have included a special startup script in the project (startup_stm32f10x_hd.s – found in CMSIS\Core\CM3\startup\gcc)
Also change the Linker Script in project settings to match the processor group you are using (Connectivity, High Density… and so on – fx stm32f10x_hd_flash_offset.ld)
Also be aware of the change in the NVIC_Configuration – here we tell the processor that the Flash has to start at adress 0x3000
When you have compiled the code to a HEX file, run “DFU File Manager” to create a .dfu file.
Target ID: 00 is Internal Flash
Target ID: 01 is SPI Flash
Target ID: 02 is NOR Flash
Now you can use DfuSe to load the .dfu file into the internal flash of your STM32!
What is it exactly DFU? What is the different between DFU and normal hex or bin? Thanks.
DFU stands for Device Firmware Upgrade.
In a single DFU file there can be different hex files – fx. a hex file for the internal flash, one for the external and maybe one for the serial flash.
The smart thing is that all theese flashes are updated with a single file and a single update!
I am working on STM3210E-EVAL Board, i was converted audio wave file as dfu formate, using Dfuse Demonistration software downloaded into NOR Flash. now i am executing example code given by ST Microelectronics but it is showing wave file error. plz give me solution. thanks
@R.S.Naidu
Hi.
I’m sorry, but I haven’t tried working with external NOR Flash yet, so I’m not sure what the error could be.
Are you sure though, that you have converted the Audio file correctly, and that the vectors (start position of the file) has been moved, so it fits the NOR Flash? Have you tried any other NOR Flash examples – are they working?
Best Regards
Thomas Jespersen
Have u tried the DFU example within USB library or DFU bootloader? The DFU example may contain better drivers for external NOR.
Tomas
@Tomas Dresler
I tried the DFU example from the DFU Bootloader folder.
When I tried this I only had the STM32-STAMP which doens’t have any external Flash.
Thomas
I kept reading this post too many times because i’m working on the same. I have STM32-P103 Olimex board which has STM32F103RBT6 ( Medium Density) micro. But I’m not sure it has all the necessary things to put it in DFU boot loader mode ( it has ‘DISCONNECT’ pin ). I also have iNEMO v2 board which has STM32F103RET7 ( High Density) micro with DFU facility. They provided firmware source for the board. I use Virtual com port of it with modifications suitable for Olimex board. But Olimex bord not entering into DFU mode. When i downloaded flash memory contents from both of devices. They have different hex values from 0x08000000 to 0x08003000. From this i guess, Olimex board doesn’t has DFU bootloader. I have two doubts:
1. Do i have to flash the DFU bootloader to Olimex board ?
2. In order to enter DFU mode by DfuSe demo program, Should the Olimex board must be
recognized on virtual COM port ? ( because I’m still learning about ‘ STM32 virtual com
port driver & its configuration for Olimex board’ ).
I guess, I asked you too much. Pardon me if i grabbed too much time.
Thank you
@Harinath
Dear Harinath.
The DFU mode over USB is a bootloader application that has to be programmed into the STM32 flash before use. All your applications also needs a special startup file and the NVIC (startup vectore) has to be moved.
The 0x0800000 is the standard startup address, where the 0x08003000 is the moved (and correct) startup vector for your applications that should be programmed into the device thru the DFU programmer application.
When a DFU Device is plugged into the computer it is recognized as a USB HID device. So no, it will not be recognized as a Virtual Serial port.
The Virtual Serial port is another example but it can’t be used for programming.
Best Regards
Thomas Jespersen