2024-11-08 02:53 AM - last edited on 2024-11-08 03:28 AM by Pavel A.
Hello.
I am creating a program to write data to multiple FLASH memories using the STM32C031.
I have set FLASH page13,14,15 as new pages to be written, but only page13, which is the first page to be rewritten with FLASH, is rewritten, while page14 and 15 are not rewritten properly and the value is only changed to 0x00.
However, if the pages to be written are page12,13,15 or page12,14,15 and one page is skipped, the contents to be written can be successfully written on three consecutive pages.
At this time, the deletion and writing procedures of FLASH use exactly the same program as when it is not possible to write.
Is there anything we can do to make it so that we can successfully write on three consecutive pages?
Best Regards,
void Write(){
uint16_t i;
__disable_irq();
huart1.Instance->CR1 &= ~0x04;
FLASH_UNLOCK();
FLASH_DELETE(0x0D);
for(i=0;i<256;i++){
FLASH_Write(0x08006800+i*0x00000008,buff[i+1]);
}
FLASH_DELETE(0x0E);
for(i=0;i<256;i++){
FLASH_Write(0x08007000+i*0x00000008,buff[i+257]);
}
FLASH_DELETE(0x0F);
for(i=0;i<64;i++){
FLASH_Write(0x08007800+i*0x00000008,buff[i+513]);
}
for(i=0;i<4;i++){
FLASH_Write(0x08007B20+i*0x00000008,data[i]);
}
huart1.Instance->CR1 |= 0x04;
__enable_irq();
}