<?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>Not able to Initialize HIght Speed SPI in nRF Connect SDK v1.5.1</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/78362/not-able-to-initialize-hight-speed-spi-in-nrf-connect-sdk-v1-5-1</link><description>Hello, 
 I am using nRF5340DK board and I am trying to enable high-speed SPI pins in nrf5340dk_nrf5340_cpuapp.dts 
 &amp;amp;spi4 { compatible = &amp;quot;nordic,nrf-spim&amp;quot;; status = &amp;quot;okay&amp;quot;; sck-pin = &amp;lt;8&amp;gt;; miso-pin = &amp;lt;9&amp;gt;; mosi-pin = &amp;lt;10&amp;gt;; }; 
 
 And enabled configuration</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 19 Aug 2021 13:30:33 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/78362/not-able-to-initialize-hight-speed-spi-in-nrf-connect-sdk-v1-5-1" /><item><title>RE: Not able to Initialize HIght Speed SPI in nRF Connect SDK v1.5.1</title><link>https://devzone.nordicsemi.com/thread/325761?ContentTypeID=1</link><pubDate>Thu, 19 Aug 2021 13:30:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1cf899d4-b72f-4065-9862-7e7fb65053ea</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;
[quote user="SanketC"]Thank you for giving me a pointer for SPI to look into. As currently, this delay is creating&amp;nbsp;some trouble so I am looking for some other peripherals.&amp;nbsp; Next week I will look into SPI and get back to you in case of any queries.&amp;nbsp;[/quote]
&lt;p&gt;Happy to help! let me know if you run into any issues!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Not able to Initialize HIght Speed SPI in nRF Connect SDK v1.5.1</title><link>https://devzone.nordicsemi.com/thread/325563?ContentTypeID=1</link><pubDate>Wed, 18 Aug 2021 15:29:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf995d52-e839-4cef-bcb7-b0965c8c5179</guid><dc:creator>SanketC</dc:creator><description>&lt;p&gt;Hello&amp;nbsp;&lt;span&gt;H&amp;aring;kon,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you for giving me a pointer for SPI to look into. As currently, this delay is creating&amp;nbsp;some trouble so I am looking for some other peripherals.&amp;nbsp; Next week I will look into SPI and get back to you in case of any queries.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best Regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Sanket C&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Not able to Initialize HIght Speed SPI in nRF Connect SDK v1.5.1</title><link>https://devzone.nordicsemi.com/thread/325076?ContentTypeID=1</link><pubDate>Mon, 16 Aug 2021 11:07:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:453a16e1-0426-4c3e-bb2d-e69a44bc0290</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;For an example of using the nrfx driver directly, please see this post:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/69279/spim-transfer-crashing-on-nrf5340/288955#288955"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/69279/spim-transfer-crashing-on-nrf5340/288955#288955&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For using hardware controlled CSN, please see my former response, which is essentially taking your current firmware and:&lt;/p&gt;
&lt;p&gt;1. remove the zephyr wrappers CSN control (see your variable &amp;quot;spi_cs_ctrl&amp;quot;, remember to also remove it from the device tree)&lt;/p&gt;
&lt;p&gt;2. configure your csn pin as output, then write NRF_SPIM4-&amp;gt;PSEL.CSN=yourwantedpin; after initializing the spi instance to see if this works.&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: Not able to Initialize HIght Speed SPI in nRF Connect SDK v1.5.1</title><link>https://devzone.nordicsemi.com/thread/324917?ContentTypeID=1</link><pubDate>Sat, 14 Aug 2021 06:07:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9b0015d-2a97-413d-843d-58090ffc5f43</guid><dc:creator>SanketC</dc:creator><description>&lt;p&gt;Hello&amp;nbsp;&lt;span&gt;H&amp;aring;kon,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Would you help me provide any ready example for following things:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;1. How can I control GPIO directly&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2. How to use spi_nrfx_spim&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;This will really help us to save time.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best Regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;SanketC&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Not able to Initialize HIght Speed SPI in nRF Connect SDK v1.5.1</title><link>https://devzone.nordicsemi.com/thread/324469?ContentTypeID=1</link><pubDate>Wed, 11 Aug 2021 12:06:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f4377b3e-78b3-4429-b062-31ee9a959c8a</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;The problem with using spi_cs_control is that it&amp;#39;s software controlled, as the zephyr port does use the hardware controlled CSN pin (also: hw controlled CSN&amp;nbsp;does not play nice together with multiple slaves):&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/master/drivers/spi/spi_nrfx_spim.c#L437"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/master/drivers/spi/spi_nrfx_spim.c#L437&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can use the nrfx_spim driver directly, or try to set the register manually in your application code (remember to disable the spi_cs_control struct if you do so):&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf5340/spim.html?cp=3_0_0_6_29_6_26#register.PSEL.CSN"&gt;https://infocenter.nordicsemi.com/topic/ps_nrf5340/spim.html?cp=3_0_0_6_29_6_26#register.PSEL.CSN&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: Not able to Initialize HIght Speed SPI in nRF Connect SDK v1.5.1</title><link>https://devzone.nordicsemi.com/thread/324429?ContentTypeID=1</link><pubDate>Wed, 11 Aug 2021 10:17:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b950023-79a5-4b8a-b486-7417ef6eed2f</guid><dc:creator>SanketC</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;H&amp;aring;kon,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Now another help I needed to drive CS pin fast.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;My SPI4 SCK is at 16Mhz and I am sending 3byte (SPI configured as 8bit word size). In this case, I can observe the delay before and after starting the transmission. I have passed value&amp;quot;0&amp;quot; to the structure&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static struct spi_cs_control spi_cs_ctrl = {
.gpio_pin = 11,
.delay = 0,
.gpio_dt_flags = GPIO_ACTIVE_LOW
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;and configured SCK, MISO, MOSI &amp;amp; CS as follows&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt; &lt;pre class="ui-code" data-mode="text"&gt;ret = gpio_pin_configure(spi_cs_ctrl.gpio_dev, mosi_pin, GPIO_DS_ALT_HIGH | GPIO_DS_ALT_LOW);
RET_IF_ERR(ret);
ret = gpio_pin_configure(spi_cs_ctrl.gpio_dev, miso_pin, GPIO_DS_ALT_HIGH | GPIO_DS_ALT_LOW);
RET_IF_ERR(ret);
ret = gpio_pin_configure(spi_cs_ctrl.gpio_dev, sck_pin, GPIO_DS_ALT_HIGH | GPIO_DS_ALT_LOW);
RET_IF_ERR(ret);
ret = gpio_pin_configure(spi_cs_ctrl.gpio_dev, cs_pin, GPIO_DS_ALT_HIGH | GPIO_DS_ALT_LOW);
RET_IF_ERR(ret);

