<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>STALLSTAT on SPIM3 writes to flash IC</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/74309/stallstat-on-spim3-writes-to-flash-ic</link><description>Our application has a bug that I am trying to track down, but it&amp;#39;s being a little tricky. We are writing a good deal of data to a NAND flash IC over SPIM. Right now the SPIM is set to 1MHz and we are using SPIM3. Each write is one page, which is 0x0880</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 23 Apr 2021 18:21:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/74309/stallstat-on-spim3-writes-to-flash-ic" /><item><title>RE: STALLSTAT on SPIM3 writes to flash IC</title><link>https://devzone.nordicsemi.com/thread/306613?ContentTypeID=1</link><pubDate>Fri, 23 Apr 2021 18:21:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b5f2e8d4-e283-4e19-a012-23b1ee8f2219</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Try moving the buffer to a reserved SRAM area which no other code accesses, rather than just stuffing it on the stack which is the most memory-intensive SRAM area:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    uint8_t buff[0x0880];
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;That way the buffer gets its own DMA AHB slave bus and doesn&amp;#39;t have to share. Something like this, there are examples in the devzone:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// Place following data in section .spim3 so it has private SRAM segment
#pragma default_variable_attributes = @ &amp;quot;.spim3&amp;quot; // if using IAR
// Reserved spim3 buffer
volatile uint8_t buff[0x0880] __attribute__((section(&amp;quot;.sect_spim3&amp;quot;)));
#pragma default_variable_attributes =            // if using IAR
// End - Place following data in section .spim3

// These are the SRAM areas:
//
//  RAM0 Section 0 0x2000 0000 - 0x2000 0FFF
//       Section 1 0x2000 1000 - 0x2000 1FFF
//  RAM1 Section 0 0x2000 2000 - 0x2000 2FFF
//       Section 1 0x2000 3000 - 0x2000 3FFF
//  RAM2 Section 0 0x2000 4000 - 0x2000 4FFF
//       Section 1 0x2000 5000 - 0x2000 5FFF
//  RAM3 Section 0 0x2000 6000 - 0x2000 6FFF
//       Section 1 0x2000 7000 - 0x2000 7FFF
//  RAM4 Section 0 0x2000 8000 - 0x2000 8FFF
//       Section 1 0x2000 9000 - 0x2000 9FFF
//  RAM5 Section 0 0x2000 A000 - 0x2000 AFFF
//       Section 1 0x2000 B000 - 0x2000 BFFF
//  RAM6 Section 0 0x2000 C000 - 0x2000 CFFF
//       Section 1 0x2000 D000 - 0x2000 DFFF
//  RAM7 Section 0 0x2000 E000 - 0x2000 EFFF
//       Section 1 0x2000 F000 - 0x2000 FFFF&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Ensure the section &lt;em&gt;.sect_spim3&lt;/em&gt; is defined in the linker area as a separate SRAM area in SEGGER_Flash.icf file. Here is an example from Torbjorn:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/65054/how-to-designate-one-ram-block-exclusively-for-radio-use/265913#265913"&gt;designate-one-ram-block-exclusively&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1597705680653v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;Note also using P1.nn pins is dodgy if you wish to boost to a much higher serial SPI clock, since those pins do not allow H0H1 drive settings, which you will need. Port P0.nn is preferred.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: STALLSTAT on SPIM3 writes to flash IC</title><link>https://devzone.nordicsemi.com/thread/306612?ContentTypeID=1</link><pubDate>Fri, 23 Apr 2021 17:52:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b286bd3f-be44-4c97-92c2-c190e961e6b9</guid><dc:creator>SmallerPond</dc:creator><description>&lt;p&gt;And actually, if you&amp;#39;ll check the question, I&amp;#39;ve posted a minimal example that reproduces the behavior, as well as my compiler settings and sdk_config.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: STALLSTAT on SPIM3 writes to flash IC</title><link>https://devzone.nordicsemi.com/thread/306542?ContentTypeID=1</link><pubDate>Fri, 23 Apr 2021 12:44:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:56738a04-6211-4ace-b949-f0c1eb56ca2b</guid><dc:creator>SmallerPond</dc:creator><description>&lt;p&gt;Hey Simonr, thanks!&amp;nbsp; In this application there is no logging and it has all been disabled, which was part of my confusion.&amp;nbsp; Is it possible that performing a SPIM txrx transaction while another is still in process not only returns a busy error but also causes a stall?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: STALLSTAT on SPIM3 writes to flash IC</title><link>https://devzone.nordicsemi.com/thread/306530?ContentTypeID=1</link><pubDate>Fri, 23 Apr 2021 12:02:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3030f0d-5528-45a9-92a2-8c03fc5dbc25</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;The STALLSTAT should only occur due to ASHB bus congestions (AHB bus masters trying to access the same AHB slave at the same time). An EasyDMA channel is an AHB master, so apparently it tries to use an already busy peripheral in this case.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It could be that the UARTE tries using the same bus for logging for example, or that you have another peripheral using it for some reason. So yes, if you use the UART backend for logging, I guess the debugger could be the peripheral conflicting with SPIM. You can try disabling logging altogether to see whether there are more successful writes on your flash.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>