|
大家好,我是痞子衡,是正經(jīng)搞技術(shù)的痞子。今天痞子衡給大家介紹的是實(shí)抓Flash信號(hào)波形來看i.MXRT的FlexSPI外設(shè)下AHB讀訪問情形。
4 A+ H8 p( A. A8 q" u上一篇文章 《i.MXRT中FlexSPI外設(shè)對(duì)AHB Burst Read特性的支持》 里痞子衡介紹了FlexSPI外設(shè)在不開啟Prefetch功能下響應(yīng)AHB master的訪問請(qǐng)求完全受AHB總線Burst Read特性決定,這是FlexSPI外設(shè)最基礎(chǔ)的對(duì)Flash訪問支持功能,研究這個(gè)其實(shí)是很有意義的,這可以反映出XiP下最原始的代碼執(zhí)行效率。
9 _0 E5 m/ w! r, {( A7 |4 X我們知道在實(shí)際項(xiàng)目中,XiP應(yīng)用程序常常是在L1 Cache和Prefetch加持下運(yùn)行的,代碼執(zhí)行效率會(huì)得到大大提升,但無論是怎樣的緩存策略,極限情況下(比如大數(shù)據(jù)塊搬移,長(zhǎng)跳轉(zhuǎn)指令)最終還是拼得FlexSPI最基礎(chǔ)的讀訪問支持。今天痞子衡就從抓Flash信號(hào)波形角度帶大家真切感受下這最基礎(chǔ)的AHB讀訪問情形(為更清晰地分析結(jié)果,本次主要涉及數(shù)據(jù)總線AHB訪問,暫不涉及指令總線AHB訪問):. a; q$ W/ ~. R8 B8 d
一、實(shí)驗(yàn)準(zhǔn)備痞子衡用i.MXRT1050-EVKB來做這個(gè)AHB讀訪問實(shí)驗(yàn),這塊板子上的Flash被痞子衡更換過,目前的型號(hào)是華邦W25Q64JWS-IQ。我們基于 \SDK_2.9.1_EVKB-IMXRT1050\boards\evkbimxrt1050\demo_apps\led_blinky\iar 例程(記得切換到 flexspi_nor_debug build)來簡(jiǎn)單修改一下,把啟動(dòng)頭FDCB修改如下,設(shè)置Flash工作于30MHz Fast Read Quad I/O SDR模式,調(diào)成30MHz低速是為了方便后續(xù)用示波器抓Flash信號(hào)去分析。( ?/ d) x3 N6 E/ ?
const flexspi_nor_config_t qspiflash_config = {. D7 P; |- T& m' x) s- [! `6 G
.memconfig =
) |4 m7 \% G6 P* @ {! H6 x3 D4 u7 M1 U
.tag = FLEXSPI_CFG_BLK_TAG,
, s- p8 K6 n: o" z( `! S .version = FLEXSPI_CFG_BLK_VERSION,
* G/ E" w7 w! b .readSampleClkSrc = kFlexSPIReadSampleClk_LoopbackFromDqsPad,
" A" ?: p9 o+ ~, ^" I .csHoldTime = 3u,
# X" ]& Y* ]- {2 J .csSetupTime = 3u,
E' }0 S% ?; K .controllerMiscOption = 0x10,% Z5 b0 D( |$ a0 ~" n3 A& B/ N/ s F
.deviceType = kFlexSpiDeviceType_SerialNOR,! N+ q1 a8 K l3 N& ]& d
.sflashPadType = kSerialFlash_4pads,; u: k4 ~: x1 _
// Flash工作于30MHz% l, p5 o, n0 Z( S
.serialClkFreq = kFlexSpiSerialClk_30MHz,
/ g% Z% l& S4 d5 d" M+ H; H .sflashA1Size = 8u * 1024u * 1024u,# }* N! A7 q. z
.lookupTable =1 \! o; D$ X. l# Y' x
{' q. {7 q. _, ?# ^ V9 T; H4 s4 B
// Quad I/O Fast Read SDR LUTs
x" b" d4 ?& D [4*CMD_LUT_SEQ_IDX_READ + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB, RADDR_SDR, FLEXSPI_4PAD, 0x18), c/ Q8 [& s/ P/ M2 f: q) V
[4*CMD_LUT_SEQ_IDX_READ + 1] = FLEXSPI_LUT_SEQ(MODE8_SDR, FLEXSPI_4PAD, 0xF0, DUMMY_SDR, FLEXSPI_4PAD, 0x04),. @) U% t" \% }$ ^0 O- u- Z) W1 n8 ?
[4*CMD_LUT_SEQ_IDX_READ + 2] = FLEXSPI_LUT_SEQ(READ_SDR, FLEXSPI_4PAD, 0x04, STOP, FLEXSPI_1PAD, 0x00),' o7 A) W# g+ b4 M% r
[4*CMD_LUT_SEQ_IDX_READ + 3] = 0,
! E1 F$ W5 D& G( X T. f& X3 Q },
, J, F7 y# z& ~) R6 x3 K4 y# ~+ a },
/ D. L3 t6 |4 l .pageSize = 256u,) K/ m; H" ]& g
.sectorSize = 4u * 1024u,/ P1 ?* j; J3 {$ V: p5 ~
.blockSize = 64u * 1024u," A* ^& \+ x/ A" F1 I2 v
.isUniformBlockSize = false,& ^6 c4 I: K8 \. B& G
};7 r1 A* x; S; Z2 _( s; l! M
下圖是華邦W25Q64JWS-IQ芯片的Fast Read Quad I/O SDR傳輸時(shí)序圖,Dummy Cycle連同MODE8_SDR序列一共6個(gè)SCK周期,此外還有個(gè)特別注意點(diǎn),MODE8_SDR序列參數(shù)值需要被設(shè)成0xFx,我們上面修改的FDCB啟動(dòng)頭是符合要求的。 |
|