<?xml-stylesheet type="text/xsl" href="https://community.element14.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/"><channel><title>Add external SPI Flash Memory to Raspberry Pico - 2: first communication (and c++)</title><link>/products/raspberry-pi/b/blog/posts/add-external-spi-flash-memory-to-raspberry-pico---2-first-communication</link><description>A projects to learn the SPI API of the RP2040 C SDK, and to use it to control an external Flash IC. In this post, I set up the firmware and execute a first communication. 





Hardware Initialisation
I&amp;#39;m setting the SPI pins funct...</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Add external SPI Flash Memory to Raspberry Pico - 2: first communication (and c++)</title><link>https://community.element14.com/products/raspberry-pi/b/blog/posts/add-external-spi-flash-memory-to-raspberry-pico---2-first-communication</link><pubDate>Fri, 02 Dec 2022 02:08:02 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:0e20c08e-7778-4511-bef9-834edf581b2f</guid><dc:creator>shabaz</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Nice!&lt;/p&gt;
&lt;p&gt;It easily compiled with CLion too. Nice how stable CMake is, and the Pico SDK, I didn&amp;#39;t even check to see which version of the SDK I had. It&amp;#39;s getting easier than Arduino.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m interested in using this with 1.8V Flash, and possibly 2.5V in future too, it will need a simple interfacing circuit. It&amp;#39;s cheaper than a Flash programmer! And open source : )&lt;/p&gt;
&lt;p&gt;I extracted the zip file into any folder, and then selected that folder using the Open Project wizard. When the popup appeared, there was just one thing to configure: I typed my path to the Pico C/C++ SDK:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " height="521" src="/resized-image/__size/1194x1042/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-0e20c08e-7778-4511-bef9-834edf581b2f/flash_2D00_open_2D00_proj.png" width="597" /&gt;&lt;/p&gt;
&lt;p&gt;That was it, it did everything else automatically. I did a clean build using &lt;strong&gt;Build-&amp;gt;Clean&lt;/strong&gt; followed by &lt;strong&gt;Build-&amp;gt;Build Project&lt;/strong&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " height="522" src="/resized-image/__size/1200x1044/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-0e20c08e-7778-4511-bef9-834edf581b2f/flash_2D00_building.png" width="600" /&gt;&lt;/p&gt;
&lt;p&gt;The built file was in the appropriate folder:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " height="573" src="/resized-image/__size/1200x1146/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-0e20c08e-7778-4511-bef9-834edf581b2f/flash_2D00_uf2.png" width="600" /&gt;&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=24855&amp;AppID=86&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Add external SPI Flash Memory to Raspberry Pico - 2: first communication (and c++)</title><link>https://community.element14.com/products/raspberry-pi/b/blog/posts/add-external-spi-flash-memory-to-raspberry-pico---2-first-communication</link><pubDate>Mon, 28 Nov 2022 18:54:39 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:0e20c08e-7778-4511-bef9-834edf581b2f</guid><dc:creator>Jan Cumps</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;I did not do my best to write proper c++. One of the things I&amp;#39;d change is to define the constants as class constants.&lt;/p&gt;
&lt;p&gt;In the header:&lt;/p&gt;
&lt;p&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:18b7b6ae-28a1-48d5-a0b0-6775907719ee:type=c_cpp&amp;text=class%20m25%20%7B%0D%0Apublic%3A%0D%0A%20%20%2F%2F%20...%0D%0A%0D%0Aprivate%3A%0D%0A%20%20enum%20commands%20%3A%20uint8_t%20%7B%20%0D%0A%20%20%20%20FLASH_CMD_RDID%20%3D%200x9F%7D%3B%0D%0A%20%20%2F%2F%20...]&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;In the cpp file, remove this line:&lt;/p&gt;
&lt;div&gt;
&lt;div class="content-scrollable-wrapper"&gt;
&lt;pre&gt;&lt;span&gt;#define&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;FLASH_CMD_RDID&lt;/span&gt;&lt;span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;0x9F&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
There are more ways to&amp;nbsp;do this.&amp;nbsp;Critique is welcome.&lt;/div&gt;&lt;img src="https://community.element14.com/aggbug?PostID=24855&amp;AppID=86&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>