Implement RWW On i.MX RT Series: 3.1 Multiple Flash Implementing RWW
Implement RWW On i.MX RT Series: 3.1 Multiple Flash Implementing RWW
Contents
1 Introduction 1 Introduction.......................................... 1
Usually, some applications need to store the data to flash, and run code 2 Overview...............................................1
simultaneously that requires Read While Write(RWW). The i.MX RT has high-
3 RWW implement.................................. 1
performance, supports rich peripherals, and can interface with many memory
3.1 Multiple flash
devices including Quad SPI flash, hyper flash, serial NAND, and parallel NAND implementing RWW.................1
flash. It also provides more options to meet customer requirements. This 3.2 Dedicated RWW Flash
application note intends to introduce how to implement RWW requirement on Device..................................... 7
i.MXRT series.
4 Conclusion........................................... 7
5 Revision history................................... 7
2 Overview
To implement RWW, the flash support feature is required in nature, but most flash do not have this feature. One way to implement
RWW is based on common flash device, which is described in this document.
i.MX RT is a flash-less microcontroller, Quad SPI flash is a common selection as firmware storage, also some application may
save data in this flash, but it only has one flash bank and interface.One limitation is it do not respond to any further command until
flash idle, that means it must allocate the flash write function to other memory(except currently writing flash, generally allocate to
internal SRAM), and disable interrupt to avoid any unexpected flash access until writing operation complete. As write operation
spend more time in most flash devices, for example, it takes 0.4 mS to complete one page program in most flash part, and take
more time on sector erase. This is unacceptable to disable interrupt lasting a long time, especially some interrupt require high-
timely response, RWW is helpful in this condition.
There are two solutions to implement RWW on i.MX RT Series, one is to choose the flash supported RWW feature; the other is
to use multiple flash to implement this function. Following chapters describe the RWW implementation in detail.
3 RWW implement
This chapter explains, how to implement RWW based on FlexSPI interface, which can interface with Quad SPI flash, octal flash
and hyper flash, this is also a common usage on i.MX RT Series.
Generally users can connect Flash A1 and Flash A2 to port A of FlexSPI to implement RWW function. OR, connect Flash A1 and
Flash B1 to port A and port B respectively. Flash A1 is used to code storage and running, the other flash is for data storage. If
connected to the same port, it must use the same flash device, and keep the same flash timings. The advantage of connecting
is, the two ports may set the different timings for two flash devices by DLLACR or DLLBCR registers.
How to implement RWW by connecting two flash devices is described below.
The Flash A1 is a boot device, so it must connect to default boot pins, and Flash A2 chip select may remap to other pins according
to application. User can change it freely.
NOTE
By default ROM configures GPIO_SD_B0_00 as SS1 for Flash A2. If it uses other pins for A2 chip select pin, first
try to disable GPIO_SD_B0_00 pin, then configure correct pin MUX and pad for the chosen pin.
To enable RWW function, update LUT, and add API function for flash operation. The basic initialization flow is as Figure 4:
NOTE
Before updating LUT, it require to do software reset by setting SWRESET bit, and then allocate the code of updating
LUT to internal SRAM, It avoids the collision issue.
The common code for flash erase API function is also available for RWW implement, it is available in SDK package. For flash
programming, as it only has one FlexSPI interface, so if the CPU transfers the data, it generates the hard fault. To avoid this issue,
one way is to use DMA for data transfer instead CPU.
Refer to attached example code and flowchart as below:
When a new IP command is triggered, the AHB command is stalled by bus arbitration, after FlexSPI complete the IP command
execution, and entry into idle status, it resume the suspended command. Take flash program command as example, when program
command is send out, it stall others AHB commands, including prefetch operation, after it complete to send out program command
and transferred data(one page size for page program command), then it resume previous suspended command, here stalled
duration contains command and data transferring, below take one GPIO to measure this duration, it take 6 uS for QSPI flash
working at the speed of 133 Mhz, and quad mode is enabled.
Cache can help to improve the performance, and meanwhile also can cover up some issue in some cases. To verify, if it can truely
work well on RWW, the example code also do some test to disable cache and prefetch buffer. Check if it still can work well with
above introduced solution.
A snippet code as below:
Bank 0 can be used to store firmware, and Bank 1 to Bank 3 used to store data, Figure 9 illustrate the address range for different
Banks.
There is no change for hardware connection, it is fully compatible with the common flash device, MX25UW12845G is octal flash,
can enable FlexSPI working on combined mode to support octal flash, please refer to AN12107 for octal flash booting.
And for software for MX25UW12845G, please refer to chapter 3.1.2 for modification.
4 Conclusion
This application note introduces, how to implement the RWW based on i.MX RT series. It provides one way to take two QSPI
flash to implement RWW. It is very useful for the customer as it is a low-cost solution to implement read while write in some
applications.
5 Revision history
While NXP has implemented advanced security features, all products may be subject to
unidentified vulnerabilities. Customers are responsible for the design and operation of their
applications and products to reduce the effect of these vulnerabilities on customer’s applications
and products, and NXP accepts no liability for any vulnerability that is discovered. Customers
should implement appropriate design and operating safeguards to minimize the risks associated
with their applications and products.
NXP, the NXP logo, NXP SECURE CONNECTIONS FOR A SMARTER WORLD, COOLFLUX,
EMBRACE, GREENCHIP, HITAG, I2C BUS, ICODE, JCOP, LIFE VIBES, MIFARE, MIFARE
CLASSIC, MIFARE DESFire, MIFARE PLUS, MIFARE FLEX, MANTIS, MIFARE ULTRALIGHT,
MIFARE4MOBILE, MIGLO, NTAG, ROADLINK, SMARTLX, SMARTMX, STARPLUG, TOPFET,
TRENCHMOS, UCODE, Freescale, the Freescale logo, AltiVec, C‑5, CodeTEST, CodeWarrior,
ColdFire, ColdFire+, C‑Ware, the Energy Efficient Solutions logo, Kinetis, Layerscape, MagniV,
mobileGT, PEG, PowerQUICC, Processor Expert, QorIQ, QorIQ Qonverge, Ready Play,
SafeAssure, the SafeAssure logo, StarCore, Symphony, VortiQa, Vybrid, Airfast, BeeKit,
BeeStack, CoreNet, Flexis, MXC, Platform in a Package, QUICC Engine, SMARTMOS, Tower,
TurboLink, UMEMS, EdgeScale, EdgeLock, eIQ, and Immersive3D are trademarks of NXP B.V.
All other product or service names are the property of their respective owners. AMBA, Arm, Arm7,
Arm7TDMI, Arm9, Arm11, Artisan, big.LITTLE, Cordio, CoreLink, CoreSight, Cortex,
DesignStart, DynamIQ, Jazelle, Keil, Mali, Mbed, Mbed Enabled, NEON, POP, RealView,
SecurCore, Socrates, Thumb, TrustZone, ULINK, ULINK2, ULINK-ME, ULINK-PLUS, ULINKpro,
µVision, Versatile are trademarks or registered trademarks of Arm Limited (or its subsidiaries) in
the US and/or elsewhere. The related technology may be protected by any or all of patents,
copyrights, designs and trade secrets. All rights reserved. Oracle and Java are registered
trademarks of Oracle and/or its affiliates. The Power Architecture and Power.org word marks and
the Power and Power.org logos and related marks are trademarks and service marks licensed
by Power.org.
© NXP B.V. 2019. All rights reserved.
For more information, please visit: http://www.nxp.com
For sales office addresses, please send an email to: [email protected]
Date of release: Septeber 2019
Document identifier: AN12564