I'm using 51822 QFAC, SDK11 S130 2.0.0.
I'm able to write to flash using fstorage_write() below. But the problem is whenever I put a for loop after I call fstorage_write(), the code will totally freeze. If I put the for loop before fstorage_write(), everything is ok. What is problem with this? thanks a lot!
void fstorage_write(uint32_t fdata[], uint16_t arraySize, uint8_t const offsetPage )
{
static uint32_t data[256];
for(int i=0;i<arraySize;i++){
data[i] = fdata[i];
}
fs_erase(&fs_config, (uint32_t)(fs_config.p_start_addr+offsetPage*256), 1);
while(fs_callback_flag == 1)
{
app_sched_execute();
power_manage();
}
fs_store(&fs_config, (uint32_t)(fs_config.p_start_addr+offsetPage*256), data, 256);
while(fs_callback_flag == 1)
{
app_sched_execute();
power_manage();
}
}
myFunc(){
fstorage_write(myData, size, page);
for(int i=0;i<size;i++){ <====== a for loop after fstorage_write freeze the code!
myData[i] =0;
}
}