<?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 Re: FlexSPI with AHB prefetch causes hard fault in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/FlexSPI-with-AHB-prefetch-causes-hard-fault/m-p/2332293#M244471</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;you can try master id=6&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I tried master ID 6, and the hard fault still occurs.&lt;BR /&gt;&lt;BR /&gt;I'm configuring an 8-byte buffer in slot 0 for master ID 6. At the SDK level:&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;    flexspi_config_t config;
    FLEXSPI_GetDefaultConfig(&amp;amp;config);
    config.ahbConfig.enableAHBPrefetch    = true;
    config.ahbConfig.buffer[0].masterIndex = 6;
    config.ahbConfig.buffer[0].bufferSize = 8;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;This results in the following&amp;nbsp;AHBRXBUF register contents:&lt;/P&gt;&lt;PRE&gt;AHBRXBUF0CR0 0x80060001
AHBRXBUF1CR0 0x800f0000
AHBRXBUF2CR0 0x800f0000
AHBRXBUF3CR0 0x800f0000
AHBRXBUF4CR0 0x800f0000
AHBRXBUF5CR0 0x800f0000
AHBRXBUF6CR0 0x80000020
AHBRXBUF7CR0 0x80000020&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 13 Mar 2026 08:23:49 GMT</pubDate>
    <dc:creator>stmatscaps</dc:creator>
    <dc:date>2026-03-13T08:23:49Z</dc:date>
    <item>
      <title>FlexSPI with AHB prefetch causes hard fault</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/FlexSPI-with-AHB-prefetch-causes-hard-fault/m-p/2331255#M244453</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;we have a custom board with an i MX.8 M Nano chip that communicates via FlexSPI with an FPGA with AHB reads and writes from the CM7 core. This is working fine in general.&lt;/P&gt;&lt;P&gt;Now we are looking into improving the performance by enabling prefetch for AHB reads.&lt;/P&gt;&lt;P&gt;The relevant FlexSPI configuration looks like this:&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;    flexspi_config_t config;
    FLEXSPI_GetDefaultConfig(&amp;amp;config);

    config.enableSckFreeRunning = true;
    config.ahbConfig.enableAHBPrefetch    = true;
    config.ahbConfig.enableAHBBufferable  = false;
    config.ahbConfig.enableReadAddressOpt = false;
    config.ahbConfig.enableAHBCachable    = false;
    config.rxSampleClock = kFLEXSPI_ReadSampleClkExternalInputFromDqsPad;
    config.enableCombination = true;

    FLEXSPI_Init(FLEXSPI, &amp;amp;config);&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;With "&lt;SPAN&gt;config&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;ahbConfig&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;enableAHBPrefetch&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;true&lt;/SPAN&gt;&lt;SPAN&gt;;" we are getting the hard fault on the first AHB read attempt, while with&amp;nbsp;"&lt;SPAN&gt;config&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;ahbConfig&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;enableAHBPrefetch&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;false&lt;/SPAN&gt;&lt;SPAN&gt;;" everything is working as expected. I can see with a logic analyzer that with&amp;nbsp;"config.ahbConfig.enableAHBPrefetch = true;" there is no activity at all on the SPI bus when the AHB read is triggered, the hard fault occurs immediately.&lt;BR /&gt;&lt;BR /&gt;What can be the reason for the hard fault if only AHB prefetch is enabled with no other changes compared to the working configuration? Are we missing further settings that need to be changed from the default to make AHB prefetch work?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;In that context we also want to configure the prefetch size. Section "10.2.4.10.3 AHB RX Buffer Management" of the&amp;nbsp;i.MX 8M Nano Applications Processor&amp;nbsp;Reference Manual describes how to configure the prefetch sizes for different master IDs.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Where are the "master IDs" documented, and what is the master ID for the CM7 core in this context? I was not able not find this information in the Reference Manual.&lt;BR /&gt;&lt;BR /&gt;Thank you&lt;BR /&gt;Stephan&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2026 09:33:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/FlexSPI-with-AHB-prefetch-causes-hard-fault/m-p/2331255#M244453</guid>
      <dc:creator>stmatscaps</dc:creator>
      <dc:date>2026-03-12T09:33:07Z</dc:date>
    </item>
    <item>
      <title>Re: FlexSPI with AHB prefetch causes hard fault</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/FlexSPI-with-AHB-prefetch-causes-hard-fault/m-p/2332221#M244469</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/219896"&gt;@stmatscaps&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Configuring the AHB RX Buffer is necessary, but the RM hides the CM7 master ID. I need some time to confirm the exact value. In the meantime, you can try master id=6.&lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;Zhiming&lt;/P&gt;</description>
      <pubDate>Fri, 13 Mar 2026 06:33:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/FlexSPI-with-AHB-prefetch-causes-hard-fault/m-p/2332221#M244469</guid>
      <dc:creator>Zhiming_Liu</dc:creator>
      <dc:date>2026-03-13T06:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: FlexSPI with AHB prefetch causes hard fault</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/FlexSPI-with-AHB-prefetch-causes-hard-fault/m-p/2332276#M244470</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&amp;nbsp;,&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;but the RM hides the CM7 master ID&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Do I understand it correctly that "RM" means Reference Manual?&lt;/P&gt;&lt;P&gt;And when you confirm the master ID, could you please document all master IDs for future reference here?&lt;/P&gt;&lt;P&gt;I see that the function&amp;nbsp;&lt;SPAN&gt;FLEXSPI_GetDefaultConfig() in the MCUXPresso SDK configures a 256 byte RX buffer in&amp;nbsp;AHBRXBUF6CR0 for master ID 0:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://github.com/nxp-mcuxpresso/mcuxsdk-core/blob/4cc1d817b8142fed4fd6cfcbcf0a393a954a425b/drivers/flexspi/fsl_flexspi.c#L449-L464" target="_blank"&gt;https://github.com/nxp-mcuxpresso/mcuxsdk-core/blob/4cc1d817b8142fed4fd6cfcbcf0a393a954a425b/drivers/flexspi/fsl_flexspi.c#L449-L464&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;    FLEXSPI_Memset(config-&amp;gt;ahbConfig.buffer, 0, sizeof(config-&amp;gt;ahbConfig.buffer));
    /* Use invalid master ID 0xF and buffer size 0 for the first several buffers. */
    for (uint8_t i = 0; i &amp;lt; ((uint8_t)FSL_FEATURE_FLEXSPI_AHB_BUFFER_COUNT - 2U); i++)
    {
        config-&amp;gt;ahbConfig.buffer[i].enablePrefetch = true; /* Default enable AHB prefetch. */
        config-&amp;gt;ahbConfig.buffer[i].masterIndex = 0xFU; /* Invalid master index which is not used, so will never hit. */
        config-&amp;gt;ahbConfig.buffer[i].bufferSize =
            0; /* Default buffer size 0 for buffer0 to buffer(FSL_FEATURE_FLEXSPI_AHB_BUFFER_COUNT - 3U)*/
    }

    for (uint8_t i = ((uint8_t)FSL_FEATURE_FLEXSPI_AHB_BUFFER_COUNT - 2U);
         i &amp;lt; (uint8_t)FSL_FEATURE_FLEXSPI_AHB_BUFFER_COUNT; i++)
    {
        config-&amp;gt;ahbConfig.buffer[i].enablePrefetch = true; /* Default enable AHB prefetch. */
        config-&amp;gt;ahbConfig.buffer[i].bufferSize     = 256U; /* Default buffer size 256 bytes. */
    }&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Thank you&lt;BR /&gt;Stephan&lt;/P&gt;</description>
      <pubDate>Fri, 13 Mar 2026 08:04:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/FlexSPI-with-AHB-prefetch-causes-hard-fault/m-p/2332276#M244470</guid>
      <dc:creator>stmatscaps</dc:creator>
      <dc:date>2026-03-13T08:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: FlexSPI with AHB prefetch causes hard fault</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/FlexSPI-with-AHB-prefetch-causes-hard-fault/m-p/2332293#M244471</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;you can try master id=6&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I tried master ID 6, and the hard fault still occurs.&lt;BR /&gt;&lt;BR /&gt;I'm configuring an 8-byte buffer in slot 0 for master ID 6. At the SDK level:&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;    flexspi_config_t config;
    FLEXSPI_GetDefaultConfig(&amp;amp;config);
    config.ahbConfig.enableAHBPrefetch    = true;
    config.ahbConfig.buffer[0].masterIndex = 6;
    config.ahbConfig.buffer[0].bufferSize = 8;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;This results in the following&amp;nbsp;AHBRXBUF register contents:&lt;/P&gt;&lt;PRE&gt;AHBRXBUF0CR0 0x80060001