&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Observed delay is&amp;nbsp;for CS drive:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Before transmission = 5microseconds (CS drive high to low and after 5us SPI Tx)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;After Transmission = 10microseconds&amp;nbsp;(SPI tx is done, after 10us CS drive low to high)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I want to minimize this delay as much as possible. Please help me doing this.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Not able to Initialize HIght Speed SPI in nRF Connect SDK v1.5.1</title><link>https://devzone.nordicsemi.com/thread/324422?ContentTypeID=1</link><pubDate>Wed, 11 Aug 2021 10:02:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:54292f46-f57d-4fe9-8756-0e02789da47f</guid><dc:creator>SanketC</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;H&amp;aring;kon&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you for your suggestion. After going through the code I have found that API &amp;quot;dk_buttons_init(button_changed);&amp;quot; is getting called twice and after correcting this SPI4 is up and running. But I am not able to figure out why it is only giving errors with SPI4 and why not in normal scenarios. If in case you have any information then please do let me.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Not able to Initialize HIght Speed SPI in nRF Connect SDK v1.5.1</title><link>https://devzone.nordicsemi.com/thread/323919?ContentTypeID=1</link><pubDate>Mon, 09 Aug 2021 07:48:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:22b7f56e-d40b-4b8e-9f78-c9ff6cb3411d</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;It looks like you have the correct setup for using SPI, but a fault is triggered during runtime.&lt;/p&gt;
[quote user=""]&lt;span&gt;[00:00:03.889,007] [1;31m&amp;lt;err&amp;gt; os: Precise data bus error[0m&lt;/span&gt;&lt;br /&gt;&lt;span&gt;[00:00:03.889,038] [1;31m&amp;lt;err&amp;gt; os: BFAR Address: 0x0[0m&lt;/span&gt;[/quote]
&lt;p&gt;This indicates that you are executing a NULL pointer somewhere.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you try to look at your .map file, or use arm-none-eabi-addr2line to resolve the faulting addresses to source code lines?&lt;/p&gt;
&lt;p&gt;ie.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;arm-none-eabi-addr2line -e build-folder/zephyr/zephyr.elf 0x00017d98
arm-none-eabi-addr2line -e build-folder/zephyr/zephyr.elf 0x00018225&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""][00:00:03.889,068] [1;31m&amp;lt;err&amp;gt; os: Current thread: 0x200013a0 (unknown)[0m[/quote]
&lt;p&gt;This is a RAM mapped address, so you need to figure out which thread this is by manually checking the build-folder/zephyr/zephyr.map file. It might be that you need to adjust the stack size for this specific thread.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>