<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Help needed to understand NOR Flash customLUT in i.MX RT Crossover MCUs</title>
    <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Help-needed-to-understand-NOR-Flash-customLUT/m-p/2088104#M34165</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am implementing an application to do NOR Flash operations on a custom board. MCU - iMXRT1040, SDK - mcuXpresso SDK v2.16&lt;/P&gt;&lt;P&gt;I am trying to understand the "flexspi\nor\polling_transfer" example, specifically the customLUT section in "flexspi_nor_polling_transfer.c":&lt;/P&gt;&lt;LI-CODE lang="c"&gt;const uint32_t customLUT[CUSTOM_LUT_LENGTH] = {
    /* Normal read mode -SDR */
    [4 * NOR_CMD_LUT_SEQ_IDX_READ_NORMAL] =
        FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x03, kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_1PAD, 0x18),
    [4 * NOR_CMD_LUT_SEQ_IDX_READ_NORMAL + 1] =
        FLEXSPI_LUT_SEQ(kFLEXSPI_Command_READ_SDR, kFLEXSPI_1PAD, 0x04, kFLEXSPI_Command_STOP, kFLEXSPI_1PAD, 0),

    /* Fast read mode - SDR */
    [4 * NOR_CMD_LUT_SEQ_IDX_READ_FAST] =
        FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x0B, kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_1PAD, 0x18),
    [4 * NOR_CMD_LUT_SEQ_IDX_READ_FAST + 1] = FLEXSPI_LUT_SEQ(
        kFLEXSPI_Command_DUMMY_SDR, kFLEXSPI_1PAD, 0x08, kFLEXSPI_Command_READ_SDR, kFLEXSPI_1PAD, 0x04),

    /* Fast read quad mode - SDR */
    [4 * NOR_CMD_LUT_SEQ_IDX_READ_FAST_QUAD] =
        FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0xEB, kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_4PAD, 0x18),
    [4 * NOR_CMD_LUT_SEQ_IDX_READ_FAST_QUAD + 1] = FLEXSPI_LUT_SEQ(
        kFLEXSPI_Command_DUMMY_SDR, kFLEXSPI_4PAD, 0x06, kFLEXSPI_Command_READ_SDR, kFLEXSPI_4PAD, 0x04),
...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I see the array initialization is not sequencial, i.e. the first item "&lt;SPAN&gt;NOR_CMD_LUT_SEQ_IDX_READ_NORMAL&lt;/SPAN&gt;" is initializing array element 7, the 2nd item "&lt;SPAN&gt;NOR_CMD_LUT_SEQ_IDX_READ_FAST&lt;/SPAN&gt;" is initializing array element 13.&lt;/P&gt;&lt;P&gt;The below macros defined in "app.h" are the indexes but they are random.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;#define NOR_CMD_LUT_SEQ_IDX_READ_NORMAL        7
#define NOR_CMD_LUT_SEQ_IDX_READ_FAST          13
#define NOR_CMD_LUT_SEQ_IDX_READ_FAST_QUAD     0
#define NOR_CMD_LUT_SEQ_IDX_READSTATUS         1
#define NOR_CMD_LUT_SEQ_IDX_WRITEENABLE        2
#define NOR_CMD_LUT_SEQ_IDX_ERASESECTOR        3
#define NOR_CMD_LUT_SEQ_IDX_PAGEPROGRAM_SINGLE 6
#define NOR_CMD_LUT_SEQ_IDX_PAGEPROGRAM_QUAD   4
#define NOR_CMD_LUT_SEQ_IDX_READID             8
#define NOR_CMD_LUT_SEQ_IDX_WRITESTATUSREG     9
#define NOR_CMD_LUT_SEQ_IDX_ENTERQPI           10
#define NOR_CMD_LUT_SEQ_IDX_EXITQPI            11
#define NOR_CMD_LUT_SEQ_IDX_READSTATUSREG      12
#define NOR_CMD_LUT_SEQ_IDX_ERASECHIP          5&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My questions are:&lt;/P&gt;&lt;P&gt;- why these indexes are not sequential, is there any particular reason?&lt;/P&gt;&lt;P&gt;- am I misunderstanding the customLUT initializer?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;RD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 28 Apr 2025 07:50:38 GMT</pubDate>
    <dc:creator>rd24</dc:creator>
    <dc:date>2025-04-28T07:50:38Z</dc:date>
    <item>
      <title>Help needed to understand NOR Flash customLUT</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Help-needed-to-understand-NOR-Flash-customLUT/m-p/2088104#M34165</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am implementing an application to do NOR Flash operations on a custom board. MCU - iMXRT1040, SDK - mcuXpresso SDK v2.16&lt;/P&gt;&lt;P&gt;I am trying to understand the "flexspi\nor\polling_transfer" example, specifically the customLUT section in "flexspi_nor_polling_transfer.c":&lt;/P&gt;&lt;LI-CODE lang="c"&gt;const uint32_t customLUT[CUSTOM_LUT_LENGTH] = {
    /* Normal read mode -SDR */
    [4 * NOR_CMD_LUT_SEQ_IDX_READ_NORMAL] =
        FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x03, kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_1PAD, 0x18),
    [4 * NOR_CMD_LUT_SEQ_IDX_READ_NORMAL + 1] =
        FLEXSPI_LUT_SEQ(kFLEXSPI_Command_READ_SDR, kFLEXSPI_1PAD, 0x04, kFLEXSPI_Command_STOP, kFLEXSPI_1PAD, 0),

    /* Fast read mode - SDR */
    [4 * NOR_CMD_LUT_SEQ_IDX_READ_FAST] =
        FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x0B, kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_1PAD, 0x18),
    [4 * NOR_CMD_LUT_SEQ_IDX_READ_FAST + 1] = FLEXSPI_LUT_SEQ(
        kFLEXSPI_Command_DUMMY_SDR, kFLEXSPI_1PAD, 0x08, kFLEXSPI_Command_READ_SDR, kFLEXSPI_1PAD, 0x04),

    /* Fast read quad mode - SDR */
    [4 * NOR_CMD_LUT_SEQ_IDX_READ_FAST_QUAD] =
        FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0xEB, kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_4PAD, 0x18),
    [4 * NOR_CMD_LUT_SEQ_IDX_READ_FAST_QUAD + 1] = FLEXSPI_LUT_SEQ(
        kFLEXSPI_Command_DUMMY_SDR, kFLEXSPI_4PAD, 0x06, kFLEXSPI_Command_READ_SDR, kFLEXSPI_4PAD, 0x04),
