SPIFI Library Source and Micron N25Q128A Flash

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SPIFI Library Source and Micron N25Q128A Flash

1,208 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by visectro on Thu Nov 13 00:53:39 MST 2014
Hi there,

im developing with the NXP LPC4350/70 MCU and trying to incorporate the Micron N25Q128A13ESE40 flash to be accessable for erasing and writing. I've already written an bootloader/firmwareloader to be able to update the firmware stored in flash. This is working for a Spansion FL256S/128S flash. For this i've used the SPIFL Library Source 0.06 beta and adjusted the spifilib_fam_spa_2b_pstat.c driver file so it's working with the Spansion flash i'm using.
Now i've to support the already named Micron N25Q flash. The problem is, there is no similar driver file which fits as good as the Spansion one.
I've already spent time on adjusting the Spansion driver file to support the Micron flash, but until now unsuccsessful. Is there already a cappability of supporting this Micron flash i didn't know about or whats the key parameters i've to consider to make it work.
First of all i've tried to make the deviceGetID() function working, but the flash device doesn't respond so i'll get the id 0xFF ...

Thanks for assistants
best regards sebastian
Labels (1)
0 Kudos
4 Replies

651 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by visectro on Mon Nov 24 07:25:03 MST 2014
Hi there,

is something missing or can i give additional information about the problem?

Anybody there who worked already on this problem?

I'm appreciated about any support.

Thanks a lot
Best regards Sebastian
0 Kudos

651 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by visectro on Mon Nov 17 06:41:40 MST 2014
Hello,

i've also tried the old SPIFI library. It's working with the Micron flash for general.
Is the library also able to work with subsectors? I can't find anything about it in the documentation.

The Micron flash is build up as
- 256 Sectors each 64kByte
- 4096 Subsectors each 4kByte
resulting in 16MByte memory. It is also supporting erase of subsectors.

I've tried to erase one single 4k subsector, but it extended the erase range to a whole 64k sector. So i'll assume that this isn't possible - am i right?

I know the functionality of the scratch parameter, but i'd like to speed up the erase program process for small program sizes and the erase process take so much time...

Thanks a lot
Sebastian

PS: Do anybody know what to do to become the flash device running with the SPIFL Library Source 0.06 beta? There it wouldn't be a problem to access subsectors.
0 Kudos

651 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by visectro on Thu Nov 13 07:42:59 MST 2014
Here is the configuration that i'll use for the Micron N25Q128A Flash:

SPIFI_DEV_FAMILY_T *SPIFI_REG_FAMILY_Micron_2Byte_SStatus(void)
{
  static SPIFI_DEV_FAMILY_T handle;
  static SPIFI_FAM_DESC_T desc;

  /* Store the device specific info so it can be returned */
  desc.pFamName = "Micron N25QxxxA 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;

  {
    /* ID Micron N25Q128A */
    static const SPIFI_DEV_PDATA_T pData = {"N25Q128A", { {0x20, 0xBA, 0x18}, 0, {0}}, /* JEDEC ID, extCount, ext data */
    256, /* # of blocks */
    0x10000, /* block size 64kB */
    4096, /* # of sub-blocks  */
    0x1000, /* sub-block size 4kB */
    0x100, /* page size 256B */
    32768, /* max single read bytes ??? noch nicht geändert */
    108000000, /* max clock rate 108 MHz */
    (SPIFI_CAP_QUAD | SPIFI_CAP_FULLLOCK | SPIFI_CAP_NOBLOCK | SPIFI_CAP_SUBBLKERASE) /* capabilitites */
//    (SPIFI_CAP_QUAD | SPIFI_CAP_FULLLOCK | SPIFI_CAP_NOBLOCK | SPIFI_CAP_SUBBLKERASE) /* capabilitites */
    };
    static SPIFI_DEV_DATA_T data;

    data.pDevData = &pData;
    devRegister(&handle, &data);
  }

  /* finally return the handle */
  return &handle;
}


First of all i'll try to get the deviceGetID() function running:
/* Read Identification */
static void deviceGetID(uint32_t spifiAddr, SPIFI_DEVICE_ID_T *pID)
{
  uint8_t idx;
  volatile uint32_t intStatusRegister;
  volatile uint32_t intControlRegister;
  LPC_SPIFI_CHIPHW_T *pSpifiCtrlAddr = (LPC_SPIFI_CHIPHW_T *) spifiAddr;

  /* Wait for command to complete */
  spifi_HW_WaitCMD(pSpifiCtrlAddr);

  /* 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 */

  /* 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);
}


The command code for read id is configured as shown below:
#define CMD_RDID                    0x9F/**< Read Identification */


This deviceGetID() function is called during initialisation of SPIFI within the spifiGetHandleMemSize() function:
/* Initialize LPCSPIFILIB library, do not reset the interface */
  spifiInit(C_SPIFICTLREGBASE, true);

  /* Register the family for the device */
  spifiRegisterFamily(SPIFI_REG_FAMILY_MicronN25Q);

  /* Get required memory for detected device, this may vary per device family */
  intMemSize = spifiGetHandleMemSize(C_SPIFICTLREGBASE);


0 Kudos

651 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Thu Nov 13 07:02:57 MST 2014
Hi Sebastian,
Please post your code. You can also use old SPIFI lib(No source available just lib with different API) which is available at http://www.lpcware.com/content/nxpfile/lpc4350apdlzip
0 Kudos