<?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>nrf52840 spim, external flash W25Q32JV read/write failed, mcuboot failed</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/93915/nrf52840-spim-external-flash-w25q32jv-read-write-failed-mcuboot-failed</link><description>We are using the external flash w25q32jv via SPIM connection. the configuration as below. 
 
 arduino_spi : &amp;amp; spi3 { 
 status = &amp;quot;okay&amp;quot; ; 
 compatible = &amp;quot;nordic,nrf-spim&amp;quot; ; 
 cs-gpios = &amp;lt; &amp;amp; gpio1 12 GPIO_ACTIVE_LOW &amp;gt;; 
 
 pinctrl-0 = &amp;lt; &amp;amp; spi3_default </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 24 Nov 2022 12:30:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/93915/nrf52840-spim-external-flash-w25q32jv-read-write-failed-mcuboot-failed" /><item><title>RE: nrf52840 spim, external flash W25Q32JV read/write failed, mcuboot failed</title><link>https://devzone.nordicsemi.com/thread/397414?ContentTypeID=1</link><pubDate>Thu, 24 Nov 2022 12:30:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:15753dc0-5f7a-4a0b-8a04-ab513a597793</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Sorry about the late reply, but Susheel is out of office for the time being so I have taken over and I needed a&amp;nbsp;while to get into your case before getting back to you. Since you&amp;#39;re not using the QSPI peripheral that can only be used by the SPIM3, it should be fine to move to SPIM2. Although it should also be perfectly fine using the SPIM3 as long as you take into account and implement the workaround:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Reserve dedicated RAM AHB slave for the SPIM3 transmit buffer, not overlapping with application data used by the CPU. In addition, synchronize so that the CPU is not writing data to the transmit buffer while SPIM is transmitting data.&lt;/span&gt;&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><item><title>RE: nrf52840 spim, external flash W25Q32JV read/write failed, mcuboot failed</title><link>https://devzone.nordicsemi.com/thread/396544?ContentTypeID=1</link><pubDate>Mon, 21 Nov 2022 06:37:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b48aac91-8eb5-4624-ab75-bfcc09af1cc9</guid><dc:creator>Tyler Vu</dc:creator><description>&lt;p&gt;Hi Susheel,&lt;br /&gt;we&amp;#39;ve found this problem in Errata, could you confirm this, and should we move to use SPIM2 instead of SPIM3?&lt;/p&gt;
&lt;p&gt;[198] SPIM: SPIM3 transmit data might be corrupted&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Ferrata_nRF52840_Rev2%2FERR%2FnRF52840%2FRev2%2Flatest%2Fanomaly_840_198.html"&gt;https://infocenter.nordicsemi.com/index.jsp?topic=%2Ferrata_nRF52840_Rev2%2FERR%2FnRF52840%2FRev2%2Flatest%2Fanomaly_840_198.html&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52840 spim, external flash W25Q32JV read/write failed, mcuboot failed</title><link>https://devzone.nordicsemi.com/thread/395950?ContentTypeID=1</link><pubDate>Wed, 16 Nov 2022 10:57:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:08c7307f-78cd-4a73-a44a-37efb6f65da3</guid><dc:creator>Tyler Vu</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;We are using mcuboot and mcumgr feature for updating F/W and mcuboot and mcumgr will use zephyr library to write/read to ext-flash without our control. We need to enable USB, PDM for application while DFU (device firmware update).&lt;br /&gt;If we can not apply&amp;nbsp;&lt;span&gt;workaround (irq_lock/unlock) the MCU boot will be failed. We want to know why USB, PDM module can affect to SPI NOR flash? with our application, it&amp;#39;s easy to apply irq_lock, but mcuboot and mcumgr belong to nrf SDK, we can not change! Is there any way that we can avoid it without changing low layer levels?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52840 spim, external flash W25Q32JV read/write failed, mcuboot failed</title><link>https://devzone.nordicsemi.com/thread/395945?ContentTypeID=1</link><pubDate>Wed, 16 Nov 2022 10:42:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d38391d-2ec0-46b8-80be-81373d0581cf</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""] We investigate that the f/w sending the wrong op-code for reading/writing. If we use irq_lock/unlock before flash_area_write(), flash_area_read() in zephyr library. The flash operation is successful and DFU with mcumgr will pass.[/quote]
&lt;p&gt;It looks like there is some race condition in your application that is seems solved when you apply this &lt;a href="https://docs.zephyrproject.org/1.14.0/reference/kernel/other/interrupts.html#preventing-interruptions"&gt;critical section&lt;/a&gt; locks in the lower layers of the zephyr library. But applications should apply &lt;a href="https://docs.zephyrproject.org/1.14.0/reference/kernel/other/interrupts.html#preventing-interruptions"&gt;critical section&lt;/a&gt; (lock/unlock of schedulers) not in lower levels but in the app level.&lt;/p&gt;
&lt;p&gt;Based on your explanation, it sounds very much like you managed to solve an application race condition by applying critical sections on lower levels.&lt;/p&gt;
&lt;p&gt;You need to figure out why this workaround (irq_lock/unlock) worked for you. This can be due to any race condition in your application not visible to us.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52840 spim, external flash W25Q32JV read/write failed, mcuboot failed</title><link>https://devzone.nordicsemi.com/thread/395836?ContentTypeID=1</link><pubDate>Tue, 15 Nov 2022 15:13:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3248347f-ae4f-4b6b-ae55-53838b6cd2c5</guid><dc:creator>Tyler Vu</dc:creator><description>&lt;p&gt;Update:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;spi3_default:&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;spi3_default&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;group1&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;psels&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &amp;lt;&lt;/span&gt;&lt;span&gt;NRF_PSEL&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;SPIM_SCK&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;10&lt;/span&gt;&lt;span&gt;)&amp;gt;, &amp;lt;&lt;/span&gt;&lt;span&gt;NRF_PSEL&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;SPIM_MOSI&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;13&lt;/span&gt;&lt;span&gt;)&amp;gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;nordic,drive-mode&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &amp;lt;&lt;/span&gt;&lt;span&gt;NRF_DRIVE_H0H1&lt;/span&gt;&lt;span&gt;&amp;gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; };&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;group2&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;psels&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &amp;lt;&lt;/span&gt;&lt;span&gt;NRF_PSEL&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;SPIM_MISO&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;3&lt;/span&gt;&lt;span&gt;)&amp;gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; };&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; };&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;spi3_sleep:&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;spi3_sleep&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;group1&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;psels&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &amp;lt;&lt;/span&gt;&lt;span&gt;NRF_PSEL&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;SPIM_SCK&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;10&lt;/span&gt;&lt;span&gt;)&amp;gt;, &amp;lt;&lt;/span&gt;&lt;span&gt;NRF_PSEL&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;SPIM_MOSI&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;13&lt;/span&gt;&lt;span&gt;)&amp;gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;nordic,drive-mode&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &amp;lt;&lt;/span&gt;&lt;span&gt;NRF_DRIVE_H0H1&lt;/span&gt;&lt;span&gt;&amp;gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;low-power-enable&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; };&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;group2&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;psels&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &amp;lt;&lt;/span&gt;&lt;span&gt;NRF_PSEL&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;SPIM_MISO&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;3&lt;/span&gt;&lt;span&gt;)&amp;gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;low-power-enable&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; };&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; };&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>