Ruffian Heng embedded: measure the execution time distribution of i.mxrt series flexspi driven flash page programming with the help of serial plot software

Time:2022-5-2

Hello, I’m ruffian Heng, a serious technical ruffian. What ruffian Heng introduced to you today isi. Mxrt series flexspi drive flash page programming execution time

Ruffian Heng wrote an article beforeInfluence of page programming mode of serial nor flash on mass production efficiency, this paper briefly analyzes the impact of different modes of page program command of NOR flash on the overall mass production time. This paper only analyzes it from the perspective of theoretical calculation, assuming that the erasure performance of all pages in flash is consistent, but is the performance of each page really completely consistent? Today, we will discuss this topic from a customer problem:

1、 Introduce customer issues

Recently, an i.mxrt1170 customer reported that the IAP function code in their application is unstable for flash erasure. Their IAP code is the transplanted \ SDK_ 2.10.0_ MIMXRT1170-EVK\boards\evkmimxrt1170\driver_ examples\flexspi\nor\polling_ For the transfer routine, flash uses the same model is25wp128-jble as that on the official evk. The test code will erase and write the 16MB of the whole flash cycle and test it repeatedly. Some areas found in the test process are slow. This slow definition is that when some 256 bytes (a page) are written, the return time of the write API is long (because it is the polling mode), but the return status is correct.

Since the customer didn’t give further information about the speed of page writing, ruffian Heng had to guess blindly first. Since the return status of the write API is correct, it indicates that the flexspi driver can work normally. First eliminate the board level hardware design problem. Then there are only two possibilities: first, the stability of flexspi software driver execution; 2、 The consistency of page performance of flash itself. These two problems can be further confirmed by observing and counting the write time of all pages. For the second possibility, we can know from the flash manual that the typical waiting time for page write command is 0.2ms, and the maximum value is 0.8ms. However, this statement does not specify whether it is for different flash chips or different pages in the same flash.

2、 Determine the measurement scheme

With the above questions, ruffian Heng decided to measure it on the official mimxrt1170-evk. We just need to make a simple transformation of the \ SDK_ 2.10.0_ MIMXRT1170-EVK\boards\evkmimxrt1170\driver_ examples\flexspi\nor\polling_ Transfer routine, in flexspi_ nor_ polling_ transfer. Add the timing function in the spic () source code_ nor_ flash_ page_ The program () function can be executed at a time, and the timing implementation is availablehttps://github.com/JayHeng/microsecondsProject, specific usage referenceDesign and implementation of general microseconds timing function frameworkA penny.

//Save the write API execution time of 65536 pages

3、 Choose a serial port waveform display software

In the code in the previous section, we printed the writing time of all pages through the serial port. Now we need a serial port waveform display software to intuitively see the difference of these 65536 time results. Ruffian Heng tried several software: serial plot v0 12.0, serial chart v034 and serial Hunter V31. It is found that the most perfect serial plot software is recommended to you:

The best part of serial plot software is the perfect support for serial port receiving data format, which can be binary (single channel byte length can be set), ASCII code (channel spacer can be set), user-defined data frame (frame header and frame format can be set), and the number of channels can also be set arbitrarily, which can basically meet most of the requirements of serial port waveform display.

4、 Analysis of test results

When you are ready, power on the board card, download the test program, run, open the serial plot, set the serial port receiving parameters, and observe the results. We find that the waveform display is a straight line, that is, the writing time of 65536 pages is stable, all of which are 271us (debug build is selected for the test project). This result overturns our previous two guesses and the execution time of writing API is stable, The performance of each page of flash is also consistent. After further communication with the customer, the customer reported that they found it in levelx of ThreadX, so it seems that the customer problem is related to ThreadX system scheduling. That’s another topic, which will be discussed later.

So far, i. mxrt series flexspi driven flash page programming execution time ruffian Heng has been introduced. Where is the applause~~~

Welcome to subscribe

The article will be published to me at the same timeBlog Park HomepageCSDN home pageZhihu HomepageWechat official accountOn the platform.

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