<?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>nrf5340 128MHz &amp;amp; SPI 32 MHz</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/108267/nrf5340-128mhz-spi-32-mhz</link><description>Hello, 
 I need a SPI running at maximum SPI (32MHz). 
 My understanding is to have a 32 MHz SPI, I need a core running at 128MHz. 
 What is the correct way to configure the core clock: (Device Tree? KConfig? nrfx lib? 
 Thanks</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 23 Feb 2024 08:40:05 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/108267/nrf5340-128mhz-spi-32-mhz" /><item><title>RE: nrf5340 128MHz &amp; SPI 32 MHz</title><link>https://devzone.nordicsemi.com/thread/470392?ContentTypeID=1</link><pubDate>Fri, 23 Feb 2024 08:40:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2cce7400-1125-4b9c-8fe0-6a70b89566fa</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Glad to hear that you got it working!&lt;/p&gt;
&lt;p&gt;And thank you for sharing the updated and working setup.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Hope you have a wonderful weekend!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf5340 128MHz &amp; SPI 32 MHz</title><link>https://devzone.nordicsemi.com/thread/470338?ContentTypeID=1</link><pubDate>Thu, 22 Feb 2024 22:56:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:426e249b-7003-469f-8b17-8a8bc16910b2</guid><dc:creator>Simon Third</dc:creator><description>&lt;p&gt;Thanks Hakon,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve got the qspi running in dual mode now.&lt;/p&gt;
&lt;p&gt;My overlay changes are&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;qspi{
    status = &amp;quot;okay&amp;quot;;
    /delete-node/ mx25r6435f@0;
    w25q64: w25q64jq@0 {
        compatible = &amp;quot;nordic,qspi-nor&amp;quot;;
		reg = &amp;lt; 0x0 &amp;gt;;
        writeoc = &amp;quot;pp&amp;quot;;
        readoc = &amp;quot;read2io&amp;quot;;
        sck-frequency = &amp;lt; 33000000 &amp;gt;;
        jedec-id = [ EF 40 17 ];
        size = &amp;lt; 0x4000000 &amp;gt;;
    };
};
/ {
    aliases {
        
        /delete-property/ spi-flash0;
        qspi-flash64 = &amp;amp;w25q64;
    };
};
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf5340 128MHz &amp; SPI 32 MHz</title><link>https://devzone.nordicsemi.com/thread/469167?ContentTypeID=1</link><pubDate>Fri, 16 Feb 2024 08:57:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d30c1b1-7fc4-481b-ba31-ee45ecf62622</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;QSPI supports both quad, dual, and single mode by declaring these in DT:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v3.4.99-ncs1-2/dts/bindings/mtd/nordic,qspi-nor.yaml#L34-L55"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/v3.4.99-ncs1-2/dts/bindings/mtd/nordic,qspi-nor.yaml#L34-L55&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s an example of them used for quad io operation:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v3.4.99-ncs1-2/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts#L232-L234"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/v3.4.99-ncs1-2/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts#L232-L234&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf5340 128MHz &amp; SPI 32 MHz</title><link>https://devzone.nordicsemi.com/thread/469136?ContentTypeID=1</link><pubDate>Thu, 15 Feb 2024 21:07:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5e20f8c-354b-4a78-aa37-62482d74f333</guid><dc:creator>Simon Third</dc:creator><description>&lt;p&gt;Hi Hakon,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve just noticed that I&amp;#39;m not using the SPIM4 dedicated pins.&amp;nbsp; I&amp;#39;m using the QSPI pins P0.13, P0.14, P0.16. Everything seems to be working with this setup.&amp;nbsp; I wonder if the driver could be updated to support this? i.e. all the other high drive pins?&lt;/p&gt;
&lt;p&gt;I had wired the NOR Flash to the QSPI pins for 2-Bit mode, but it appears the qspi driver only supports 4 bit mode.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;(p_config-&amp;gt;skip_gpio_cfg &amp;amp;&amp;amp; p_config-&amp;gt;skip_psel_cfg)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;is true in my case which might explain why the frequency and rx-delay were not picked up from the device tree settings.&lt;/p&gt;
&lt;p&gt;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: nrf5340 128MHz &amp; SPI 32 MHz</title><link>https://devzone.nordicsemi.com/thread/468971?ContentTypeID=1</link><pubDate>Thu, 15 Feb 2024 09:57:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d86a4724-0eaf-45fe-836b-35fdf9314a27</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Sorry, I forgot to mention this. SPIM4 is 32M capable with dedicated pins, as described here:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf5340/spim.html?cp=4_0_0_6_29_6#topic"&gt;https://infocenter.nordicsemi.com/topic/ps_nrf5340/spim.html?cp=4_0_0_6_29_6#topic&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf5340/chapters/pin.html?cp=4_0_0_8_0"&gt;https://infocenter.nordicsemi.com/topic/ps_nrf5340/chapters/pin.html?cp=4_0_0_8_0&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can see this in the source code as well:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/zephyrproject-rtos/hal_nordic/blob/nrfx-3.0.0/nrfx/drivers/src/nrfx_spim.c#L399-L428"&gt;https://github.com/zephyrproject-rtos/hal_nordic/blob/nrfx-3.0.0/nrfx/drivers/src/nrfx_spim.c#L399-L428&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf5340 128MHz &amp; SPI 32 MHz</title><link>https://devzone.nordicsemi.com/thread/468917?ContentTypeID=1</link><pubDate>Thu, 15 Feb 2024 00:39:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:93f02889-5e2b-4a07-b836-91fc87ea6ff1</guid><dc:creator>Simon Third</dc:creator><description>&lt;p&gt;Hi Hakon,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve been able to get SPI4 running at 32MHz. But I had to make a couple of manual changes to the SPIM4 register settings manually.&amp;nbsp; It looks like the settings for max-frequency and rx-delay were not being set from the device tree settings.&lt;/p&gt;
&lt;p&gt;I had to add this code to get higher than 16MHz running.&amp;nbsp; Without it the frequency was being set to 16MHz and the rx-delay=2.&amp;nbsp; A 30ns delay is way to much at 32MHz.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;nrfx_spim.h&amp;gt;

#ifdef NRF_SPIM_HAS_32_MHZ_FREQ
		printk(&amp;quot;spi has 32MHz\n&amp;quot;);
		nrf_spim_frequency_set(NRF_SPIM_INST_GET(4),  NRF_SPIM_FREQ_32M);
		nrf_spim_iftiming_set(NRF_SPIM_INST_GET(4), 0);
#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;My project is using board nrf5340dk_nrf5340_cpuapp and SDK V2.5.1&lt;/p&gt;
&lt;p&gt;My overlay for the SPIM4 setup is&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;&amp;amp;spi4{
    compatible = &amp;quot;nordic,nrf-spim&amp;quot;;
	status = &amp;quot;okay&amp;quot;;
    rx-delay = &amp;lt; 0x0 &amp;gt;;
    max-frequency = &amp;lt;33000000&amp;gt;;
	cs-gpios = &amp;lt;&amp;amp;gpio0 18 GPIO_ACTIVE_LOW&amp;gt;;
	w25q64jv: w25q64jv@0 {
		compatible = &amp;quot;jedec,spi-nor&amp;quot;;
		size = &amp;lt;0x4000000&amp;gt;; //8MBytes
		spi-max-frequency = &amp;lt;33000000&amp;gt;;
		reg = &amp;lt;0&amp;gt;;
		jedec-id = [ ef 40 17 ]; 
		wp-gpios = &amp;lt;&amp;amp;gpio0 19 0&amp;gt;;
		hold-gpios = &amp;lt;&amp;amp;gpio0 16 0&amp;gt;;
	};
};

&amp;amp;spi4_default {
     group1 {
        psels = &amp;lt;NRF_PSEL(SPIM_SCK, 0, 17)&amp;gt;,
                &amp;lt;NRF_PSEL(SPIM_MISO, 0, 14)&amp;gt;,
                &amp;lt;NRF_PSEL(SPIM_MOSI, 0, 13)&amp;gt;;
        nordic,drive-mode = &amp;lt; 3 &amp;gt;;
    };
};
&amp;amp;spi4_sleep {
    group1 {
        psels = &amp;lt;NRF_PSEL(SPIM_SCK, 0, 17)&amp;gt;,
                &amp;lt;NRF_PSEL(SPIM_MISO, 0, 14)&amp;gt;,
                &amp;lt;NRF_PSEL(SPIM_MOSI, 0, 13)&amp;gt;;    
    };
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;which produces .dts output of&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;spi4: arduino_spi: spi@a000 {
				compatible = &amp;quot;nordic,nrf-spim&amp;quot;;
				#address-cells = &amp;lt; 0x1 &amp;gt;;
				#size-cells = &amp;lt; 0x0 &amp;gt;;
				reg = &amp;lt; 0xa000 0x1000 &amp;gt;;
				interrupts = &amp;lt; 0xa 0x1 &amp;gt;;
				max-frequency = &amp;lt; 0x1f78a40 &amp;gt;;
				easydma-maxcnt-bits = &amp;lt; 0x10 &amp;gt;;
				rx-delay-supported;
				rx-delay = &amp;lt; 0x0 &amp;gt;;
				status = &amp;quot;okay&amp;quot;;
				cs-gpios = &amp;lt; &amp;amp;gpio0 0x12 0x1 &amp;gt;;
				pinctrl-0 = &amp;lt; &amp;amp;spi4_default &amp;gt;;
				pinctrl-1 = &amp;lt; &amp;amp;spi4_sleep &amp;gt;;
				pinctrl-names = &amp;quot;default&amp;quot;, &amp;quot;sleep&amp;quot;;
				w25q64jv: w25q64jv@0 {
					compatible = &amp;quot;jedec,spi-nor&amp;quot;;
					size = &amp;lt; 0x4000000 &amp;gt;;
					spi-max-frequency = &amp;lt; 0x1f78a40 &amp;gt;;
					reg = &amp;lt; 0x0 &amp;gt;;
					jedec-id = [ EF 40 17 ];
					wp-gpios = &amp;lt; &amp;amp;gpio0 0x13 0x0 &amp;gt;;
					hold-gpios = &amp;lt; &amp;amp;gpio0 0x10 0x0 &amp;gt;;
				};
			};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Which looks to be correct for the what the driver would need to set up the peripheral correctly?&lt;/p&gt;
&lt;p&gt;It is interesting to note that I could set the frequency lower than 16MHz with overlay changes.&lt;/p&gt;
&lt;p&gt;There seems to be no difference in using either CONFIG_SPI, or CONFIG_SPI_NOR.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf5340 128MHz &amp; SPI 32 MHz</title><link>https://devzone.nordicsemi.com/thread/468757?ContentTypeID=1</link><pubDate>Wed, 14 Feb 2024 08:44:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0028bd62-c36a-4add-bc4d-481056910ea2</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;SPIM4 is capable of running 32 MHz (regardless of CPU clock freq).&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s one example from 7002-DK for enabling spi4 (with ext flash):&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v2.5.1/boards/arm/nrf7002dk_nrf7001_nrf5340/nrf5340_cpuapp_common.dts#L162-L185"&gt;https://github.com/nrfconnect/sdk-nrf/blob/v2.5.1/boards/arm/nrf7002dk_nrf7001_nrf5340/nrf5340_cpuapp_common.dts#L162-L185&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]I need a core running at 128MHz.[/quote]
&lt;p&gt;You can enable this using the clock control subsys, and call it like this:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v2.5.1/samples/wifi/shell/src/main.c#L57-L62"&gt;https://github.com/nrfconnect/sdk-nrf/blob/v2.5.1/samples/wifi/shell/src/main.c#L57-L62&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>