Page 1 of 1

m058 write dataflash many times will crash

Posted: 15 Aug 2019, 19:32
by shizheng080
hello
my m058 is no OS, W/R dataflash Success,But there is one problem:write dataflash many times the m058 will crash .please,how solve this problem?
Code as follows:
int32_t FMC_WriteData(uint32_t *u32Config, uint32_t u32Count,uint32_t page)
{
int32_t i;
__set_PRIMASK(1);
SYS_UnlockReg();
FMC_Open();//Enable FMC ISP function
FMC_EnableLDUpdate();
FMC_Erase(FMC_DATAFLASH_BASE + page * PAGE_SIZE);

for(i = 0; i < u32Count; i++)
{
FMC_Write(FMC_DATAFLASH_BASE + page * PAGE_SIZE + i * 4, u32Config);
if(FMC_Read(FMC_DATAFLASH_BASE + page * PAGE_SIZE + i * 4) != u32Config)
return -1;
}
FMC_Close();//Disable ISP Functions
SYS_LockReg();
__set_PRIMASK(0);
return 0;
}

Re: m058 write dataflash many times will crash

Posted: 16 Aug 2019, 11:09
by shizheng080
#define PAGE_SIZE 512
#define FMC_DATAFLASH_BASE 0x0001F000
#define DATAFLASH_SIZE 0x00001000