Content originally posted in LPCWare by lintovincent88 on Thu Mar 26 01:54:24 MST 2015
Hi,
There is small problem in my spifi flash program. i can write and read the data into flash one time, when am write again int that address again i am getting 0.writing into same address results zero.and not the updated value. iam using LPC xpresso and processor is LPC 4088.
flash = S25FL127SABMFI101. am using prebuilt library for spifi. Below is the program part am used for spifi read/write. please tell me if there is anything i have to do in this code.
spifi_io_clk_init(); //pin initialisn
LPC_SC->SPIFICLKSEL |= 0x00000102; //clock selection
errCode = spifiInit(LPC_SPIFI_BASE, true); //LPC_spifi base is =0x20094000UL
spifiRegisterFamily(spifi_REG_FAMILY_CommonCommandSet);
memSize = spifiGetHandleMemSize(LPC_SPIFI_BASE);
if (memSize == 0)
{
/* No device detected, error */
return (SPIFI_ERR_GEN);
}
pSpifiHandle = spifiInitDevice(&lmem, sizeof(lmem), LPC_SPIFI_BASE,SPIFLASH_BASE_ADDRESS);
//SPIFLASH_BASE_ADDRESS =0x2800 0000
if (pSpifiHandle == NULL)
{
return (SPIFI_ERR_GEN);
}
/* Get some info needed for the application */
maxSpifiClock = spifiDevGetInfo(pSpifiHandle, SPIFI_INFO_MAXCLOCK);
/* turn on memmode on for default */
spifiDevSetMemMode(pSpifiHandle, true);
spifiDevSetOpts(pSpifiHandle,SPIFI_OPT_USE_QUAD,1);
spifiDevUnlockDevice(pSpifiHandle);
errCode = spifiProgram(pSpifiHandle,SPIFLASH_BASE_ADDRESS1,data_X,sizeof data_X);
errCode = spifiRead(pSpifiHandle,SPIFLASH_BASE_ADDRESS1,data_R,sizeof data_R);
thanks and regards
Linto