<?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>External SPI flash interfere with SiP programming</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/103380/external-spi-flash-interfere-with-sip-programming</link><description>Hello, 
 
 I am currently developing on a custom board with a nRF9160. So far so good. 
 I need to store some data in an external 8MB flash memory, via SPI (Windbond W25Q64JV). It took me some time to figure out the DeviceTree declaration, but it&amp;#39;s finally</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 13 Nov 2023 12:14:56 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/103380/external-spi-flash-interfere-with-sip-programming" /><item><title>RE: External SPI flash interfere with SiP programming</title><link>https://devzone.nordicsemi.com/thread/455282?ContentTypeID=1</link><pubDate>Mon, 13 Nov 2023 12:14:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d4f7de3e-78a2-4ca8-a899-4d5309896251</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;Hello again,&lt;/p&gt;
[quote user="Vincent44"]Since I am working on a custom board, any sample code will require to add some configuration[/quote]
&lt;p&gt;Yeah they would at minimum require you to to add the board configuration, though I think you can go without Kconfigs like&amp;nbsp;CONFIG_FLASH. As config flash seems to break something, I figured it would be good test to see if you can build and flash something like blinky with it enabled.&lt;/p&gt;
[quote user="Vincent44"]I am able to control my external memory (which I use to store some log). Read/write is working fine. The issue is only when programming : the device should be manually erased first, which is not the case when the FLASH is not used.[/quote]
&lt;p&gt;This seems odd to me, as flashing from the command line doesn&amp;#39;t work either way. Could you try and test if also this work with something default?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: External SPI flash interfere with SiP programming</title><link>https://devzone.nordicsemi.com/thread/454275?ContentTypeID=1</link><pubDate>Mon, 06 Nov 2023 15:54:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bdadb1f1-df40-4fa5-b2f9-f6b98f9d46e3</guid><dc:creator>Vincent44</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I am not sure to understand what test you are suggesting. Since I am working on a custom board, any sample code will require to add some configuration, which is most likely what is cause my issue.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I am able to control my external memory (which I use to store some log). Read/write is working fine. The issue is only when programming : the device should be manually erased first, which is not the case when the FLASH is not used.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: External SPI flash interfere with SiP programming</title><link>https://devzone.nordicsemi.com/thread/450825?ContentTypeID=1</link><pubDate>Tue, 17 Oct 2023 11:47:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9dddd752-3f93-4c35-a700-e0742aea838a</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;Could you try having&amp;nbsp;&lt;span&gt;CONFIG_FLASH enabled on a default&amp;nbsp;sample to make sure that still works?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Elfving&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: External SPI flash interfere with SiP programming</title><link>https://devzone.nordicsemi.com/thread/450471?ContentTypeID=1</link><pubDate>Mon, 16 Oct 2023 08:33:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84a8e601-97e7-4b01-8590-7bfd3af1c03a</guid><dc:creator>Vincent44</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;No, I did not modify the flashing task in VS Code.&lt;br /&gt;&lt;br /&gt;Flashing/debugging works with this configuration :&lt;br /&gt;&amp;nbsp;- Devicetree provides hardware info concerning the SPI / NVM (see below)&lt;br /&gt;&amp;nbsp;- Nor SPI nor FLASH functions are used in the code. &lt;br /&gt;&amp;nbsp;- In prf.conf, CONFIG_FLASH=n and CONFIG_SPI=y&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;spi3 {
    compatible = &amp;quot;nordic,nrf-spim&amp;quot;;
    status = &amp;quot;okay&amp;quot;;
    pinctrl-0 = &amp;lt;&amp;amp;spi3_default&amp;gt;;
    pinctrl-1 = &amp;lt;&amp;amp;spi3_sleep&amp;gt;;
    pinctrl-names = &amp;quot;default&amp;quot;, &amp;quot;sleep&amp;quot;;

    cs-gpios = &amp;lt;&amp;amp;gpio0 8 GPIO_ACTIVE_LOW&amp;gt;;
    extflash0: extflash0@0 {
        compatible =  &amp;quot;jedec,spi-nor&amp;quot;;
        #address-cells = &amp;lt;1&amp;gt;;
        #size-cells = &amp;lt;1&amp;gt;;
        
        reg = &amp;lt;0&amp;gt;;
        spi-max-frequency = &amp;lt;1000000&amp;gt;;    // Max supported by the flash is 133MHz
        jedec-id     = [EF 40 17];    // JEDEC ID is [MF 7-0]=0xEF [ID 15-8]= [ID 7-0 = Size]=
        size         = &amp;lt;DT_SIZE_M(64)&amp;gt;;
        has-dpd;                // Enable the Deep Power Down management
        t-enter-dpd    = &amp;lt;3000&amp;gt;;    // 3ns
        t-exit-dpd     = &amp;lt;20000&amp;gt;;    // Not 100% sure of this value.
        wp-gpios      = &amp;lt;&amp;amp;gpio0 9 GPIO_ACTIVE_LOW&amp;gt;;
        hold-gpios     = &amp;lt;&amp;amp;gpio0 10 GPIO_ACTIVE_LOW&amp;gt;;        
    };                            
};

