LPC 4088 SPIFI Fails to unlock

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

LPC 4088 SPIFI Fails to unlock

2,573 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Blackclaws on Wed Jul 29 09:56:15 MST 2015
I've been playing around with the SPIFI flash on the LPC4088 EA quickstart board.

I'm using the spifiLib from LPCOpen

It all worked fine until just now when my program operations started to fail with "Device Locked"

I then tried multiple things:

Power cycling the device,
Running spifiDevUnlockDevice from spifilib which returns with no error.
Running spifiDevEraseAll which returns again with Device Locked.

None of these unlock the device.

So I'm wondering whether this means that for some reason my Spifi flash suddenly died? I can still read it without error. Just erasing and writing is no longer possible. However the number of write cycles are probably at around 100. It would be very strange if the flash was dead or something like that.

Is there any hard way to unlock the SPIFI flash? Could this be an error in spifiLib? Is there any other way to find out what really is going on with my flash?
Labels (1)
0 Kudos
Reply
7 Replies

2,453 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MikeSimmonds on Wed Jul 29 16:45:11 MST 2015
I'm glad I was able to help.

Cheers, Mike.

0 Kudos
Reply

2,453 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Blackclaws on Wed Jul 29 16:30:32 MST 2015
I managed to clear all clearable status register fields using the internal spifiDeviceDataSetStatusS25FL032P function which apparently also applies to the Winbond devices.

Everything is working again. Apparently my fear was unjustified as those lock bytes only lock out special registers of which the purpose currently eludes me.

It is however rather strange that the spifiLIB can't unlock those blocks by itself if I issue a complete device unlock request. It might have worked if I had tried unlocking specific blocks.

Anyway thanks for your help! I was rather afraid for my flash for a moment there! :D Unfortunately my soldering skills are rather bad (at least on that scale) so I'm glad I didn't have to do that.

I also wonder how one would normally call those functions like spifiDeviceDataSetStatusS25FL032P etc. since they seem to be library internal functions that aren't exposed by the api. Would they be accessible through the handle struct? I simply copied them directly from the source to use now but that doesn't seem feasible at all.
0 Kudos
Reply

2,453 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Blackclaws on Wed Jul 29 16:27:00 MST 2015
Ah I see. I did not know what he meant by status register-1 and -2 since I did not actually know what the spifi flash model on that board is. I actually couldn't find that in the documentation on the board.

Looking at the datasheet a whole lot seems to be enabled. Apparently all block write protects are on. Also all security register lock bits are set. However I'm not sure whether that means that I simply can't write to the security registers or if the whole flash is permanently write protected now. If that is the case I really would like to know what triggered that state as I would love to avoid that in the future....

Its also strange that the spifilib can't unlock the write protect if it should be able to.
0 Kudos
Reply

2,453 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MikeSimmonds on Wed Jul 29 16:24:59 MST 2015
Check the status bits to see if you are permantly locked out of various blocks.

Then read about 'unlock status register' (or bits/fields thereof)

Code a simple unlock status register, set (program) status bits how you want.
[Download and execute from ram to avoid chicken-egg situations.]

If any status lock bits are permanent (OTP) then you are stuffed and need to replace the part.
(How good is your soldering?)

But read the datasheet, check, double check, then check again.

Cheers, Mike.
0 Kudos
Reply

2,453 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MikeSimmonds on Wed Jul 29 15:51:09 MST 2015
Convert 32480 to hex and compare the bit settings with the status register definitions from the Winbond datasheet for the device.

Like mc told you to.

Cheers, Mike.
0 Kudos
Reply

2,453 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Blackclaws on Wed Jul 29 15:39:48 MST 2015
I'm not exactly sure what you mean.

The result I got from spifiDeviceDataGetStatusW25Q80BV() is 32480

while the result I get from spifiDevGetInfo(pSpifi, SPIFI_INFO_STATUS) is 0

I performed auto spifi device discovery using:
spifiInit(LPC_SPIFI_BASE, true);
spifiRegisterFamily(spifi_REG_FAMILY_CommonCommandSet);
SPIFI_HANDLE_T* pSpifi = spifiInitDevice(&spifi_buffer, sizeof(spifi_buffer), LPC_SPIFI_BASE, SPIFLASH_BASE_ADDRESS);

if that helps diagnose any problems. I actually did manage to unlock the device now after power cycling multiple times and manually writing to the STAT register.

However I now have the problem that the spifi device does no longer respond to ERASE or PROGRAM commands but always returns "SPIFI_ERR_NONE" as if everything completed successfully. Reading is still possible but no matter which block on the device I try to erase/write it does not work. This actually leads me to believe that the device reports its status as unlocked now but is in fact not unlocked.
0 Kudos
Reply

2,453 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Wed Jul 29 11:36:00 MST 2015
Hi Blackclaws,
Could you please check the status registers? You can check statusReg in function spifiDeviceDataGetStatusW25Q80BV(...).
Please compare corresponding bits with status register-1 and status register-2  of Winbond W25Q64FV device.
0 Kudos
Reply