AnsweredAssumed Answered

STM32F2 Erasing Flash kicks out my Debugger (Raisonance R-Link)

Question asked by elliott.grant on Apr 3, 2015
Latest reply on Apr 5, 2015 by AvaTar
Hi there

I have a slightly irritating issue where I am erasing a block of flash memory and while erasing it always kicks my debugger out.  I get a "Debugger has lost communication message"

I am using an STM32F207VCT6 running Ride7 with the R-Link debugger connected to SWD.  

The problem occurs while waiting for the Busy Flag in the Flash Status register to clear.  The offending section of code is in the FLASH_WaitForLastOperation section of the stm32f2xx_flash StdPeriph Driver, just after the erase has been initiated.

  /* Wait for the FLASH operation to complete by polling on BUSY flag to be reset.
     Even if the FLASH operation fails, the BUSY flag will be reset and an error
     flag will be set */
  while(status == FLASH_BUSY)
  {
    status = FLASH_GetStatus();
  }


The code continues to run, it just kicks out my debugger.  I have tried:

- Disabling interrupts
- Running the Flash routines in RAM
- Querying the busy flag manually (not using FLASH_GetStatus)

No joy.  If I single step it is fine.

This is not a show stoppper but is rather annoying and I was wondering if anyone else has had a smiliar issue and solved it?  Sounds like some kind of timeout in the R-Link but it would be great to be sure.

Thanks and regards
Grant

Outcomes