AnsweredAssumed Answered

LPC4370 SPIFI initializing fail (boot from SPIFI)

Question asked by lpcware Employee on Jun 15, 2016
Latest reply on Sep 26, 2016 by LPCX presso support
Content originally posted in LPCWare by datdds on Thu Mar 17 05:58:35 MST 2016
Sorry my English is not good.
I'm using LPCLINK2 as LPC4370 evaluation board.
I try to rewrite SPI Flash memory ,after boot from SPIFI.

Debugging below code, LPCSPIFILIB library use model example



(main() located on SRAM.)
int main(void)
{
SystemCoreClockUpdate();
Board_Init();

// spifi initialize
/* Initialize LPCSPIFILIB library, reset the interface */

spifiInit(LPC_SPIFI_BASE, true);

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

/* Return the number of devices this library supports */
int idx = spifiGetSuppFamilyCount();

/* Get required memory for detected device, this may vary per device family */
uint32_t memSize = spifiGetHandleMemSize(LPC_SPIFI_BASE);
if (memSize == 0) {
    /* No device detected, error */
}

uint32_t *lmem = malloc(memSize);

/* Initialize and detect a device and get device context */
SPIFI_HANDLE_T * pSpifi = spifiInitDevice(&lmem, sizeof(lmem), LPC_SPIFI_BASE, SPIFLASH_BASE_ADDRESS);
if (pSpifi == NULL) {
    /* Error initializing device */
-->while(1);
}




It has entered the while(1); loop. Why?
In addition.Oddly all memory looks as 0x2000c000

Original Attachment has been moved to: memory_test.zip

Outcomes