Content originally posted in LPCWare by ashgupta28 on Wed Jan 28 03:06:24 MST 2015
[color=#036]Hello,
I am trying to use SPIFI interface LPC18xx with SST26VF032 Quad Flash chip.
I have added the public function "SPIFI_DEV_FAMILY_T *SPIFI_REG_FAMILY_SST_2Byte_PStatus(void) " in file spifilib_fam_spa_2b_pstat.c
{
static SPIFI_DEV_FAMILY_T handle;
static SPIFI_FAM_DESC_T desc;
/* Store the device specific info so it can be returned */
desc.pFamName = "Micrchip SST26VF032 based family";
desc.pDevList = &devHead;
desc.prvDataSize = PRVDATASIZE;
desc.pPrvDevGetID = deviceGetID;
desc.pPrvDevSetup = devSetup;
desc.pPrvDevRegister = devRegister;
/* Save the descriptor in the handle */
handle.pDesc = &desc;
/* Make sure that the base list is empty and the count reflects 0 */
devHead.pNext = NULL;
devCount = 0;
{
static const SPIFI_DEV_PDATA_T pData = {
"SST26VF032",
{{0xBF, 0x26, 0x02}, 0, {0}},/* JEDEC ID, extCount, ext data */
64,/* # of blocks */
0x10000,/* block size */
0, /* # of sub-blocks 32 (This device only has sub-block erase in first/last 2 blocks) */
0, /* sub-block size 0x1000 */
0x100,/* page size */
32768,/* max single read bytes */
40000000,/* max clock rate in Hz */
(SPIFI_CAP_QUAD | SPIFI_CAP_NOBLOCK)/* capabilitites */
};
static SPIFI_DEV_DATA_T data;
data.pDevData = &pData;
devRegister(&handle, &data);
}
/* finally return the handle */
return &handle;
}
I AM SUCCESSFULLY READING JDEC ID from the function "static void deviceGetID(uint32_t spifiAddr, SPIFI_DEVICE_ID_T *pID)"
BUT OTHER THAN THAT ALL THE REGISTERS(STATUS REGISTERS, SEC ID), I AM ALWAYS GETTING 0xFF values. I guess my set up is correct as i am able to read JDEC ID with the following function
static void deviceGetID(uint32_t spifiAddr, SPIFI_DEVICE_ID_T *pID)
{
uint8_t idx;
LPC_SPIFI_CHIPHW_T *pSpifiCtrlAddr = (LPC_SPIFI_CHIPHW_T *) spifiAddr;
/* Read ID command, plus read 3 bytes on data */
spifi_HW_SetCmd(pSpifiCtrlAddr,
(SPIFI_CMD_OPCODE(CMD_RDID) |
SPIFI_CMD_DATALEN(3 + pID->extCount) |
SPIFI_CMD_FIELDFORM(SPIFI_FIELDFORM_ALL_SERIAL) |
SPIFI_CMD_FRAMEFORM(SPIFI_FRAMEFORM_OP)));
/* Get info from the device */
pID->mfgId[0] = spifi_HW_GetData8(pSpifiCtrlAddr);/* Manufacturers ID */
pID->mfgId[1] = spifi_HW_GetData8(pSpifiCtrlAddr);/* Memory Type */
pID->mfgId[2] = spifi_HW_GetData8(pSpifiCtrlAddr);/* Memmory Capacity */
DEBUGOUT("DEVICE ID: 0x%x 0x%x 0x%x\n", pID->mfgId[0],pID->mfgId[1],pID->mfgId[2]);
/* Read the specified number of extended bytes */
for (idx = 0; idx < pID->extCount; ++idx) {
pID->extId[idx] = spifi_HW_GetData8(pSpifiCtrlAddr);
}
spifi_HW_WaitCMD(pSpifiCtrlAddr);
}
HERE I AM GETTING CORRECT VALUES 0xBF, 0x26, 0x02 BUT in this function while reading status register with command 0x05 :- I AM GETTING 0xFF values
static uint8_t prvGetStatusRegister(LPC_SPIFI_CHIPHW_T *pSpifiCtrlAddr)
{
uint8_t statRegister;
spifi_HW_SetCmd(pSpifiCtrlAddr,
(SPIFI_CMD_OPCODE(CMD_RDSR) |
SPIFI_CMD_DATALEN(1) |
SPIFI_CMD_FIELDFORM(SPIFI_FIELDFORM_ALL_SERIAL) |
SPIFI_CMD_FRAMEFORM(SPIFI_FRAMEFORM_OP)));
statRegister = spifi_HW_GetData8(pSpifiCtrlAddr);
DEBUGOUT("READ Status RAW DATA: 0x%x\n", statRegister);
/* Wait for command to complete */
spifi_HW_WaitCMD(pSpifiCtrlAddr);
return 0;
}
PLEASE HELP
THANKS,
Ashish Gupta[/color]