&amp;amp;pinctrl {
    spi3_default: spi3_default {
        group1 {
            psels = &amp;lt;NRF_PSEL(SPIM_SCK, 0, 13)&amp;gt;,
                    &amp;lt;NRF_PSEL(SPIM_MOSI, 0, 11)&amp;gt;,
                    &amp;lt;NRF_PSEL(SPIM_MISO, 0, 12)&amp;gt;;
        };
    };

    spi3_sleep: spi3_sleep {
        group1 {
            psels = &amp;lt;NRF_PSEL(SPIM_SCK, 0, 13)&amp;gt;,
                    &amp;lt;NRF_PSEL(SPIM_MOSI, 0, 11)&amp;gt;,
                    &amp;lt;NRF_PSEL(SPIM_MISO, 0, 12)&amp;gt;;
                    low-power-enable;
        };
    };
};&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;When I set CONFIG_FLASH=y, even with the same C code, that does not call any function related to the flash, I get the error reported in my initial post when trying to flash or debug.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new, courier;"&gt;Flashing build_ns to 51001355&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new, courier;"&gt;C:\Windows\system32\cmd.exe /d /s /c &amp;quot;west flash -d c:\Users\vince\OneDrive\Documents\GitLab_Firmware_Cellulaire\firmware_wna618\build_ns --skip-rebuild --dev-id 51001355&amp;quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new, courier;"&gt;-- west flash: using runner nrfjprog&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new, courier;"&gt;-- runners.nrfjprog: Flashing file: c:\Users\vince\OneDrive\Documents\GitLab_Firmware_Cellulaire\firmware_wna618\build_ns\zephyr\merged.hex&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new, courier;"&gt;[error] [ Client] - Encountered error -102: Command erase_file executed for 217 milliseconds with result -102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new, courier;"&gt;[error] [&amp;nbsp; nRF91] - Failed while performing &amp;#39;Erase&amp;#39; operation on target address 0x00000000.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new, courier;"&gt;-102: JLinkARM.dll WriteU32 returned error -1.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new, courier;"&gt;[error] [&amp;nbsp; nRF91] - Failed while erasing device. -102: JLinkARM.dll WriteU32 returned error -1.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new, courier;"&gt;[error] [ Worker] - JLinkARM.dll WriteU32 returned error -1.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new, courier;"&gt;ERROR: JLinkARM DLL reported an error. Try again. If error condition&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new, courier;"&gt;ERROR: persists, run the same command again with argument --log, contact Nordic&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new, courier;"&gt;ERROR: Semiconductor and provide the generated log.log file to them.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new, courier;"&gt;NOTE: For additional output, try running again with logging enabled (--log).&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new, courier;"&gt;NOTE: Any generated log error messages will be displayed.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new, courier;"&gt;FATAL ERROR: command exited with status 33: nrfjprog --program &amp;#39;c:\Users\vince\OneDrive\Documents\GitLab_Firmware_Cellulaire\firmware_wna618\build_ns\zephyr\merged.hex&amp;#39; --sectorerase --verify -f NRF91 --snr 51001355&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I have the feeling that some definitions concerning the memory map are missing, but I don&amp;#39;t know what/where.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Here are the 2 merged.hex file I get when changing the state of CONFIG_FLASH in prj.conf&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/merged_5F00_CONFIG_5F00_FLASH_3D00_n.hex"&gt;devzone.nordicsemi.com/.../merged_5F00_CONFIG_5F00_FLASH_3D00_n.hex&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/merged_5F00_CONFIG_5F00_FLASH_3D00_y.hex"&gt;devzone.nordicsemi.com/.../merged_5F00_CONFIG_5F00_FLASH_3D00_y.hex&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Using J-Flash Lite, both these files can be flash in the nRF9160. However, the one with CONFIG_FLASH=y does not seem to work properly (I believe it&amp;#39;s crashing at startup).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: External SPI flash interfere with SiP programming</title><link>https://devzone.nordicsemi.com/thread/449966?ContentTypeID=1</link><pubDate>Thu, 12 Oct 2023 07:44:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3bb54762-2de7-48d4-bf72-86015a976fa2</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;Hello again,&lt;/p&gt;
&lt;p&gt;It seems that I&amp;#39;ve overlooked that it doesn&amp;#39;t work in command line no matter whether or not you&amp;#39;ve erased it.&lt;/p&gt;
&lt;p&gt;Have you modified the flashing Tasks in the VSC Actions? Are you seeing this issue when flashing anything else, like eg. the hello world sample?&lt;/p&gt;
&lt;p&gt;Could you provide me the hex file you are creating and flashing that is giving you this issue?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: External SPI flash interfere with SiP programming</title><link>https://devzone.nordicsemi.com/thread/448666?ContentTypeID=1</link><pubDate>Tue, 03 Oct 2023 13:14:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72b535ef-8a69-42ac-8abd-d3357969e058</guid><dc:creator>Vincent44</dc:creator><description>&lt;p&gt;Attached are the 2 logs corresponding to the following steps:&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;- Erase the SiP from VS Code&lt;br /&gt;- Try flashing using the command line : Failed&lt;br /&gt;&amp;nbsp; -&amp;gt; Result in log_1.log&lt;br /&gt;- Flashing from VS Code : Success&lt;br /&gt;- Try flashing using the command line : Failed&lt;br /&gt;&amp;nbsp; -&amp;gt; Result in log_2.log&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/log_5F00_2.log"&gt;devzone.nordicsemi.com/.../log_5F00_2.log&lt;/a&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/log_5F00_1.log"&gt;devzone.nordicsemi.com/.../log_5F00_1.log&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: External SPI flash interfere with SiP programming</title><link>https://devzone.nordicsemi.com/thread/444903?ContentTypeID=1</link><pubDate>Thu, 07 Sep 2023 11:36:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af5ddb39-98e3-456a-94f0-e6016d7accb3</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;Could you do one that hasn&amp;#39;t been previously erased as well? It would be nice with one that shows the errors -102 and -1.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: External SPI flash interfere with SiP programming</title><link>https://devzone.nordicsemi.com/thread/444835?ContentTypeID=1</link><pubDate>Thu, 07 Sep 2023 06:58:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12cf7cf9-4bb0-4b29-8d05-b2c9bdfd30c1</guid><dc:creator>Vincent44</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/1106.log.log"&gt;devzone.nordicsemi.com/.../1106.log.log&lt;/a&gt;Programming using the terminal does not work.&lt;/p&gt;
&lt;p&gt;Attached the log when trying to program my nRF9160, that has been previously erase (aka, the case that works on VSCode).&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1694069850313v1.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: External SPI flash interfere with SiP programming</title><link>https://devzone.nordicsemi.com/thread/444700?ContentTypeID=1</link><pubDate>Wed, 06 Sep 2023 11:33:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95e4c7c4-6076-45bd-af93-9c8a6cbffc1c</guid><dc:creator>Elfving</dc:creator><description>[quote user="Vincent44"]&lt;p&gt;I am not not sur how to get the log. Where should I add &amp;quot;-- log&amp;quot; ?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;You can add it when flashing it from the commandline, I don&amp;#39;t think there is an easy way of doing this with VSC &amp;quot;Actions&amp;quot;. For instance open the build folder in a terminal by right clicking the build-folder in VSC, and select start new terminal here. Then run &amp;quot;nrfjprog --program \zephyr\zephyr.hex --log&amp;quot;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: External SPI flash interfere with SiP programming</title><link>https://devzone.nordicsemi.com/thread/444498?ContentTypeID=1</link><pubDate>Tue, 05 Sep 2023 12:10:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e735bd38-8371-48a5-a44d-170e336c6b2b</guid><dc:creator>Vincent44</dc:creator><description>&lt;p&gt;Hi Elfving,&lt;br /&gt;&lt;br /&gt;I am flashing the board using a J-LINK Base, directly from VS Code. I&amp;#39;ve had not issue so far.&lt;br /&gt;&lt;br /&gt;I&amp;#39;ve tried the following :&lt;br /&gt;- Removing only the .c code, and keeping DTS and prj.conf&amp;nbsp; -&amp;gt; Can&amp;#39;t program without manually erasing&lt;br /&gt;- Removing the .c code and DTS, and keeping and prj.conf -&amp;gt; Can&amp;#39;t program without manually erasing&lt;br /&gt;- Removing the .c code, DTS and CONFIG_FLASH=y from prj.conf -&amp;gt; Programming works&lt;br /&gt;- Removing the .c code and CONFIG_FLASH=y, keeping DTS -&amp;gt; Programming works&lt;br /&gt;- Removing CONFIG_FLASH=y, and keeping the .c code and DTS -&amp;gt; Can&amp;#39;t build, because functions such as flash_erase() are not defined.&lt;br /&gt;&lt;br /&gt;The CONFIG_FLASH=y seem to be the cause of my problem. However, I need it to enable the flash() functions.&lt;br /&gt;&lt;br /&gt;I am not not sur how to get the log. Where should I add &amp;quot;-- log&amp;quot; ?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;All these results are when clicking on the &amp;quot;Flash&amp;quot; text (orange circle). I just noticed that using the flash logo (green circle) works in all cases. I am confused about this, since both provide the same output on the terminal, and both initiate a flash erase of the nRF9160 prior to programming.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1693915810950v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;Note that this is only possible for flashing, but not for debugging.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: External SPI flash interfere with SiP programming</title><link>https://devzone.nordicsemi.com/thread/444300?ContentTypeID=1</link><pubDate>Mon, 04 Sep 2023 11:35:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:91aafe6c-1aac-4b6a-961e-6b2d515ceed9</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;Hello Vincent,&lt;/p&gt;
&lt;p&gt;Could you provide the complete logs for this run?&lt;/p&gt;
[quote user=""]Here is the code I added for the memory management. When all this code is commented out, I can program and re-program normally.[/quote][quote user=""]My test code. Note that even when is removed, I still get the same programming error, which makes me think that the issue is on the DT.[/quote]
&lt;p&gt;Would you have to remove both the memory related configs and DTS additions for it to work?&lt;/p&gt;
&lt;p&gt;Have you tried this using a DK? How are you flashing it?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>