AnsweredAssumed Answered

USB DFU detection works in STM32F407 Discovery but dosenot work with STM32F439xx after calling from user application

Question asked by TRIVEDI.RUTVIJ on Jan 28, 2016
Latest reply on Jun 14, 2018 by waclawek.jan
Hello all,
I am working to call the ROM residing USB DFU bootloader in STM32F439XX.
I have made a sample code and tested into the STM32f407 - Discovery KIT and it works fine and sucfully jumps to the location of ROM and finds the USB DFU device into Device manager and i also can upload binaries in this configuration, but same thing dos not work for STM32F439XX MCU.

However in IAR debugging it can be seen that it enters into the ROM bootloader but device manager dose not detects any USB Device.

my sample code is as per below,

#include "stm32f4xx.h"
#include "stm32f4_discovery.h"
/*================================Macro definitions=================*/
#define BOOTLOADER_ADDRESS     0x1fff0004
#define __SP                   0x20001000
/*Below stack pointer is taken after debugging into IAR assembly mode and found  0x1fff0004
 location to contain valid stack pointer which has been taken here,but even after commenting below line it dose not work */
//#define __SP                   0x20002d40
/*================================Function declarations =================*/
typedef  void (*pFunction)(void);
pFunction Jump_To_Bootloader;
__IO uint32_t JumpAddress ;
void Delay(__IO uint32_t nCount) ;
void BootLoaderinit();
void Hal_init();
void Hal_Deinit();
int main()
  //Enable LEDs and Buttons
  while (1)
   //Wait for button to be pressed to proceed into bootloader mode
    if (STM_EVAL_PBGetState(BUTTON_USER) == Bit_RESET)
      //LEDs to indicate bootloader mode
    // If button is not pressed do continue work in user application
//  return 0;
/*================================S/W delay =================*/
void Delay(__IO uint32_t nCount)
/*================================Jump to bootloader=================*/
void BootLoaderinit()
    // deinit LEDs and buttons
    * @brief  Resets the RCC clock configuration to the default reset state.
    * @note   The default reset state of the clock configuration is given below:
    *            - HSI ON and used as system clock source
    *            - HSE, PLL and PLLI2S OFF
    *            - AHB, APB1 and APB2 prescaler set to 1.
    *            - CSS, MCO1 and MCO2 OFF
    *            - All interrupts disabled
    * @note   This function doesn't modify the configuration of the
    *            - Peripheral clocks
    *            - LSI, LSE and RTC clocks
    * @param  None
    * @retval None
    //Remap ROM (System memory) to ZERO
    //Reset systick counts
    SysTick->CTRL =0;
     /* Jump to user application */
    JumpAddress = *(__IO uint32_t*)(BOOTLOADER_ADDRESS);
    Jump_To_Bootloader = (pFunction) JumpAddress;
    /* Initialize user application's Stack Pointer */
    __set_MSP(*(__IO uint32_t*) __SP);
      // should not land up here
void Hal_init()
void Hal_Deinit()

My clock configurations are as per below,

SystemCoreClock = 168000000;
#define PLL_M      24          
#define PLL_N      336
#define PLL_P      2
#define PLL_Q      7 //
#define HSE_VALUE    ((uint32_t)25000000) //for 25MHz

Now i don't understand what happening here , as its works fine in Discovery board and not in my custom(STM3F439xx) board,

To make sure its not hardware issue i tried to pull up the Boot0 pin into my STM3F439xx but then it detects USB in DFU mode.

So what is there which being done by Boot0 pin and is not there in my software code.?

Requested to guide me here.
Any help in this topic would be greatly appreciated.

Thank you !