cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F2 nucleo board not leaving DFU mode.

Pranay Dhuri
Associate II
Posted on May 16, 2017 at 12:47

I am using DFU source code for nucleo board available in STM32F2Cube.I have generated .dfu file from existing GPIO code. but when i am upgrading the dfu file into nucleo board it is showing as upgrade successful and after clicking on leave DFU mode it is indicating successfully left DFU mode but it is again coming back to DFU mode.

I am using

-SW4STM32 for generating binary/hex

-DfuSeDemo v3.0.5

-while converting from bin to dfu i am giving address as 0x08008000

Note: this post was migrated and contained many threaded conversations, some content may be missing.
1 ACCEPTED SOLUTION

Accepted Solutions
Posted on May 16, 2017 at 14:22

Try to update this code on the main.c of the DFU application as below:

/* Test if user code is programmed starting from address 0x0800C000 */

if(((*(__IO uint32_t*)USBD_DFU_APP_DEFAULT_ADD) & 0x2FFE0000 ) == 0x20000000)

to this line:

/* Test if user code is programmed starting from address 0x0800C000 */

if(((*(__IO uint32_t*)USBD_DFU_APP_DEFAULT_ADD) & 0x2FFC0000 ) == 0x20000000)

Please, keep me informed then about your updates.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

View solution in original post

8 REPLIES 8
Imen.D
ST Employee
Posted on May 16, 2017 at 13:21

Hi

Dhuri.Pranay

,

WhichPlatform used (board, device, how USB is connected on the board) ?

Check the sector count !

It maybe causes the problem or probablyyou have issue on the file you are using.

So, please make sure to use a correct .dfu file, to perform download and verify before Leave DFU mode.

If you are using

STM32F207ZG-Nucleo, y

ou can find a reference .dfu file on the last version of Cube firmware STM32CubeF2 v1.4.0:

STM32Cube_FW_F2_V1.4.0\Projects\STM32F207ZG-Nucleo\Applications\USB_Device\DFU_Standalone\Binary

I hope this helps you.

Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on May 16, 2017 at 13:57

Hi....dfu file which is provided in STM32cubeF2 is working for me but my generated dfu files giving problem...i have attached  dfu file.

Posted on May 16, 2017 at 14:22

Try to update this code on the main.c of the DFU application as below:

/* Test if user code is programmed starting from address 0x0800C000 */

if(((*(__IO uint32_t*)USBD_DFU_APP_DEFAULT_ADD) & 0x2FFE0000 ) == 0x20000000)

to this line:

/* Test if user code is programmed starting from address 0x0800C000 */

if(((*(__IO uint32_t*)USBD_DFU_APP_DEFAULT_ADD) & 0x2FFC0000 ) == 0x20000000)

Please, keep me informed then about your updates.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on May 16, 2017 at 14:37

Hi Imen,

I have updated the code to the code that you have mentioned, now it is able to leave the DFU mode but upgraded code is not running...binary file which i am converting to dfu is working alone ,no issues with .bin

Posted on May 16, 2017 at 14:44

Hi

Dhuri.Pranay

,

Be sure you are updating the

USBD_DFU_APP_DEFAULT_ADD

in theusbd_conf.h

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on May 16, 2017 at 15:01

Yes, I have updated USBD_DFU_APP_DEFAULT_ADD as well as updated FLASH origin to 0x0800C000 in linker script (.ld file) and also set address as 0x0800C000 while bin to dfu conversion but still not running gpio code.

Posted on May 16, 2017 at 15:11

Please set the vector Table to 

0xC00 instead of 0x00 i

n the system_stm32f2xx.c file of your project

&sharpdefine VECT_TAB_OFFSET  0x00

Edit: Sorry, I means 

vector Table should be 

0xC000

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on May 16, 2017 at 15:45

After setting vector table to 0xC00 and Flash base address to 0x0800C000 (SCB->VTOR = 0x0800C000 | VECT_TAB_OFFSET;)

upgraded code is running but while verifying in DfuseDemo it is indicating

matching not good. first difference at address 0x0800C004

File byte is 0x

Read byte is 0x9D