Drivers for SPIFI N25Q064A

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

Drivers for SPIFI N25Q064A

686 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Paulo Madeira on Tue Jan 19 12:31:40 MST 2016
Hello,

We are using LPC1830 with Flash SPIFI from Macronix part number MX25L6445EZNI-10G and IAR

This memory is used as program and data memory and it is working properly.

We are now changing this memory for Micron part number N25Q064A13EW9D0F but it is not working.

It's possible to use an external programmer and run the main loop, but we can't write in this memory
(N25Q064A13EW9D0F) from LPC1830 for bootloader and data store purposes, although it works fine with MX25L6445EZNI-10G

We think that our SPIFI library (SPIFI_drv_M3.lib) does not support this Micron memory (this lib is from IAR 6.40).

We checked this forums, but this drivers has the same results or didn't worked:
https://www.lpcware.com/content/forum/spifi-does-not-work-n25q256
https://www.lpcware.com/content/forum/lpc1857-spifi-flash-loader-micron-n25q256a

Anyone can help us with this problem? Is there any new library that can handle this Micron N25Q memory?

Thank you.
Labels (1)
0 Kudos
2 Replies

508 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Paulo Madeira on Wed Jan 20 11:55:32 MST 2016
Hi MC,

Thanks for a fast reply!

I divided in topics to make easier:
1. Library, spifi_drv_M3.zip: The file spifi_drv_M3.zip is the same .lib we use here (Flash Loader and SPIFI lib Default.zip), we didn't built it

2. Library, 'https://www.lpcware.com/SPIFI': Here we use IAR 6.30 (official for this project) and IAR 7.40 (for other projects), so this lib (https://www.lpcware.com/SPIFI) was able to generate a '.a' lib file only with IAR 7.40, because it has some compatibility issues in IAR 6.30.
At this moment I'm porting the '.a' to IAR 6.30 project, but looks like some functions prototypes have changed between these libs too. Ex:
int32_t              (*spifi_init)   (SPIFIobj *obj, uint32_t csHigh, uint32_t options, uint32_t mhz);   --> spifi_drv_M3.zip
SPIFI_ERR_T spifiInit        (uint32_t spifiCtrlAddr, uint8_t reset);               --> 'https://www.lpcware.com/SPIFI'


3. Flash loader: We are experiencing the same incompatibility for JTag Debug in SPIFI (only projects without flash loader and full linked into RAM works fine).
   There is a message 'The flash loader program reported an error'. I can see the flash loader downloaded into LPC messages, but looks like N25Q064A13EW9D0F is incompatible with the flash loader too, when the writing data to SPIFI starts.
   After your answer, we used the .lib you send for us and rebuild the flash loader .out to generate the project attached (FlashLPC18xx_SPIFI - FLoader Rebuid.zip),but the results are the same: works fine with MX25L6445EZNI-10G but does not with N25Q064A13EW9D0F
   This attached project I rebuilt in IAR 7.40 from the original found in:
   https://www.lpcware.com/content/forum/lpc1857-spifi-flash-loader-micron-n25q256a


4. Testing and errors received:
MX25L6445EZNI-10G - Actual memory
N25Q064A13EW9D0F  - Memory in tests for implementation
The tests 4.2., 4.3., 4.5. and 4.6. are using a very simplified version of the full code, linked all into RAM to allow JTag debug on both platforms.
This code has basically IO's initialization and SPIFI driver (same spifi_drv_M3.zip)

4.1. Default production platform, external programmer, no JTag or flash loader
     (MX25L6445EZNI-10G + full code loaded into SPIFI / running from SPIFI):
Works fine

4.2. Default production platform, debug mode
     (MX25L6445EZNI-10G + full code loaded into SPIFI / running from JTag RAM code):
Works fine, the SPIFI was already been initialized before JTag downloaded the RAM code (when board powers up).
SPIFI Initialization, write routines and direct read form memory are fine

4.3. Default production platform, debug mode, no initialization code
     (MX25L6445EZNI-10G + SPIFI fully erased / running from JTag RAM code):
RAM code runs fine, but SPIFI can't be read directly (IAR 6.30 'view-->memory' window).
After running init() from spifi (lib spifi_drv_M3.zip):
rc = spifi->spifi_init (&obj, 4, S_FULLCLK+S_RCVCLK, 12);

rc returns '0' meaning a good initialization
ojb struct also appears to have consistent values

The write instructions didn't report any errors, but we can't do a read from memory, from JTag/IAR and from local coded pointers to SPIFI.
Inconsistent values are returned like '0' where was supposed '0xFF' from a erased memory
looks like we are in 'op codes mode', not in 'direct read mode' and probably there is a true write success


4.4. New memory and full code, external programmer, no JTag (same as 4.1, but changed memory)
(N25Q064A13EW9D0F + full code loaded into SPIFI by external programmer / running from SPIFI):
The main loop runs fine, but the code fails to write into SPIFI memory

4.5. New memory, debug mode (same as 4.2, but changed memory)
  (N25Q064A13EW9D0F + full code loaded into SPIFI / running from JTag RAM code):
We are waiting for these parts to arrive for us to make this tests with JTag + RAM code, so we post the results here

4.6. New memory, debug mode, no initialization code (same as 4.3, but changed memory)
(N25Q064A13EW9D0F + SPIFI fully erased / running from JTag RAM code):
RAM code runs fine, but SPIFI can't be read directly (IAR 6.30 memory window).
After running spifi_init() from spifi (lib spifi_drv_M3.zip):
rc = spifi->spifi_init (&obj, 4, S_FULLCLK+S_RCVCLK, 12);

rc returns '0x0002000A' meaning "No operative serial flash (JEDEC ID all zeroes or all ones)"
ojb struct are filled with zeros, meaning this memory can't be initialized

SPIFI registers addr 0x40003000 shows like a try to read device info occurred:
ff ff 04 68 03 00 20 9f 21 00 00 00 ff ff ff ff 00 00 00 10 aa aa aa aa 00 00 20 9f 20 00 00 02

addr: 4000 3004 = 03 00 20 9f (little endian) --> 9F 20 00 03 (big endia)
OPCODE field: 9F --> command to read device ID

In default memory MX25L6445EZNI-10G the OPCODE field is EB, meaning a chain of successful steps after this '9F'
MX25L6445EZNI-10G addr 0x40003000 after run spifi_init()
ff ff 04 68 00 00 13 eb 00 00 00 00 a5 00 00 00 00 00 00 10 aa aa aa aa 00 00 13 eb 21 00 00 02


At this moment looks like the root of this incompatibility is the lib, solving that we can generate a flash loader (for debug) and allow writing data or code from LPC (our final project)

Sorry for this long post, but I hope to provide the info you need to help us and feel free to ask for more info

Paulo Madeira
0 Kudos

508 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Tue Jan 19 12:54:00 MST 2016
Hi Paula,
The library from second link (below) should work. Can you please let me know what is the error? Did you build flash driver?
https://www.lpcware.com/system/files/spifi_drv_M3.zip

Please note that this is an old library. If you want you can download source files of the new library and add this device in the library. Source files of new lib is at
https://www.lpcware.com/SPIFI
0 Kudos