<?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: Flash write stalls in i.MX RT Crossover MCUs</title>
    <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Flash-write-stalls/m-p/1328028#M16004</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/187150"&gt;@Robert123&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I think to ensure the communication in the ethernet side your workaround would be the best option.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Alexis Andalon&lt;/P&gt;</description>
    <pubDate>Mon, 23 Aug 2021 23:13:10 GMT</pubDate>
    <dc:creator>Alexis_A</dc:creator>
    <dc:date>2021-08-23T23:13:10Z</dc:date>
    <item>
      <title>Flash write stalls</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Flash-write-stalls/m-p/1323272#M15867</link>
      <description>&lt;P&gt;Hi, I am writing an application which downloads a new image (over-the-air update) from a HTTP server.&lt;/P&gt;&lt;P&gt;The size of the new image is a bit larger than 400 kbytes. After approximately 100-200 kbytes the write to the flash memory fails/stalls. I cannot get any useful information from the debugger.&lt;/P&gt;&lt;P&gt;I disable the interrupts and enable between each write to the flash as shown below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;unsigned char https_buf[1024];

int read_request()
{
	do
	{
		len = sizeof(https_buf);
		memset(https_buf, 0, sizeof(https_buf));
		ret = lwip_recv(tlsDataParams.fd, https_buf, len, 0);
		if (ret == 0)
		{
		PRINTF("\n\nEOF\r\n");
			goto exit;
		}

		uint32_t regPrimask = DisableGlobalIRQ();
		result = mflash_drv_write(chunk_addr, (uint8_t*)https_buf, len);
		EnableGlobalIRQ(regPrimask);
	} while (1);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using a Embedded Artists imx-rt1062-developers-kit with the following SDK: eaimxrt1062_sdk_2.9.3_freertos. The flash memory is a Adesto XIP.&lt;/P&gt;&lt;P&gt;Could you give any hints on why the write to flash stalls?&lt;/P&gt;</description>
      <pubDate>Mon, 16 Aug 2021 11:43:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Flash-write-stalls/m-p/1323272#M15867</guid>
      <dc:creator>Robert123</dc:creator>
      <dc:date>2021-08-16T11:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: Flash write stalls</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Flash-write-stalls/m-p/1323902#M15893</link>
      <description>&lt;P&gt;Found a solution by ereasing the sector before writing to it, as described here: &lt;A href="https://community.nxp.com/t5/NXP-Designs/Flash-Write-with-FreeRTos/m-p/1134245" target="_blank"&gt;https://community.nxp.com/t5/NXP-Designs/Flash-Write-with-FreeRTos/m-p/1134245&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;result = mflash_drv_sector_erase(chunk_addr);
if (result != 0)
{
	PRINTF("\r\nCould not earase sector\r\n");
}

result = mflash_drv_write(chunk_addr, (uint8_t*)&amp;amp;https_buf[start_image_pos], len - start_image_pos);
if (result != 0)
{
	PRINTF("\r\nError during write\r\n");
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Aug 2021 11:41:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Flash-write-stalls/m-p/1323902#M15893</guid>
      <dc:creator>Robert123</dc:creator>
      <dc:date>2021-08-16T11:41:52Z</dc:date>
    </item>
    <item>
      <title>Re: Flash write stalls</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Flash-write-stalls/m-p/1324761#M15912</link>
      <description>&lt;P&gt;double post&lt;/P&gt;</description>
      <pubDate>Wed, 18 Aug 2021 06:20:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Flash-write-stalls/m-p/1324761#M15912</guid>
      <dc:creator>Robert123</dc:creator>
      <dc:date>2021-08-18T06:20:48Z</dc:date>
    </item>
    <item>
      <title>Re: Flash write stalls</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Flash-write-stalls/m-p/1325213#M15919</link>
      <description>&lt;P&gt;Actually, the problem still exists when I continued to work on my project today. I have tried to read and erase the flash memory before writing and also tried to reset the flex SPI but nothing works. The write to flash write still stalls/crashes.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Aug 2021 06:19:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Flash-write-stalls/m-p/1325213#M15919</guid>
      <dc:creator>Robert123</dc:creator>
      <dc:date>2021-08-18T06:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: Flash write stalls</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Flash-write-stalls/m-p/1327116#M15977</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/187150"&gt;@Robert123&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Is this a problem with writing at a certain sector? If you write at the sector that is stalling the operation does the same behavior is present?&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Alexis Andalon&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 21:14:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Flash-write-stalls/m-p/1327116#M15977</guid>
      <dc:creator>Alexis_A</dc:creator>
      <dc:date>2021-08-20T21:14:36Z</dc:date>
    </item>
    <item>
      <title>Re: Flash write stalls</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Flash-write-stalls/m-p/1327600#M15985</link>
      <description>&lt;P&gt;It stalls at different sectors from 100 to 300 kbytes (one sector is 10 kbyte). I am running FreeRTOS (for the lwip stack) and I think it may interfere when I am disabling the interrupts while I am writing to flash. Sometimes I am unable to fetch the entire binary and lwip_recv returns 0 indicating "end of file" premature.&lt;/P&gt;&lt;P&gt;I solved the OTA update by copying the entire binary to a temporary buffer. But the buffer is quite large so it would be nice to allow writing to flash while still enabling interrupts.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2021 08:27:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Flash-write-stalls/m-p/1327600#M15985</guid>
      <dc:creator>Robert123</dc:creator>
      <dc:date>2021-08-23T08:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: Flash write stalls</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Flash-write-stalls/m-p/1328028#M16004</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/187150"&gt;@Robert123&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I think to ensure the communication in the ethernet side your workaround would be the best option.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Alexis Andalon&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2021 23:13:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Flash-write-stalls/m-p/1328028#M16004</guid>
      <dc:creator>Alexis_A</dc:creator>
      <dc:date>2021-08-23T23:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: Flash write stalls</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Flash-write-stalls/m-p/1331003#M16095</link>
      <description>&lt;P&gt;Thanks, do you think a solution would be to replace lwip with the freertos TCP/IP stack? &lt;A href="https://www.freertos.org/FreeRTOS_Support_Forum_Archive/November_2014/freertos_FreeRTOS_TCP_IP_stack_vs_lwIP_8324ceabj.html" target="_blank" rel="noopener"&gt;https://www.freertos.org/FreeRTOS_Support_Forum_Archive/November_2014/freertos_FreeRTOS_TCP_IP_stack_vs_lwIP_8324ceabj.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It would be nice to avoid allocating a large buffer in RAM and write directly to flash.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Aug 2021 11:40:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Flash-write-stalls/m-p/1331003#M16095</guid>
      <dc:creator>Robert123</dc:creator>
      <dc:date>2021-08-27T11:40:07Z</dc:date>
    </item>
  </channel>
</rss>

