-->
Page 1 of 1

erase 256 sectors in one time

PostPosted: Sat Nov 14, 2015 2:06 am
by huppyuy
I want to erase 256 sectors in a loop. And I have disabled the wdt using pp_soft_wdt_stop and pp_soft_wdt_restart.

But the chip reboot randomly in the loop.

Here is my code
Code: Select all#define COFFEE_START 0x200000UL
#define COFFEE_SECTOR_SIZE 0x1000UL

pp_soft_wdt_stop();

  for(i = 0; i < COFFEE_SECTOR_COUNT; i++) {
   printf("%d\n",i);
   //clock_delay(100000UL);
   while(SPI_FLASH_RESULT_OK!=spi_flash_erase_sector((uint16)((COFFEE_START/COFFEE_SECTOR_SIZE)+(i))));
  }

  pp_soft_wdt_restart();


And there is serial output
Code: Select allformat: formatting file system, please wait...
0
1
2
3
4
5
6
7
8
Fatal exception (0):
epc1=0x40234d94, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000


Even I delay 100000us is not help. Sometime the sector number will up to 81.But total is 256.
So what is the problem