Help bringing up external NOR flash on iMXRT685

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

Help bringing up external NOR flash on iMXRT685

1,001 Views
elemindengineer
Contributor II

Hello,

I am looking for some guidance on bringing up an external NOR flash chip with our custom device using the iMXRT685.

 

elemindengineer_0-1664895248502.png

 

 

The iMXRT685 is connected to a NOR flash, a Winbond part the  W25Q64JW on the FlexSPI port B as seen above. We have set our ISP pins correctly in order to boot from FlexSPI Port B. In particular we are using part W25Q64JWSSIQ package. That Q in the package means the Quad SPI enable bit is default enabled. Some links for context on the flash part,

 

https://www.winbond.com/hq/product/code-storage-flash-memory/serial-nor-flash/index.html?__locale=en...

Datasheet:

https://www.winbond.com/hq/support/documentation/levelOne.jsp?__locale=en&DocNo=DA00-W25Q64JW

 

What we would like to do it be able to store the firmware image in the NOR flash part, on boot up, have the Boot ROM load the entire image into RAM and execute from there. We might at some point looking at doing XIP but not required.

 

We are bringing up these new boards, and having issues getting the device to boot from NOR flash and having issues on how to debug what's going on.

 

I have a Segger J-link debugger attached to the SWD port. If I set my project to run completely out of RAM I am able to download the image to the target and it is able to run just fine, as in my memory configuration on MCUXpresso looks like this,

elemindengineer_1-1664895248504.png

It just is writing to internal RAM, and on reset the image is gone as expected. 

 

Now, if I try to link the device to store in the NOR flash, I have the memory configuration like so,

elemindengineer_2-1664895248504.png

 

 

I have BOOT_HEADER_ENABLE=1 set as preprocessor define, and my flash_config.c looks like this,

/*
 * Copyright 2020-2021 NXP
 * All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */
#include "flash_config.h"

/* Component ID definition, used by tools. */
#ifndef FSL_COMPONENT_ID
#define FSL_COMPONENT_ID "platform.drivers.flash_config"
#endif

/*******************************************************************************
 * Code
 ******************************************************************************/
#if defined(BOOT_HEADER_ENABLE) && (BOOT_HEADER_ENABLE == 1)
#if defined(__ARMCC_VERSION) || defined(__GNUC__)
__attribute__((section(".flash_conf"), used))
#elif defined(__ICCARM__)
#pragma location = ".flash_conf"
#endif

const flexspi_nor_config_t flexspi_config = {
    .memConfig =
        {
            .tag                 = FLASH_CONFIG_BLOCK_TAG,
            .version             = FLASH_CONFIG_BLOCK_VERSION,
            .csHoldTime          = 3,
            .csSetupTime         = 3,

			.waitTimeCfgCommands = 1,

            .deviceType    = 0x1,
            .sflashPadType = kSerialFlash_4Pads,
            .serialClkFreq = kFlexSpiSerialClk_133MHz,
            .sflashA1Size  = 0,
            .sflashA2Size  = 0,
            .sflashB1Size  = 0x800000,
            .sflashB2Size  = 0,
            .lookupTable =
                {
                    /* Read */
                    [0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x6B, RADDR_SDR, FLEXSPI_4PAD, 0x18),
                    [1] = FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 0x08, READ_SDR, FLEXSPI_4PAD, 0x04),

                    /* Read Status */
                    [4 * 1 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05, READ_SDR, FLEXSPI_1PAD, 0x04),

                    /* Write Enable */
                    [4 * 3 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06, STOP_EXE, FLEXSPI_1PAD, 0x00),
                },
        },
    .pageSize           = 0x100,
    .sectorSize         = 0x1000,
    .ipcmdSerialClkFreq = 1,
    .blockSize          = 0x10000,
};
#endif /* BOOT_HEADER_ENABLE */

It is pretty simple, I am trying to follow similar example from this link https://community.nxp.com/t5/Blogs/i-MX-RT685-SuperMonkey-QSPI-Bring-up-with-MCUXpresso-and-Segger/b... but using the right values for my particular Winbond NOR flash.

 

When I try to download and debug, it seems the flash loading works correctly, but the device get stuck at address "0x1c04a" after bootup. I am right now thinking I am defining the flash config block incorrectly. There is not much info I can find to try and debug what the problem is. This brings my to my list of questions I was hoping to get some guidance on

 

  • Are there any general resources or documentation you can share about how to debug what the issue is? Since its happening in BootROM I feel like I am flying blind as to why its not able to read out the image initially.
  • You have any general suggestions you have to debug why the BootROM is not able to read the FW image off my NOR device?
  • For the flash config, which LUT table entries need to be defined? Is there a minimum or should all of them be expected to be defined?
  • Is there any general documentation on the flash config block settings? There are a few items that don’t have much detail in source code and have not seen much documentation on them. For example something simple like "device_type" I set to "1" from example but source code does not have any sort of enumeration to detail what "1" actually means.

 

Any help or guidance on getting this to work would be greatly appreciated. Let me know if you have any questions. 

Labels (1)
0 Kudos
Reply
1 Reply

967 Views
jeremyzhou
NXP Employee
NXP Employee

Hi @elemindengineer ,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
1) Are there any general resources or documentation you can share about how to debug what the issue is? Since its happening in BootROM I feel like I am flying blind as to why its not able to read out the image initially.
-- Please refer to the link to learn why the PC is stuck at the 0x1c04a.
2) For the flash config, which LUT table entries need to be defined? Is there a minimum or should all of them be expected to be defined?
-- For XIP boot mode, just defining the LUT command of the reading operation is enough, regarding the above flexspi_config the .serialClkFreq should reduce to the either kFlexSpiSerialClk_SDR_24MHz or kFlexSpiSerialClk_SDR_48MHz.
3) Is there any general documentation on the flash config block settings? There are a few items that don’t have much detail in source code and have not seen much documentation on them. For example something simple like "device_type" I set to "1" from example but source code does not have any sort of enumeration to detail what "1" actually means.
-- Please learn detailed information about the FCB by referring to Table 997. FlexSPI flash configuration block.
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply