2024-02-26 12:49 AM
static void EEPROM_WriteBytes(u32 Addr, u8 *Buffer, u16 Length)
{
u8 *wAddr = NULL;
wAddr = (u8 *)Addr;
DIS_INT;
FLASH->PEKEYR = PEKEY1; // unlock // this is Program stuck
FLASH->PEKEYR = PEKEY2;
while(FLASH->PECR & FLASH_PECR_PELOCK); // wait PELOCK set 0(unlocked)
FLASH->PECR |= FLASH_PECR_FTDW; // not fast write
while(Length--)
*wAddr++ = *Buffer++;
while(FLASH->SR & FLASH_SR_BSY);
FLASH->PECR |= FLASH_PECR_PELOCK; // lock
EN_INT;
}
2024-03-24 12:40 AM
Dear @chench ,
Can you please let us know if the sequence above is working and you advance on the programming . in general it is not recommended to have the Flash keys in same Write / Programming function to avoid an accidental jump to it . May be to move outside
Let us know .
STOne-32