cancel
Showing results for 
Search instead for 
Did you mean: 

DFU image for Custom_HID

david23
Associate II
Posted on December 03, 2013 at 20:19

Hello,

I am working on a STM3210E-EVAL with the Device_Firmware_Update project from the USB full speed device library (STSW-STM32121).

With the dfu bootloader, I am able to program into flash the STM3210E-EVAL_CustomHID.dfu located in STM32_USB-FS-Device_Lib_V4.0.0\Utilities\DFU_images.

After reset, the evaluation board is recognized as an USB HID device.

Next step is to try to create a DFU image.

To do so, I have successfully flashed a dfu image based on the binary_template project located in STM32_USB-FS-Device_Lib_V4.0.0\Projects\Device_Firmware_Upgrade :

1)    build the hex from binary_template project

2)    convert the hex into dfu with DfuFileMgr.exe

3)    flash the dfu image into flash with DfuSeDemo.exe

However I have some troubles applying the same procedure with the Custom_HID project located in STM32_USB-FS-Device_Lib_V4.0.0\Projects

The issue lies in  step 1) above, ie the building of the hex image.

According to the binary_template project, two things are needed to build a binary for a dfu image:

-          set the flash start address at 0x08003000 in the linker

-          set the vector table at the top  of the Flash space 0x8003000 : NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x3000)

Those two changes are confirmed by ST FAQ :

/public/Faq/Lists/faqlst/DispForm.aspx?ID=14&level=1&objectid=141&type=product

Applying those changes to the Custom_HID project lead to a failure when the evaluation board is attached to a PC: the usb device is not recognized properly.

What am I missing to adapt the Custom_HID project for a dfu image?

#dfu
2 REPLIES 2
david23
Associate II
Posted on December 04, 2013 at 11:08

I guess the problem lies in the interrupt mechanism.

To check this, I have added the blinked leds from binary_template to the Custom_HID project.

When this program starts from address 0x08003000 with the usb cable unplugged, the leds are blinking as expected.

This means the interrupt timer is working correctly.

As soon as I plug the usb cable, the USB enumeration fails.

With an usb analyser, one can see that the first Control Tranfer does not succeed.

The ACK from the stm32 is missing in the SETUP transaction (see attached files).

In addition, the leds stop blinking, showing the timer interrupt is not working anymore.

________________

Attachments :

USB_trace-Custom_HID_0x08000000.png : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I1Ho&d=%2Fa%2F0X0000000bkn%2F93sAXLUmpyv83FIUUmhGhWp6_soT_yJecz7OGC2nogk&asPdf=false

USB_trace-Custom_HID_0x08003000.png : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I1H1&d=%2Fa%2F0X0000000bkl%2Ft8QwqIAY.CKwP5CAsv2.IMLgQYdiPNsYdtHAdjtSN3s&asPdf=false
david23
Associate II
Posted on December 11, 2013 at 12:46

I finally found what was missing.

The relocation of the vector table should not be handled with the function call 

NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x3000) as shown by the binary_template project.

Instead the value of the macro 

VECT_TAB_OFFSET in system_stm32f10x.c has to be set to the proper value: #define VECT_TAB_OFFSET 0x3000