cancel
Showing results for 
Search instead for 
Did you mean: 

USB-DFU example bug (STM32H7)

TDJ
Lead

I am showing that USB-DFU example available in latest CubeMX STM32Cube_FW_H7_V1.9.0 package (/Projects/NUCLEO-H7A3ZI-Q/Applications/USB_Device/DFU_Standalone) does not work. The example contains this code:

/* Test if user code is programmed starting from address 0x0800C000 */
if (((*(__IO uint32_t *) USBD_DFU_APP_DEFAULT_ADD) & 0x2FFC0000) == 0x20000000)
{
  /* Jump to user application */
  JumpAddress = *(__IO uint32_t *) (USBD_DFU_APP_DEFAULT_ADD + 4);
  JumpToApplication = (pFunction) JumpAddress;
 
  /* Initialize user application's Stack Pointer */
  __set_MSP(*(__IO uint32_t *) USBD_DFU_APP_DEFAULT_ADD);
  JumpToApplication();
}

The above code first verifies that the stack pointer address is in RAM address space - between 0x20000000 and 0x2003FFFF (256k).

For STM32H7A3ZI this is incorrect because "regular" RAM (not DTCRAM) starts at address 0x24000000 and is 1024k large.

CubeMX generated app based on this package templates for this board (NUCLEO-H7A3ZI-Q) has initial stack pointer address=0x24100000 (_estack in the linker script) so this example cannot possibly work with CubeMX-generated app for this board. "NUCLEO-H7A3ZI-Q_LED_Toggle_@0x0800C000.dfu" binary included with this example created with/for "STSW-STM32080 - DfuSe USB device firmware upgrade extension" cannot be used since STM32080 is no longer supported and does not work with recent version of Windows 10. CubeProgrammer is the the currently supported/recommended tool and CubeProgrammer does not handle .dfu files.

  1. Dear ST, please stop publishing untested code!
  2. Please stop publishing CubeMX MPU packages containing outdated examples which were NOT ported to the package version containing them!
  3. Please include full build steps. This particular example is missing HAL Driver and BSP file(s). It is not mentioned in readme.txt. Not to mention BSP seems to be out-of-fashion and CubeMX does not even include it with created projects.
  4. Please always include CubeMX .ioc file with examples, make sure "generate code" option invoked from CubeMX does not break anything. In this case it does because example is based on outdated templates generating files named differently - e.g. usbd_dfu_flash.h vs usbd_dfu_if.h.
  5. Include only additional or modified source code files (USER CODE sections). The remaining project content should be re-created with CubeMX based on included .ioc file settings. Only this approach guarantees example source code consistency with the current package/templates version.

#STM32CubeMX​ #USB​ #[STM32 MCUs]​

3 REPLIES 3

Hello @TJast​ ,

This issue has been raised internally for verification. We will give you an update as soon as possible.

Thanks for your contribution and patience.

BeST regards,

Walid

 Internal ticket number : 113513 (PS: This is an internal tracking number and is not accessible or usable by customers). 

TDJ
Lead

@Walid ZRELLI​ Thank you, two more items added to my "petition".