<?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: Implement example flexspi_nor_polling_transfer in project based on FreeRTOS in i.MX RT Crossover MCUs</title>
    <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Implement-example-flexspi-nor-polling-transfer-in-project-based/m-p/2038667#M33384</link>
    <description>This resolved the issue for me too on the iMXRT1062. Thank you!</description>
    <pubDate>Wed, 05 Feb 2025 14:54:46 GMT</pubDate>
    <dc:creator>matt0x000C</dc:creator>
    <dc:date>2025-02-05T14:54:46Z</dc:date>
    <item>
      <title>Implement example flexspi_nor_polling_transfer in project based on FreeRTOS</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Implement-example-flexspi-nor-polling-transfer-in-project-based/m-p/865669#M2070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I try to work with flash memory on MIMXRT1020-EVK&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I added files from SDK&amp;nbsp;example, after calling flexspi_nor_flash_init(EXAMPLE_FLEXSPI) my program have an error&amp;nbsp;in line&amp;nbsp;236, file fsl_flexspi.c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to find and fix this problem?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jan 2019 08:35:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Implement-example-flexspi-nor-polling-transfer-in-project-based/m-p/865669#M2070</guid>
      <dc:creator>nbe</dc:creator>
      <dc:date>2019-01-28T08:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: Implement example flexspi_nor_polling_transfer in project based on FreeRTOS</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Implement-example-flexspi-nor-polling-transfer-in-project-based/m-p/865670#M2071</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nazarii,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Do you run the official flexspi_nor polling project directly on your side, whether it works or not?&lt;/P&gt;&lt;P&gt;&amp;nbsp; Besides, if your modified project have problems, it's better to share the whole project which can reproduce the problem, then we can help you to check it more easily.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2019 11:58:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Implement-example-flexspi-nor-polling-transfer-in-project-based/m-p/865670#M2071</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2019-01-29T11:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: Implement example flexspi_nor_polling_transfer in project based on FreeRTOS</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Implement-example-flexspi-nor-polling-transfer-in-project-based/m-p/1473660#M20120</link>
      <description>&lt;P&gt;Hi everyone,&lt;BR /&gt;did someone make progress on this topic?&lt;BR /&gt;I'm encountering the same problem.&lt;BR /&gt;At first I developed a FreeRTOS code doing other stuff, imported nxp example&amp;nbsp;evkmimxrt1060_flexspi_nor_polling_transfer relevant files and configurations, but code crashed almost instantaneously.&lt;BR /&gt;Then to verify that every small difference from nxp example to mine own project are ok, I simply added into the nxp example the freertos task doing the exact same things the previous baremetal main did, and suddenly the flash started hardfaulting and also reebooting!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;int main(void)
{
    BOARD_ConfigMPU();
    BOARD_InitBootPins();
    BOARD_InitBootClocks();
    BOARD_InitDebugConsole();

if (xTaskCreate(flwexspi_nor_polling_task, "flwexspi_nor_polling_task", 512, NULL, 3, NULL) != pdPASS)
	{
		PRINTF("Task creation failed.");
	}

    vTaskStartScheduler();
    
    //code section never reached
    return 0;
}&lt;/LI-CODE&gt;&lt;P&gt;and then the task simply is&lt;/P&gt;&lt;LI-CODE lang="c"&gt;void flwexspi_nor_polling_task(void *param)
{
	uint32_t i = 0;
	status_t status;
	uint8_t vendorID = 0;

	 flexspi_nor_flash_init(EXAMPLE_FLEXSPI);

	    PRINTF("\r\nFLEXSPI example started!\r\n");

	    /* Get vendor ID. */
	    status = flexspi_nor_get_vendor_id(EXAMPLE_FLEXSPI, &amp;amp;vendorID);
	    if (status != kStatus_Success)
	    {
	        return status;
	    }
	    PRINTF("Vendor ID: 0x%x\r\n", vendorID);

	#if !(defined(XIP_EXTERNAL_FLASH))
	    /* Erase whole chip . */
	    PRINTF("Erasing whole chip over FlexSPI...\r\n");

	    status = flexspi_nor_erase_chip(EXAMPLE_FLEXSPI);
	    if (status != kStatus_Success)
	    {
	        return status;
	    }
	    PRINTF("Erase finished !\r\n");

	#endif

	    /* Enter quad mode. */
	    status = flexspi_nor_enable_quad_mode(EXAMPLE_FLEXSPI);
	    if (status != kStatus_Success)
	    {
	        return status;
	    }

	    /* Erase sectors. */
	    PRINTF("Erasing Serial NOR over FlexSPI...\r\n");
	    status = flexspi_nor_flash_erase_sector(EXAMPLE_FLEXSPI, EXAMPLE_SECTOR * SECTOR_SIZE);
	    if (status != kStatus_Success)
	    {
	        PRINTF("Erase sector failure !\r\n");
	        return -1;
	    }

	    memset(s_nor_program_buffer, 0xFFU, sizeof(s_nor_program_buffer));

	    DCACHE_InvalidateByRange(EXAMPLE_FLEXSPI_AMBA_BASE + EXAMPLE_SECTOR * SECTOR_SIZE, FLASH_PAGE_SIZE);

	    memcpy(s_nor_read_buffer, (void *)(EXAMPLE_FLEXSPI_AMBA_BASE + EXAMPLE_SECTOR * SECTOR_SIZE),
	           sizeof(s_nor_read_buffer));

	    if (memcmp(s_nor_program_buffer, s_nor_read_buffer, sizeof(s_nor_program_buffer)))
	    {
	        PRINTF("Erase data -  read out data value incorrect !\r\n ");
	        return -1;
	    }
	    else
	    {
	        PRINTF("Erase data - successfully. \r\n");
	    }

	    for (i = 0; i &amp;lt; 0xFFU; i++)
	    {
	        s_nor_program_buffer[i] = i;
	    }

	    status =
	        flexspi_nor_flash_page_program(EXAMPLE_FLEXSPI, EXAMPLE_SECTOR * SECTOR_SIZE, (void *)s_nor_program_buffer);
	    if (status != kStatus_Success)
	    {
	        PRINTF("Page program failure !\r\n");
	        return -1;
	    }

	    DCACHE_InvalidateByRange(EXAMPLE_FLEXSPI_AMBA_BASE + EXAMPLE_SECTOR * SECTOR_SIZE, FLASH_PAGE_SIZE);

	    memcpy(s_nor_read_buffer, (void *)(EXAMPLE_FLEXSPI_AMBA_BASE + EXAMPLE_SECTOR * SECTOR_SIZE),
	           sizeof(s_nor_read_buffer));

	    if (memcmp(s_nor_read_buffer, s_nor_program_buffer, sizeof(s_nor_program_buffer)) != 0)
	    {
	        PRINTF("Program data -  read out data value incorrect !\r\n ");
	        return -1;
	    }
	    else
	    {
	        PRINTF("Program data - successfully. \r\n");
	    }

	    while (1)
	    {
	    }
}&lt;/LI-CODE&gt;&lt;P&gt;Ads I said, nothing changed except for the FreeRTOS initialization and usage!&lt;BR /&gt;&lt;BR /&gt;Any suggestion?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2022 13:04:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Implement-example-flexspi-nor-polling-transfer-in-project-based/m-p/1473660#M20120</guid>
      <dc:creator>simpledeveloper</dc:creator>
      <dc:date>2022-06-14T13:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: Implement example flexspi_nor_polling_transfer in project based on FreeRTOS</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Implement-example-flexspi-nor-polling-transfer-in-project-based/m-p/1475208#M20146</link>
      <description>&lt;P&gt;Solved&lt;BR /&gt;Problem is freertos preemption during flash operations.&lt;BR /&gt;In the middle of the execution of some&amp;nbsp;&lt;SPAN&gt;evkmimxrt1060_flexspi_nor_polling_transfer&amp;nbsp;operations in flash (in particular into FLEXSPI_TransferBlocking), freertos tries to fetch instructions from flash, busy flash gives wrong values to the instruction unit, 0xFFFFFFFD in my case corresponding to a Reserved portion of the memory map table, resulting into hard fault.&lt;BR /&gt;&lt;BR /&gt;Solution: taskENTER_CRITICAL() and&amp;nbsp;taskEXIT_CRITICAL() before and after every single flash operation into&amp;nbsp;evkmimxrt1060_flexspi_nor_polling_transfer , blocking all interrupts during every single flash operation of the example.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;        taskENTER_CRITICAL();
	flexspi_nor_flash_init(EXAMPLE_FLEXSPI);
	taskEXIT_CRITICAL();

	PRINTF("\r\nFLEXSPI example started!\r\n");

	/* Get vendor ID. */
	taskENTER_CRITICAL();
	status = flexspi_nor_get_vendor_id(EXAMPLE_FLEXSPI, &amp;amp;vendorID);
	taskEXIT_CRITICAL();
	if (status != kStatus_Success)
	{
		return status;
	}
	PRINTF("Vendor ID: 0x%x\r\n", vendorID);