AHBRXBUF1CR0 0x800f0000
AHBRXBUF2CR0 0x800f0000
AHBRXBUF3CR0 0x800f0000
AHBRXBUF4CR0 0x800f0000
AHBRXBUF5CR0 0x800f0000
AHBRXBUF6CR0 0x80000020
AHBRXBUF7CR0 0x80000020&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Mar 2026 08:23:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/FlexSPI-with-AHB-prefetch-causes-hard-fault/m-p/2332293#M244471</guid>
      <dc:creator>stmatscaps</dc:creator>
      <dc:date>2026-03-13T08:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: FlexSPI with AHB prefetch causes hard fault</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/FlexSPI-with-AHB-prefetch-causes-hard-fault/m-p/2339045#M244628</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/151788"&gt;@Zhiming_Liu&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;do you have an update regarding the master IDs in the meantime?&lt;BR /&gt;&lt;BR /&gt;Thank you&lt;BR /&gt;Stephan&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2026 07:48:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/FlexSPI-with-AHB-prefetch-causes-hard-fault/m-p/2339045#M244628</guid>
      <dc:creator>stmatscaps</dc:creator>
      <dc:date>2026-03-25T07:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: FlexSPI with AHB prefetch causes hard fault</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/FlexSPI-with-AHB-prefetch-causes-hard-fault/m-p/2339782#M244644</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/219896"&gt;@stmatscaps&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;This is still being verified; we need the R&amp;amp;D team to provide the information.&lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;Zhiming&lt;/P&gt;</description>
      <pubDate>Thu, 26 Mar 2026 06:23:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/FlexSPI-with-AHB-prefetch-causes-hard-fault/m-p/2339782#M244644</guid>
      <dc:creator>Zhiming_Liu</dc:creator>
      <dc:date>2026-03-26T06:23:53Z</dc:date>
    </item>
  </channel>
</rss>

