AnsweredAssumed Answered

STM32L Flash HalfPageProgram problem

Question asked by Jorgensen.Martin on Apr 18, 2015
Latest reply on Jan 27, 2017 by Jorgensen.Martin
Hi,

I am not able to program the flash of a STM32L151RC using "half page" programming.
Normal programming (word by word) works fine.

I have tried it using the 2 latest GCC compilers (4.8.4), and I have tried with the 2 latest HAL drivers (1.1.0 and 1.1.1).

The code below stops working when the 32 words are being written to flash. The debugger stops working. When running the code without a debugges, it also doesn't work.

Am I the only one with this observation?

Best regards
Martin

HAL_FLASH_Unlock();

__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_WRPERR);
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_PGAERR);
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_SIZERR);
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_OPTVERR);
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_OPTVERRUSR);
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_RDERR);

uint32 data[32] = { 0 };
if (HAL_FLASHEx_HalfPageProgram(0x08004000, data) == HAL_OK)
{
// Success
}
else
{
// Error
}

Outcomes