Skip to main content
Lakshmi Lavanya
Associate II
Dec 8, 2016 1:07 PM UTC
Question

Runtime DFU application in STM32L4 series

Posted on December 08, 2016 at 14:07

Hello Everyone,

I need DFU application which can load the new firmware at run time.

I want to implement DFU in stm32l476G-Eval board, tried with DFU bootloader method (Connecting Boot0 to VCC) it is working fine.

Compiled the DFU standalone example application and ran it but it is not showing as a DFU device when i connected the eval board to PC.

Can any body explain or point me to the links which can explain how to implement the DFU standalone method. How the run time DFU will work? how much space it will take for the DFU code?

#stm32l4 #usb #stm32l476g-eval #stm32l4-dfu-runtime #dfu

Note: this post was migrated and contained many threaded conversations, some content may be missing.
This topic has been closed for replies.

37 replies

ST Technical Moderator
Dec 8, 2016 1:59 PM UTC
Posted on December 08, 2016 at 14:59

Dear

gamini.lakshmi_lavan

,

Welcome to theSTM32 forum.

I recommend that you have a look to the application note

http://www.st.com/content/ccc/resource/technical/document/application_note/b9/9b/16/3a/12/1e/40/0c/CD001675pdf/files/CD001675pdf/jcr:content/translations/en.CD001675pdf

'STM32 microcontroller system memory boot mode', find information and requirements related to the STM32L476xx device with DFU bootloader.

For using DFU on STM32, I recommend you to review the following resources:

-

http://www.st.com/content/st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-programmers/stsw-stm32html

' Getting started with DfuSe USB device firmware upgrade STMicroelectronics extension'.

-

http://www.st.com/content/ccc/resource/technical/document/application_note/6a/17/92/02/58/98/45/0c/CD00264pdf/files/CD00264pdf/jcr:content/translations/en.CD00264pdf

'USB DFU protocol used in the STM32 bootloader'

-

https://st-videos.s3.amazonaws.com/BOOTLOADER.mp4

Getting started with STM32 built-in USB DFU Bootloader

Hope this helps you.

Best Regards

-Imen-

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
Lakshmi Lavanya
Associate II
Dec 9, 2016 5:19 AM UTC
Posted on December 09, 2016 at 05:19

Hi Imen,

Thanks for your reply.

I am able to load the new firmware using Bootloader DFU mode, but i need run time DFU mode.

I have to enable the DFU class and USB device code, after that what i need to add in my code to get my device as a DFU capability device.

Here when i connected it to PC it is not detecting as a USB DFU device.

Tesla DeLorean
Guru
Dec 8, 2016 4:17 PM UTC
Posted on December 08, 2016 at 17:17

Look at how large the version you built now. Look at how large the ROM is.

I've generally avoided writing a DFU stand-alone by jumping into the ROM (F2/F4) and using that instead.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Lakshmi Lavanya
Associate II
Dec 9, 2016 5:28 AM UTC
Posted on December 09, 2016 at 05:28

Hi Clive,

Thanks for your reply,

Here i need Run time DFU application for my end product.

So how can i achieve this without Bootloader mode and jumping into the ROM means? 

In the standalone example they said that DFU code is in Flash memory (Starting location).

Can you please explain me how the stand alone DFU works.

Lakshmi Lavanya
Associate II
Dec 12, 2016 9:26 AM UTC
Posted on December 12, 2016 at 10:26

To get the DFU mode at run time, do i need two applications (one for DFU and one for actual application)?

In single application, how can i achieve the DFU mode?

Is any one did this before, if so can you please explain about run time DFU.

Lakshmi Lavanya
Associate II
Dec 13, 2016 6:31 AM UTC
Posted on December 13, 2016 at 07:31

Can any body give suggestions on this?

How to get the DFU run time with DFU class enabled.

Manikandan K
Associate III
Jul 14, 2017 10:04 AM UTC
Posted on July 14, 2017 at 12:04

Hi  ,

I'm also trying to implement Run Time DFU via USB in STM32F207ZG port but I can't able to get proper document for that, 

Any suggestion ? Pls share your Ideas...

With Thanks & Regards

K.Manikandan

Tesla DeLorean
Guru
Jul 14, 2017 5:36 PM UTC
Posted on July 14, 2017 at 17:36

This is the mechanism I use on F2/F4 designs to boot into the System Loader's DFU mode

https://community.st.com/0D50X00009XkgH0SAJ

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Manikandan K
Associate III
Jul 15, 2017 9:03 AM UTC
Posted on July 15, 2017 at 09:03

Thanks a lot for your suggestion ,

I can't able to open the above link which you already share.

Akos Pasztor
Visitor II
Jul 20, 2017 8:37 AM UTC
Posted on July 20, 2017 at 10:37

Hi,

Check out my self-made bootloader. It does not require to utilize the BOOT pins, it features firmware update from an SD card, and also provides possibility to jump and launch the built-in st-bootloader (tested and works in DFU mode).

https://github.com/akospasztor/stm32-bootloader

 
Manikandan K
Associate III
Jul 20, 2017 12:05 PM UTC
Posted on July 20, 2017 at 12:05

Hi ,

Thanks for your reply , In Nucleo-F207ZG SD card provision is not available so I'm trying to update using DFU mode only not with SD card. If you have example code for that means pls share it

Akos Pasztor
Visitor II
Jul 20, 2017 1:55 PM UTC
Posted on July 20, 2017 at 13:55

In my example, there is a function that implements the jump to the built-in bootloader. (See the description section in readme.md in the above linked github repository.) There is no need to utilize the BOOT pin at all (it can also be connected to the GND, it does not matter). By executing this function ( Bootloader_JumpToSysMem() ) while the USB is connected, the built-in st-bootloader will start in DFU mode. You can read about how the DFU mode works in

'

AN3156' application note. 

Steve H
Associate III
Jul 20, 2017 1:23 PM UTC
Posted on July 20, 2017 at 15:23

For what it's worth, I've implemented a bootloader that doesn't involve DFU at all; instead, it receives boot commands and firmware images through the MCU's communications hardware. This scheme has the advantage that you can implement security on the firmware images you're loading.

If your MCU has an Ethernet interface, you may be able to use an Open Source bootloader; there's an STM32 port of U-Boot, for example.

Tesla DeLorean
Guru
Jul 20, 2017 3:36 PM UTC
Posted on July 20, 2017 at 15:36

u-Boot is probably a bit on the heavy side, I've got loaders fitting in under 16KB, including one that can flash .DFU images from an SD Card.

DFU has appeal from the USB perspective, and not having to write PC side applications. Most things I build have a serial interface, and provide an X-MODEM firmware download method, allowing for standard terminal applications across multiple platforms. The data can packaged and encrypted as desired.

ST has several IAP examples, including Ethernet, Serial, USB Flash stick, etc.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
dtarrago
Associate III
Jul 21, 2017 9:59 AM UTC
Posted on July 21, 2017 at 09:59

Hello.

I also tried to set up DFU run-time functionality through Cube tool: I have set 'Download Firmware Update' in 'USB-DEVICE', in MiddleWares section. I have also set 'Device Only' mode in USB_OTG_FS (Peripherals section). Nevertheless, it does not work. Do you know why? Have you tried to work with this functionality? DFU works when switching on the device having previously set Boot0. But I was expecting DFU to work when plugging USB having the device running in normal mod (and without Boot0 action).