...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I see the array initialization is not sequencial, i.e. the first item "&lt;SPAN&gt;NOR_CMD_LUT_SEQ_IDX_READ_NORMAL&lt;/SPAN&gt;" is initializing array element 7, the 2nd item "&lt;SPAN&gt;NOR_CMD_LUT_SEQ_IDX_READ_FAST&lt;/SPAN&gt;" is initializing array element 13.&lt;/P&gt;&lt;P&gt;The below macros defined in "app.h" are the indexes but they are random.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;#define NOR_CMD_LUT_SEQ_IDX_READ_NORMAL        7
#define NOR_CMD_LUT_SEQ_IDX_READ_FAST          13
#define NOR_CMD_LUT_SEQ_IDX_READ_FAST_QUAD     0
#define NOR_CMD_LUT_SEQ_IDX_READSTATUS         1
#define NOR_CMD_LUT_SEQ_IDX_WRITEENABLE        2
#define NOR_CMD_LUT_SEQ_IDX_ERASESECTOR        3
#define NOR_CMD_LUT_SEQ_IDX_PAGEPROGRAM_SINGLE 6
#define NOR_CMD_LUT_SEQ_IDX_PAGEPROGRAM_QUAD   4
#define NOR_CMD_LUT_SEQ_IDX_READID             8
#define NOR_CMD_LUT_SEQ_IDX_WRITESTATUSREG     9
#define NOR_CMD_LUT_SEQ_IDX_ENTERQPI           10
#define NOR_CMD_LUT_SEQ_IDX_EXITQPI            11
#define NOR_CMD_LUT_SEQ_IDX_READSTATUSREG      12
#define NOR_CMD_LUT_SEQ_IDX_ERASECHIP          5&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My questions are:&lt;/P&gt;&lt;P&gt;- why these indexes are not sequential, is there any particular reason?&lt;/P&gt;&lt;P&gt;- am I misunderstanding the customLUT initializer?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;RD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Apr 2025 07:50:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Help-needed-to-understand-NOR-Flash-customLUT/m-p/2088104#M34165</guid>
      <dc:creator>rd24</dc:creator>
      <dc:date>2025-04-28T07:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: Help needed to understand NOR Flash customLUT</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Help-needed-to-understand-NOR-Flash-customLUT/m-p/2088593#M34175</link>
      <description>&lt;P&gt;Ah yeah I've dug into this before in my work on Mbed. These indices are just chosen arbitrarily. The LUT has 16 sequence entries, all identical, and the SW can put each sequence in any location. The only real restriction is that if a sequence is longer than 8 instructions (I think) it will take up multiple sequential entries in the LUT.&lt;/P&gt;&lt;P&gt;How does it "know" which one to execute? Well, for regular (AHB bus) reads and writes to the flash, this is controlled via the FLSHxxCR2 ARDSEQID and AWRSEQID fields. These are generally set by the software to point to the read and write sequences in the LUT. If you are using the FSL HAL, this is configured via flexspi_device_config_t::ARDSeqIdx and flexspi_device_config_t::AWRSeqIdx.&lt;/P&gt;&lt;P&gt;And for things outside of reads and writes, these are done by simply telling FlexSPI to execute a specific sequence number with FLEXSPI_TransferBlocking(). So the FlexSPI doesn't actually need to know what the sequences do.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Apr 2025 17:52:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Help-needed-to-understand-NOR-Flash-customLUT/m-p/2088593#M34175</guid>
      <dc:creator>MultipleMonomials</dc:creator>
      <dc:date>2025-04-28T17:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: Help needed to understand NOR Flash customLUT</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Help-needed-to-understand-NOR-Flash-customLUT/m-p/2089361#M34194</link>
      <description>&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;So, if I modify these indexes in any order it should work right?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Apr 2025 12:46:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Help-needed-to-understand-NOR-Flash-customLUT/m-p/2089361#M34194</guid>
      <dc:creator>rd24</dc:creator>
      <dc:date>2025-04-29T12:46:08Z</dc:date>
    </item>
    <item>
      <title>Re: Help needed to understand NOR Flash customLUT</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Help-needed-to-understand-NOR-Flash-customLUT/m-p/2089626#M34199</link>
      <description>&lt;P&gt;Should do!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Apr 2025 19:05:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Help-needed-to-understand-NOR-Flash-customLUT/m-p/2089626#M34199</guid>
      <dc:creator>MultipleMonomials</dc:creator>
      <dc:date>2025-04-29T19:05:58Z</dc:date>
    </item>
  </channel>
</rss>

