LPC43xx SPIFI Problem

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

LPC43xx SPIFI Problem

1,115 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TahaSN on Mon Dec 09 12:55:44 MST 2013
Hello,

I am using Hitex Board A4 and using QuadSPI to save my data. I am using SPIFI Library to erase and program the SPIFI. I was able to do both but suddenly I cannot program or erase without having any error returns from those routines.

do
        Valid = pSpifi->spifi_program (&obj, (char *)Data, &opers);
    while(Valid);

In the above statement, I get the error 0x20005 which says device status error. I am not sure why I am getting device status error. Can somebody explain why that error is being generated?

Thanks
Taha
Labels (1)
0 Kudos
9 Replies

797 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Feo Elektronik WR on Mon May 26 08:58:18 MST 2014
We had a very similar problem using "spifi_drv_M3.lib" (file date 2012-12-11, extracted from "LPC18xx_SPIFI_LPCXpresso6_1-zip" or "libfalcon_m3_spifi_drv.a" on LPC1850:
spifi_init() worked, spifi_erase() and spifi_program() not, returning 0x00020004 (ERR_SPIFI_OPERAND_ERROR).

The reason was a bug in the spifi lib. Here's what I wrote to NXP support:


Quote:
I analyzed the disassembly of spifi_erase() from entry point until call of checkAd(). Please see the attached commented screenshot of the debug session.

spifi_erase() passes a local copy of *opers to cheakAd() that has not yet been initialized at this point.
Only AFTER calling checkAd(), the local copy is initialized with *opers by memcpy_spifi_lib().
Thus, checkAd() is checking random garbage on the stack frame instead of *opers, so sometimes it fails, sometimes not. This is exactly what we observe.



The problem is easy to spot in disassembly of spifi_erase(): bl checkAd comes before bl memcpy_spifi_lib. It should be the other way round.
0 Kudos

797 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ravikumar.karri@nxp.com on Mon May 05 21:40:38 MST 2014
Hi mc,

Thank you for the update.

Yes, i am sure that i have placed the SPIFI library in the RAM region only. Please find the attached .map file for your reference with which i have confirmed that the library is placed in Internal RAM only.

I can use the above provided libraries but would like to know the reason for working condition and non-working condition of the same project on the same board.

When i checked the status register and configuration registers their values are 0x1E and 0x3E respectively by issuing 0x05 and 0x35 commands.

Let me know of any such issue solved or have come across. Thanks in Advance.

Regards,
Ravikumar Karri
0 Kudos

797 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Fri May 02 16:09:26 MST 2014
Hi ravi,
Are you sure you are placing SPIFI library in the RAM. The library should be inside RAM . You can take example from below thread. This is done for LPCxpresso board.

http://www.lpcware.com/content/forum/spifi-setup-lpc18004300-using-lpcxpresso-6-running-lpcxplorer-b...

You can also check the latest library with source done for LPC4300  at
http://www.lpcware.com/system/files/lpcspifilib_lpcxpresso_0_04_beta.zip

You can adapt it for your board and LPC18xx.
0 Kudos

797 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ravikumar.karri@nxp.com on Tue Apr 29 22:27:10 MST 2014
Hi mc,

Thank you for the prompt reply.

I am using keil with uvision IDE along with the Seggers jlink JTAG.

Attached the code snippet for you, this example is from the "NXP MCU SW Application Team". Attached the code and abract of the example code.

Yes, the code worked fine for me before and its not working now.

NOTE: The code is slightly change with some test instructions in place but the same was in working condition.

Thank in Advance.
0 Kudos

797 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Tue Apr 29 21:52:00 MST 2014
Hi Ravikumar,
Which tool chain are you using? Can you post your code here?
Do you mean your code worked before and now it is not working?
0 Kudos

797 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ravikumar.karri@nxp.com on Tue Apr 29 21:38:45 MST 2014
Hi NXP support/Taha,

Is there any update in this issue resolving. I face the same issue thats raised by Taha (but on the LPC18xx Hitex Eval board) where in which i can call spifi_init function call successfully but not  able to call the spifi_erase and spifi_program successfully. When the spifi_init calls are success with the following information seen during the captures. Please find the attachments, in which first one is a reply for 0x9F command (Read identification) that reply spansion FL64 part details properly and the next is 0x35 command (Read Configuration register) that reply with 0x3F.

But when i call spifi_erase it throws an error with code 0x20005.

NOTE: Before this i was able to call spifi_erase and spifi_program successfully.

Any reply is appreciated. Thanks in Advance.
0 Kudos

797 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bavarian on Tue Dec 10 10:52:33 MST 2013
Hello Taha,

there is an example for the Hitex board in the following package:

         http://www.lpcware.com/content/nxpfile/lpc4350apdlzip

in this folder:

         .\lpc43xx\Examples\SPIFI\SPIFI_Test\Keil

-  I set following the compiler defines for the target Hitex_Flash:  CORE_M4 USE_SPIFI_LIB HITEX_BOARD
-  I programmed it, connected a terminal program with 115kbaud and then started the software with the debugger. It worked fine (takes rather long)
-  When I started it with a hardware reset it worked fine as well
-  I attached the AXF/HEX/BIN files in case you don't have the Keil environment. Then you can at least program it with FlashMagic or another debugger tool

+  If you step through this code maybe you can identify where things going wrong in your code
+  Is it possible for you to erase the SPIFI with a debugger tool ?
+  You can also use FlashMagic for that (serial programming, press ISP button during reset)
+  Check what you've done on the clock tree after the SPIFI init. Did you maybe change the CPU frequency? Or the divider which is used for the SPIFI block ?

Regards,
NXP Support Team
0 Kudos

797 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TahaSN on Tue Dec 10 07:30:29 MST 2013
Hi Bavarian,

Yes, I did continue to work on my software which resulted in SPIFI problem. I already tried to go back to my previous version where SPIFI was working fine but it isn't anymore. I also forgot to mention that SPIFI does initialize properly but I am not able to program or erase without "Device Status Error".

What I noticed is, when I try to debug my software through NOR Flash, SPIFI gives me some problem. While running the software directly from local RAM works fine. Now I don't understand what could have I done to create this problem.

Taha
0 Kudos

797 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bavarian on Tue Dec 10 01:30:48 MST 2013
Hello Taha,

"suddenly" means what?
- did it run fine and suddenly it stopped working?
- did you continue to work on your software and then one time the SPIFI programming didn't work anymore?

The first case is pretty unlikely.
The second case could mean that you did something in software which is in conflict with the SPIFI:
- you changed pin settings of the SPIFI i/f
- you changed the CPU frequency or other clock setting which affect the SPIFI
- you changed something by accident in the obj struct

Can you try with an earlier version of your code. Or with one of our examples in LPCOpen which can be found at:

http://www.lpcware.com/content/nxpfile/lpcopen-platform

Regards,
NXP Support Team

0 Kudos