AnsweredAssumed Answered

Execution problem in Upgrading STM32F4DISCOVERY board firmware using a USB key

Question asked by n.abhishek.001 on Mar 28, 2017
Latest reply on Mar 28, 2017 by Clive One

I am trying to execute the example program given by ST for firmware update using USB, I'm able to download and upload the binary image but the jump is not working properly. After the new program has flashed onto new location(sector 2), my Program Counter(PC) is supposed to  jump to location 0x08008000, but it is getting stuck in some infinite loop. Can someone help me to sort this out asap please..

       Below is the piece of code i'm using..



#include "usbh_core.h"
#include "usbh_usr.h"
#include "usbh_msc_core.h"
#include "flash_if.h"


pFunction Jump_To_Application;
uint32_t JumpAddress;

int main(void)
/* STM32 evalboard user initialization */

/* Flash unlock */

/* Test if User button on the Discovery kit is pressed */
/* Check Vector Table: Test if user code is programmed starting from address
if (((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0x2FFE0000 ) == 0x20000000)
/* Jump to user application */
JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4);
Jump_To_Application = (pFunction) JumpAddress;
/* Initialize user application's Stack Pointer */
__set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS);
__set_PSP(*(__IO uint32_t*) APPLICATION_ADDRESS);


/* Init Host Library */
USBH_Init(&USB_OTG_Core, USB_OTG_FS_CORE_ID, &USB_Host, &USBH_MSC_cb, &USR_Callbacks);

while (1)
/* Host Task handler */
USBH_Process(&USB_OTG_Core, &USB_Host);

* @brief assert_failed
* Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* @param File: pointer to the source file name
* @param Line: assert_param error line source number
* @retval None
void assert_failed(uint8_t* file, uint32_t line)
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

/* Infinite loop */
while (1)