#if !(defined(XIP_EXTERNAL_FLASH))
	/* Erase whole chip . */
	PRINTF("Erasing whole chip over FlexSPI...\r\n");

	status = flexspi_nor_erase_chip(EXAMPLE_FLEXSPI);
	if (status != kStatus_Success)
	{
		return status;
	}
	PRINTF("Erase finished !\r\n");

#endif

	/* Enter quad mode. */
	taskENTER_CRITICAL();
	status = flexspi_nor_enable_quad_mode(EXAMPLE_FLEXSPI);
	taskEXIT_CRITICAL();
	if (status != kStatus_Success)
	{
		return status;
	}

	/* Erase sectors. */
	PRINTF("Erasing Serial NOR over FlexSPI...\r\n");
	taskENTER_CRITICAL();
	status = flexspi_nor_flash_erase_sector(EXAMPLE_FLEXSPI, EXAMPLE_SECTOR * SECTOR_SIZE);
	taskEXIT_CRITICAL();
	if (status != kStatus_Success)
	{
		PRINTF("Erase sector failure !\r\n");
		return -1;
	}

	memset(s_nor_program_buffer, 0xFFU, sizeof(s_nor_program_buffer));

	DCACHE_InvalidateByRange(EXAMPLE_FLEXSPI_AMBA_BASE + EXAMPLE_SECTOR * SECTOR_SIZE, FLASH_PAGE_SIZE);

	memcpy(s_nor_read_buffer, (void *)(EXAMPLE_FLEXSPI_AMBA_BASE + EXAMPLE_SECTOR * SECTOR_SIZE),
		   sizeof(s_nor_read_buffer));

	if (memcmp(s_nor_program_buffer, s_nor_read_buffer, sizeof(s_nor_program_buffer)))
	{
		PRINTF("Erase data -  read out data value incorrect !\r\n ");
		return -1;
	}
	else
	{
		PRINTF("Erase data - successfully. \r\n");
	}

	for (i = 0; i &amp;lt; 0xFFU; i++)
	{
		s_nor_program_buffer[i] = i;
	}

	taskENTER_CRITICAL();
	status =
		flexspi_nor_flash_page_program(EXAMPLE_FLEXSPI, EXAMPLE_SECTOR * SECTOR_SIZE, (void *)s_nor_program_buffer);
	taskEXIT_CRITICAL();
	if (status != kStatus_Success)
	{
		PRINTF("Page program failure !\r\n");
		return -1;
	}

	DCACHE_InvalidateByRange(EXAMPLE_FLEXSPI_AMBA_BASE + EXAMPLE_SECTOR * SECTOR_SIZE, FLASH_PAGE_SIZE);

	memcpy(s_nor_read_buffer, (void *)(EXAMPLE_FLEXSPI_AMBA_BASE + EXAMPLE_SECTOR * SECTOR_SIZE),
		   sizeof(s_nor_read_buffer));

	if (memcmp(s_nor_read_buffer, s_nor_program_buffer, sizeof(s_nor_program_buffer)) != 0)
	{
		PRINTF("Program data -  read out data value incorrect !\r\n ");
		return -1;
	}
	else
	{
		PRINTF("Program data - successfully. \r\n");
	}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;Please consider to give kudos ans mark this answer as "solution" for the community.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2022 09:51:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Implement-example-flexspi-nor-polling-transfer-in-project-based/m-p/1475208#M20146</guid>
      <dc:creator>simpledeveloper</dc:creator>
      <dc:date>2022-06-16T09:51:06Z</dc:date>
    </item>
    <item>
      <title>Re: Implement example flexspi_nor_polling_transfer in project based on FreeRTOS</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Implement-example-flexspi-nor-polling-transfer-in-project-based/m-p/2038667#M33384</link>
      <description>This resolved the issue for me too on the iMXRT1062. Thank you!</description>
      <pubDate>Wed, 05 Feb 2025 14:54:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Implement-example-flexspi-nor-polling-transfer-in-project-based/m-p/2038667#M33384</guid>
      <dc:creator>matt0x000C</dc:creator>
      <dc:date>2025-02-05T14:54:46Z</dc:date>
    </item>
  </channel>
</rss>

