cancel
Showing results for 
Search instead for 
Did you mean: 

STM8L EEPROM Block Programming

lama rowiv
Associate
Posted on June 04, 2018 at 08:05

Hello

I'm use STM8L151G6

I'm trying use block programming as below:

//Unlock EEPROM memory
 FLASH_Unlock(FLASH_MemType_Data);
 while (FLASH_GetFlagStatus(FLASH_FLAG_DUL) == RESET);
 
 FLASH_ProgramBlock(0, FLASH_MemType_Data, FLASH_ProgramMode_Standard, buffer);
 while(FLASH_GetFlagStatus(FLASH_FLAG_HVOFF) == RESET);�?�?�?�?�?�?

But cpu always stops inside FLASH_ProgramBlock function, between instructions :

/* Standard programming mode */
 FLASH->CR2 |= FLASH_CR2_PRG;�?�?

and

/* Copy data bytes from RAM to FLASH memory */
 for (Count = 0; Count < FLASH_BLOCK_SIZE; Count++)
 {
#if defined (STM8L15X_MD) || defined (STM8L15X_MDP)
 *((PointerAttr uint8_t*) (uint16_t)startaddress + Count) = ((uint8_t)(Buffer[Count]));
#elif defined (STM8L15X_HD)
 *((PointerAttr uint8_t*) (uint32_t)startaddress + Count) = ((uint8_t)(Buffer[Count]));
#endif
 }�?�?�?�?�?�?�?�?�?

Therefore, I ask for help.

#stm8l #eeprom
0 REPLIES 0