I have a running application on the Embedded Artists LPC4088 board, which uses the SPIFI FLASH from Winbond.
This works fine.
We have then made our own custom board with a new SPIFI FLASH: SST26VF032 from Microchip.
This is on the supported list in the user manual.
We have also changed the MCU to LPC4076, but this should not have anything to say.
The problem is that when we try to initialize the SPIFI FLASH, the call to the ROM function spifi_init() returns an error 0x2000A.
We have tried different settings for the SPIFI, but it just keeps returning 0x2000A.
And we can not find any manual/API description for the ROM API, so we have no clue what the error code tries to tell us...
So, the questions are:
- What does the 0x2000A mean?
- Where can I find the SPIFI ROM API description?
- Any good ideas of why it fails with the new SPIFI device?
Below is the init code, which calls the spifi_init().
ret = 0x2000A after the call.
Thanks in advance for any help !
/* Initialise SPIFI */
LPC_SC->PCONP |= ( 1UL << 16 ); /* enable SPIFI power/clock */
LPC_IOCON->P2_7 &= ~( 7UL << 0 );
LPC_IOCON->P2_7 |= ( 5UL << 0 ); /* SPIFI_CSN = P2.7 (FUNC 5) */
LPC_IOCON->P0_22 &= ~( 7UL << 0 );
LPC_IOCON->P0_22 |= ( 5UL << 0 ); /* SPIFI_CLK = P0.22 (FUNC 5) */
LPC_IOCON->P0_15 &= ~( 7UL << 0 );
LPC_IOCON->P0_15 |= ( 5UL << 0 ); /* SPIFI_IO2 = P0.15 (FUNC 5) */
LPC_IOCON->P0_16 &= ~( 7UL << 0 );
LPC_IOCON->P0_16 |= ( 5UL << 0 ); /* SPIFI_IO3 = P0.16 (FUNC 5) */
LPC_IOCON->P0_17 &= ~( 7UL << 0 );
LPC_IOCON->P0_17 |= ( 5UL << 0 ); /* SPIFI_IO1 = P0.17 (FUNC 5) */
LPC_IOCON->P0_18 &= ~( 7UL << 0 );
LPC_IOCON->P0_18 |= ( 5UL << 0 ); /* SPIFI_IO0 = P0.18 (FUNC 5) */
g_spifi_mem_base = (uint32_t)p_flash_base;
/* get SPIFI API table pointer */
g_spifi = ROM_DRIVERS_PTR->pSPIFID;
// ret = g_spifi->spifi_init( &g_spifi_obj, 4, S_FULLCLK + S_RCVCLK, 80 );
ret = g_spifi->spifi_init( &g_spifi_obj, 0, S_HALFCLK + S_RCVCLK, 24 );
Is your SPIFI flash present in the list in function spifi_REG_FAMILY_CommonCommandSet() in spifilib_fam_standard_cmd.c.
If not, you can try manually adding it. Because during initialization it gets configured from this list based on the deviceID, manufactureID, etc.
When I bought new ISSI flash I had to add my device config data in this list.
I don’t have that file in my project.
It uses the SPIFI function in ROM. I don’t know where this ROM driver holds this list of known ID’s.
In the datasheet, I have found the Mfgr, DevType and devID as:
#define SPIFI_NOR_ID_MFG 0xbfu
#define SPIFI_NOR_ID_TYPE 0x26u
#define SPIFI_NOR_ID_CAP 0x42u
And I read exact these values from the FLASH device.
But the spifi_init() function does not know it.
In the LPC40xx manual, it says that the SPIFI FLASH we use is tested to be working with this MCU.
So it should work, but don’t…
Could you please tell me which example are you using as a base for your project? I recommend you using the SPIFI library instead of the SPIFI ROM API.
Looking forward to your reply!
After googling (a lot...), I found this decription 0x2000A
No operative serial flash (JEDEC ID all zeroes or all ones
This indicates we may have a HW issue.
I will investigate that, and come back.