Using Micron's external Flash with MQX

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

Using Micron's external Flash with MQX

Jump to solution
2,958 Views
panpwr
Contributor IV

Hello Community!

I am using K60DN512 with MQX, and I would to use Micron's N25Q serial NOR Flash (using SPI interface).

As I understand it, there are a few options to address this issue:

1. Develop an SPI driver using source\io\spi as explained in "Freescale MQX I/O driver user guide".

2. Develop a FlashX driver using source\io\flashx as explained in "Freescale MQX I/O driver user guide".

3. Use the vendor's Flash driver. In order to do so, I will need to fill in addresses of SPI read FIFO register, SPI write FIFO register, SPI control register & SPI status register. I couldn't find these implicit addresses in the K60DN512 user guide (plenty of other variations, but not specifically those).

I would kindly ask you to share your experience, what pros & cons these methods have, and how do you recommend to do it in the easiest and least time consuming method.

Thanks,
Lior.

1 Solution
832 Views
JuroV
NXP Employee
NXP Employee

SPI driver in MQX is a driver for SPI devices, no additional layer. We have more drivers that use SPI, for example SDHC over SPI. The FlashX driver is the driver for NOR flash memories, so no ECC handling is done in the driver. For that purpose nandflash driver was created. You can write your own HW-layer driver for FlashX that accesses the memory via SPI. You can use existing SPI driver for that purpose.

View solution in original post

6 Replies
832 Views
BryGuyH
Contributor IV

Do you need to make frequent writes to the flash (i.e. filesystem) or just infrequently (calibration data at manufacturing), and if you need to use NOR.

Filesystem:

If its the former you'll want to wait until MQX 4.0 (assuming the FTL that comes with MQX 4.0 will be easy enough to link in another external driver and has a NOR mode). If not you'll have to buy an FTL (or attempt to port a linux one to to MQX).

Either way you are looking at:

a) waiting for MQX 4.0 and writing a driver for the FTL that comes with it. I know it's coming with an FTL, I don't know if has both NAND and NOR, or just NAND. If just NAND obviously the next two options are the only ones available.

b) buying a commercial one and porting it to MQX

c) porting a linux one.

Based on my experience the simple answer is you do not want to go down this route - spi flash is too slow, the ftl is too much trouble, and micron is too hard to work with. Pick a different technology with integrated controller and ftl (there are a large number of them now). And using the block mode api for MFS.

Infrequent use without FTL:

Port the vendor drivers for the chip to use the standard api functions to the spi driver (i.e. fopen, read, write, ioctl), if their driver api is logical. Otherwise I would create your own that meets your needs. Sticking with standard mqx api makes a lot of sense and you will understand why as you start to work with it. I would recommend using the polling driver for spi for performance reasons.

832 Views
panpwr
Contributor IV

Thanks for the replay!

I have 2 additional questions:

1. My usage probably suits more the infrequent method. Could you please elaborate more on the difference between the SPI driver and the FlashX driver, and which one is more suitable and why?

2. As I mentioned in the original post, if I will choose to go with the Micron's driver, I will need to fill in addresses of the following SPI generic registers: read FIFO, write FIFO, control, status.

The K60DN512 user guide (chapter 50.3) presents plenty of SPI registers (address range of 4002_C034 to 400A_C088) - I am not sure which of the whole set are the ones I should use. I would be very thankful for assistance with this manner.

0 Kudos
833 Views
JuroV
NXP Employee
NXP Employee

SPI driver in MQX is a driver for SPI devices, no additional layer. We have more drivers that use SPI, for example SDHC over SPI. The FlashX driver is the driver for NOR flash memories, so no ECC handling is done in the driver. For that purpose nandflash driver was created. You can write your own HW-layer driver for FlashX that accesses the memory via SPI. You can use existing SPI driver for that purpose.

832 Views
panpwr
Contributor IV

Hello,

Our project has been delayed and was restarted during the previous months. Our HW is still serial NOR Flash (by Micron), and no straight forward solution has been found yet (I am using the generic SPI driver and manipulates the manufacturer driver to match our requirements...).

1. Does MQX have support for SPI NOR Flash devices? If not, is it planned? I've found many posts requesting for it in the forum over the years...

2. How can I use MFS with SPI NOR flash memory using MQX drivers? I need thi functionality in order to operate FTP client (needs to point the downloaded file to be stored in the external Flash).

3. Can I store HTTP server pages to be read directly from SPI NOR Flash?

4. We have a chance to replace the HW for our next product version If all the above is problematic - what HW changes would you recommend in order to support all theses operations (different external Flash manufacturer, different setup, different interface)?

Thanks!

Lior.

0 Kudos
832 Views
panpwr
Contributor IV

Hello,

Now that MQX 4.0 is out, is there any reason (Serial NOR Flash interface wise) to switch to it? Will it make my life easier / performance better?

Thanks,

Lior.

0 Kudos
832 Views
JuroV
NXP Employee
NXP Employee

Hello Lior,

some bugs were fixed, but no performance improvements were done in MQX 4.0 as for FlashX driver.