Embedded system: SFDP: a common factor that causes serial nor flash to download / start normally under i.mxrt


Hello, everyone. I’m a ruffian. I’m a real technical ruffian. What ruffian Heng introduced to you today isSFDP: a common factor that causes serial nor flash to fail to download / start normally under i.mxrt

i. It has been more than two years since the launch of mxrt Series MCU, and more and more customer products based on i.mxrt have come into full bloom. As a system application engineer of i.mxrt product line, PI Ziheng could do reference design as much as possible in the early days, but now it is occupied by customer support for a large amount of time.

Because I. mxrt series does not have built-in flash (rt1064, In addition to sip models such as rt1024), it is the top priority of the customer project to configure a serial nor flash to start. There are many manufacturers of serial nor flash, and customers have a lot of choices. Therefore, we have to deal with the vast number of flash models together with customers. Ruffian Heng often ridicules himself as a flash test engineer.

In the process of supporting customers to solve the problem of downloading and starting serial nor flash, several common factors are mainly encountered. These factors may affect the normal use of flash under i.mxrt. Today, ruffian Heng will focus on SFDP.

1、 Brief introduction of SFDP standard

SFDP, also known as jesd216, is a serial flash interface standard launched by JEDEC Association in 2011, which is similar to CFI standard on parallel nor flash. The development of SFDP has produced the following versions:

time standard
2011 JESD216
2013.07 JESD216A
2014.05 JESD216B
2018.08 JESD216C
2018.11 JESD216D
2019.08 JESD216D.01

We know that there are a lot of serial flash manufacturers. Before 2011, everyone played their own games, and there was no clear unified standard (although several leading manufacturers played a demonstration role, there will be differences in the specific details). This is more troublesome for flash users. We need to carefully read the flash manuals of each company, and we can’t miss any details.

With the increasing demand of serial flash market, various manufacturers are also trying their best to add features to their own flash. At this time, JEDEC came out and drew several major flash manufacturers to set up a SFDP standard. With this standard, flash users will be more convenient, especially for software designers. Since then, there are standards to follow when developing flash drivers, and even a set of drivers can be used for all support SFDP standard flash, to achieve easy switching between flash manufacturers.

2、 Some flash models do not support SFDP

Since SFDP standard was only launched in 2011, the products of emerging flash manufacturers (such as Zhaoyi innovation) basically support SFDP standard, while some old flash manufacturers (such as Huabang) have the problem of coexistence of old models and new models. The old models were designed and produced before 2011 and did not support SFDP; the new models designed after 2011 basically supported SFDP.

Huabang is currently the largest manufacturer of serial flash. PI Ziheng met several i.mxrt customers and chose Huabang nor flash. However, SFDP was not supported in flash, so the customer support was slightly more complicated. As for the SFDP support question, PI Ziheng contacted Huabang sales staff and got their reply. In Huabang nor flash familyW25QxxJVandW25QxxJWSeries are new models, all support SFDP; andW25QxxFVandW25QxxFWSeries are old models, most of which do not have SFDP, but some of the following models support SFDP:

Although we can normally use non SFDP standard flash in the follow-up development process and check whether the chip supports SFDP by reading the SFDP command, it is better to know the SFDP situation clearly before selecting the flash model. This needs to be communicated with the flash manufacturer. In a word, PI Ziheng recommends that all manufacturers support the new model of SFDP standard.

3、 How can i.mxrt download flash without SFDP support

If you have carefully read the i.mxrt startup series articles written by ruffian Heng, you should know that the reason why i.mxrt can support almost all serial nor flash on the market depends on the 512 byte fdcb structure, which is the prototype of flexspi_ nor_ config_ t. It can describe all the flash parameter information required for startup.

i. When mxrt is started, it will first use the 1bit SDR timing mode to obtain the fdcb that users put at the start or offset of flash (depending on the i.mxrt model), and then further configure the startup according to the information in the fdcb. Therefore, the presence or absence of SFDP in the flash does not affect the startup, as long as it is clearly described in the fdcb.

However, the presence or absence of SFDP in flash greatly affects the erase operation (commonly known as download) under i.mxrt related supporting tools, because all tools (JLINK, IDE, flash loader for ROM, mcuboot utility for ruffian) are designed based on SFDP by default.

Taking flash loader as an example, the host computer tool is blhost.exe It has the following classic command sequence. This sequence is to initialize flexspi and flash with a simplified serial flash configuration value of 0xc0000007 (describing the general four wire QSPI) to prepare for the subsequent erasure operation.

blhost -u -- fill-memory 0x20202000 4 0xc0000007
blhost -u -- configure-memory 0x9 0x20202000

What is the underlying logic of the configure memory command? Let’s find any SDK package in the_ 2.x.x_ MIMXRTxxxx-EVK\middleware\mcu-boot\src\memory\src\flexspi_ nor_ The following function flexspi can be found in memory. C_ nor_ mem_ Config (), which is the underlying logic. In this function, we can see that the flashloader will judge whether the passed config value is a simplified serial_ nor_ config_ option_ t. Or the full flexspi_ nor_ config_ t。

If config is a simplified serial_ nor_ config_ option_ t. Flashloader calls flexspi_ nor_ get_ The config() function is used to automatically fill in and generate a complete flexspi_ nor_ config_ t. You can continue to see flexspi_ nor_ get_ The implementation of the config() function, for ordinary four line QSPI, is based on the SFDP table content read back in flash to fill, so SFDP is indispensable in this way.

status_t flexspi_nor_mem_config(uint32_t *config)
    status_t status = kStatus_InvalidArgument;
    bool isNorConfigOption = false;

    serial_nor_config_option_t *option = (serial_nor_config_option_t *)config;
    flexspi_nor_config_t *norConfig = (flexspi_nor_config_t *)config;

    if (option->option0.B.tag == kSerialNorCfgOption_Tag)
        status = flexspi_nor_get_config(s_flexspiNorContext.instance, &s_flexspiNorConfigBlock, option);
        // ...
        isNorConfigOption = true;
    else if (norConfig->memConfig.tag == FLEXSPI_CFG_BLK_TAG)
        memcpy(&s_flexspiNorConfigBlock, norConfig, sizeof(flexspi_nor_config_t));
        isNorConfigOption = true;
    // ...

    if (isNorConfigOption)
        status = flexspi_nor_flash_init(s_flexspiNorContext.instance, &s_flexspiNorConfigBlock);
        // ...

    return status;

The above method of handling all four line QSPI by 0xc0000007 is only applicable to flash with SFDP. What about flash without SFDP. In fact, the above solution has been given, that is to provide a complete fdcb directly. Therefore, the download algorithm of i.mxrt related supporting tools needs to be changed accordingly. PI Ziheng has provided non SFDP Flash support for both projects

  1. J-link download algorithm source projectRefer to / boards / MSFT_ rt600_ xproject/flash_ algo_ B0_ silicon/Keil_ JLINK, the source project
  2. Mcuboot utility v2.3 updateSee the articleNo more release of mcubflashSection 2.3

At this point, the SFDP ruffian scale, which causes the serial nor flash to fail to download / start normally under i.mxrt, has been introduced. Where is the applause~~~

Welcome to subscribe

The article will be posted to me at the same timeBlog Garden HomepageCSDN home pageZhihu HomepageWeChat official accountOn the platform.

Wechat search“Ruffian scale embedded“Or scan the QR code below, and you can read it for the first time on your mobile phone.