2016-12-08 05:07 AM
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.2017-07-20 05:05 AM
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
2017-07-20 06:05 AM
Ok, but if the new DFU file writes at 0x08000000 won't it overwrite and corrupt the code you have running. Determine how large your DFU loader app is, and then write your new image in at 0x08010000 or something like that.
2017-07-20 06:23 AM
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.
2017-07-20 06:55 AM
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.
2017-07-20 07:17 AM
Thanks a lot , Now i can jump into bootloader . But the problem is i cant able to jump into flash memory from DFU mode.
2017-07-20 07:32 AM
Yes I have achieved with the help of
Turvey.Clive.002
andPasztor.Akos
In Main Program :
uint8_t usr_btn_status = 0;
#define SYSMEM_ADDRESS (uint32_t)0x1FFF0000 /* Address of System Memory (ST Bootloader) */
/* Private typedef -----------------------------------------------------------*/ typedef void (*pFunction)(void);while (1) {
usr_btn_status = HAL_GPIO_ReadPin(GPIOC, USER_Btn_Pin); if (usr_btn_status == 1) {HAL_Delay(1000);
Bootloader_JumpToSysMem(); } }void BoodLoaderInit(uint32_t BootLoaderStatus) {
SysMemBootJump = (void (*)(void)) (*((uint32_t *) 0x1fff0004));
if (BootLoaderStatus == 1) {
HAL_RCC_DeInit();
SysTick->CTRL = 0; SysTick->LOAD = 0; SysTick->VAL = 0;__set_MSP(0x20000000);
SysMemBootJump();
while (1)
; } }======================================================================================
Before pressing the user button:
kmani@kmani:~$ dfu-util --list
dfu-util 0.8Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt This program is Free Software and has ABSOLUTELY NO WARRANTY Please report bugs tomailto:dfu-util@lists.gnumonks.org
After pressing the user button:
kmani@kmani:~$ dfu-util --list
dfu-util 0.8Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt This program is Free Software and has ABSOLUTELY NO WARRANTYPlease report bugs to
mailto:dfu-util@lists.gnumonks.org
Found DFU: [0483:df11] ver=2200, devnum=47, cfg=1, intf=0, alt=3, name='@Device Feature/0xFFFF0000/01*004 e', serial='377D38603335'
Found DFU: [0483:df11] ver=2200, devnum=47, cfg=1, intf=0, alt=2, name='@OTP Memory /0x1FFF7800/01*512 e,01*016 e', serial='377D38603335' Found DFU: [0483:df11] ver=2200, devnum=47, cfg=1, intf=0, alt=1, name='@Option Bytes /0x1FFFC000/01*016 e', serial='377D38603335' Found DFU: [0483:df11] ver=2200, devnum=47, cfg=1, intf=0, alt=0, name='@Internal Flash /0x08000000/04*016Kg,01*064Kg,07*128Kg', serial='377D38603335'Upload the .bin file in the Flash memory location (0x0800 0000) and leave the DFU mode
kmani@kmani:~$ dfu-util -a 0 -s 0x08000000:leave -D /home/kmani/ARM_Toolchain/workspaceARM/USB_CDC_VCP/Debug/USB_CDC_VCP.bin dfu-util 0.8Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt This program is Free Software and has ABSOLUTELY NO WARRANTYPlease report bugs to
mailto:dfu-util@lists.gnumonks.org
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 = 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 = 17452 Download [=========================] 100% 17452 bytes Download done. File downloaded successfully Transitioning to dfuMANIFEST stateNow check the DFU attached device, its not available
kmani@kmani:~$ dfu-util --list dfu-util 0.8Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt This program is Free Software and has ABSOLUTELY NO WARRANTYPlease report bugs to
mailto:dfu-util@lists.gnumonks.org
With Thanks & Regards
K.Manikandan
2017-07-20 07:50 AM
__set_MSP(0x20000000); // This isn't what you want, don't want bottom of memory descending downward
Something like 0x20002000 would be better, code doesn't remap ROM either.
2017-07-20 08:36 AM
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.
2017-07-21 02:59 AM
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).
2017-07-25 07:18 AM
Hi,
What kind of clock source you used HSE or HSI ?
DFU run-time functionality through Cube tool is working for me in Nucleo-F207ZG , but i cant able to jump into user program properly , so I preferred USB-CDC in that method I can able to switch to DFU mode using user button or command (without BOOT0/BOOT1 pin).