m058 write dataflash many times will crash

Post Reply
shizheng080
Posts: 2
Joined: 15 Aug 2019, 18:48

15 Aug 2019, 19:32

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;
}

shizheng080
Posts: 2
Joined: 15 Aug 2019, 18:48

16 Aug 2019, 11:09

#define PAGE_SIZE 512
#define FMC_DATAFLASH_BASE 0x0001F000
#define DATAFLASH_SIZE 0x00001000

Post Reply
  • Information
  • Who is online

    Users browsing this forum: yvettenp4 and 1 guest