Hello everyone, I am a ruffian balance, is a serious technical ruffian. SFDP is a common factor that causes serial NOR Flash to fail to download/start normally in I. MX.
It has been more than two years since the release of I.MXRT series MCU, and more and more customer products based on I.MXRT are coming into full bloom. Ruanziheng, as a system application engineer for the I.MXRT product line, was free to do reference design in the early days, but now spends most of his time on customer support.
Since i.MX series do not have built-in Flash (except RT1064, RT1024 and other SIP models), it is a top priority for customers to start with a serial NOR Flash. There are many serial NOR Flash manufacturers, and customers have a large choice. So we have to deal with customers with the vast number of Flash models, Ruffian balance also often joke that he has become a Flash test engineer.
Ruffian Heng in support of customers to solve the serial NOR Flash download startup problems encountered several common factors, these factors may affect the normal use of Flash in I. MX, today Ruffian Heng will focus on talking with you about SFDP this factor.
I. Introduction to SFDP standard
SFDP, also known as JESD216, is a serial Flash interface standard launched by JEDEC Society in 2011, which is similar to CFI’s standard on parallel NOR Flash. SFDP has produced the following versions so far:
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 vendors, and before 2011, everyone was playing it by themselves and there was no clear standard (although a few of the leading vendors set a good example, there were differences in the details), which made it difficult for Flash users to read their Flash manuals carefully. Not a single detail should be left out.
With the serial Flash market demand is becoming more and more strong, various manufacturers are also in their own Flash to add features, at this time JEDEC stood out, pulled several major Flash manufacturers together to set a SFDP standard, with this standard, Flash users are more convenient, especially software designers, Flash drivers can be developed according to standards, and even a set of drivers can be used in all Flash that support SFDP standard, enabling easy switching between Flash manufacturers.
2. Some Flash models do not support SFDP
Since the SFDP standard was launched in 2011, the products of emerging Flash manufacturers (such as Zhayi Innovation) basically support the SFDP standard, while some old Flash manufacturers (such as Warbang) have the problem of coexistence of old and new models. The old models were designed and produced before 2011 and do not support SFDP; New models designed after 2011 are basically SFDP support.
Warbang is currently the largest serial Flash manufacturer, Ruffian balance encountered several I.MxRT customers, the choice of Warbang NOR Flash, but Flash does not support SFDP, so customer support is slightly more complicated. Regarding the SFDP support problem, Ruffian Has especially contacted the sales staff of Warbang and got their reply. W25QxxJV and W25QxxJW series of Warbang NOR Flash family are new models and all support SFDP; W25qquarter V and W25QxxFW series belong to the old model, most of them do not have SFDP, but there are also some following models support SFDP:
Although we can normally use Flash that is not SFDP standard in the subsequent development process and check whether the chip supports SFDP by reading SFDP commands, it is better to know the SFDP situation clearly before Flash selection, which requires good communication with Flash manufacturers. In short, ruffian balance recommends you to choose the manufacturers support SFDP standard of the new model.
Iii. How can I download Flash that does not support SFDP
If you read the i.MAXrt boot series by Riffrard, you will know that i.MAXrt supports almost all serial NOR Flash booting on the market thanks to the 512byte FDCB structure prototype flexspi_nor_config_t, It can describe all the Flash parameter information required for startup.
When starting, I.MX will first use the 1bit SDR timing mode to obtain the FDCB placed by the user at the beginning or offset 0x400 of Flash (depending on the I.MX model), and then further configure startup according to the information in FDCB. Therefore, whether or not SFDP is in Flash actually does not affect startup. As long as it’s clearly described in FDCB.
However, whether or not SFDP is in Flash greatly affects the erasable operation (commonly known as download) under the relevant supporting tools of I. mx. This is because all the tools (JLink, IDE, ROM Flashloader, MCUBootUtility) design Flash download algorithms based on SFDP by default.
Take Flashloader with ROM as an example, the host computer tool is blhost.exe, which has the following classic command sequence. This sequence initializes FlexSPI and Flash with the user’s simplified serial Flash configuration value 0xC0000007 (describing a generic four-wire QSPI) in preparation for subsequent write operations.
blhost -u -- fill-memory 0x20202000 4 0xc0000007
blhost -u -- configure-memory 0x9 0x20202000
Copy the code
What’s the underlying logic behind configure-memory? Let’s find any SDK package, The flexspi_nor_mem_config() function can be found in \ sdk_2.x.x_mimxrtXXXX-evk \middleware\ MCU -boot\ SRC \memory\ SRC \flexspi_nor_memory.c, It is the underlying logic. In this function, we can see that the Flashloader determines whether the config value is the 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 the flexspi_nor_get_config() function to automatically populate the full flexspi_nor_config_t, You can continue to look at the flexspi_nor_get_config() function implementation. For normal four-line QSPI, it is based on the SFDP table read back from Flash to do the filling, so SFDP is not missing 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;
}
Copy the code
The above 0xC0000007 approach to all quad-line QSPIs is only applicable to Flash with SFDP in it. In fact, the above has given the solution, that is to directly provide a complete FDCB, so I. mx rt related supporting tools download algorithm needs to be changed accordingly, Riffrard balance in two projects have done non-SFDP Flash support:
- J-link Download algorithm source project, refer to /boards/msft_rt600_xproject/flash_algo_b0_silicon/Keil_JLink for the source project
- MCUBootUtility v2.3 has been updated. See MCUBootUtility v2.3 release, section 2.3, for this one
At this point, the common factors leading to the failure of serial NOR Flash to download/start under I.mxrt are introduced, where is the applause ~~~
Welcome to subscribe to
The article will be published on my blog park homepage, CSDN homepage, Zhihu homepage and wechat public account at the same time.
Wechat search “ruffian balance embedded” or scan the following two-dimensional code, you can see the first time on the phone oh.