cancel
Showing results for 
Search instead for 
Did you mean: 

STM32f027B discovery board, Keil uVision 5.23 MDK and FLASH_EraseProgram

John Davis_2
Associate II
Posted on March 29, 2017 at 22:26

I'm working with STM32f027B discovery board, Keil uVision 5.23 MDK and the  FLASH_EraseProgram FLASH Erase and Program example.  When I try to step through the flash programming example in the debugger, it disconnects from the debugger when it executes the first HAL routine associated with Flash.  The precise routine is HAL_FLASHEx_Erase() .  Once that line is executed, the IDE displays a message 'Cannot access target.  Shutting down debug session' and then the debugger detaches.  Any idea how to modify the example code so I can run it in the MDK debugger?

#flash #stm32f027 #keil-ide #hal-library
2 REPLIES 2
Nesrine M_O
Lead II
Posted on March 30, 2017 at 11:14

Hi

netskink

,

  • Are you using theFLASH_EraseProgram example from the STM32F0cube firmawre package?
  • If yes, could you please precise the HAL version in which you have found the issue. So, we can verify it.

-Nesrine-

John Davis_2
Associate II
Posted on March 30, 2017 at 15:23

Hello Nesrine,

Yes, I'm using the example from the STM32F0cube installed samples.  This is from the code header of the code which does the HAL call.:

******************************************************************************

* @file FLASH/FLASH_EraseProgram/Src/main.c

* @author MCD Application Team

* @version V1.7.0

* @date 04-November-2016

* @brief This example provides a description of how to erase and program the

* STM32F0xx FLASH.

******************************************************************************

This is the code in HAL which performs the call which fails:

******************************************************************************

* @file stm32f0xx_hal_flash_ex.c

* @author MCD Application Team

* @version V1.5.0

* @date 04-November-2016

* @brief Extended FLASH HAL module driver.

If I step over this line in main.c 

if (HAL_FLASHEx_Erase(&EraseInitStruct, &PageError) != HAL_OK)

then it drops the debug session.

If I instead step into the same line and then step over each of the calls in the flash erase routine, then it will work and eventually step out of the routine and I can debug the rest of the code.

I have a question on stackoverflow for this as well.  Its here if anyone is interested:

http://iot.stackexchange.com/questions/1299/keil-uvision-mdk-lite-stm32f072b-discovery-board-and-flash-api?noredirect=1#comment2258_1299