<?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>migrating from old sdk to ned sdk, spi.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/116283/migrating-from-old-sdk-to-ned-sdk-spi</link><description>hello, i have a weired issue with my sensor communication using spi. the code that used the old SDK works, but the one using the new SDK for some reason doesnt. i need to understand if the same spi configurations as in the old version are reaching the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 02 Dec 2024 13:48:22 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/116283/migrating-from-old-sdk-to-ned-sdk-spi" /><item><title>RE: migrating from old sdk to ned sdk, spi.</title><link>https://devzone.nordicsemi.com/thread/512990?ContentTypeID=1</link><pubDate>Mon, 02 Dec 2024 13:48:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3bd5321a-f84d-4e8d-996b-807ae1f2cddb</guid><dc:creator>shlomots</dc:creator><description>&lt;p&gt;actually, this problem was allready solved, it was an hardware problem in the end.&lt;br /&gt;thanks anyway.&lt;br /&gt;-Shlomo&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: migrating from old sdk to ned sdk, spi.</title><link>https://devzone.nordicsemi.com/thread/512989?ContentTypeID=1</link><pubDate>Mon, 02 Dec 2024 13:45:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f846e33-ec2f-4e3b-a0ff-c6c7311f8cb7</guid><dc:creator>Priyanka</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;From the code, you have&amp;nbsp;&lt;br /&gt;&lt;em&gt;// Configure MISO (pin 11) as input with pull-up&lt;/em&gt;&lt;br /&gt;&lt;em&gt;gpio_pin_configure(gpio_dev, MISO_PIN, GPIO_INPUT | GPIO_PULL_UP);&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;So this will set MISO pin as pull up and not pull down. Also, I don&amp;#39;t think CS pin is set as pull down since in order to set them as pull up or down, you need them as a GPIO input, but the CS pin is GPIO output.&lt;br /&gt;&lt;br /&gt;Could you share your dts to see if they are set as GPIO pull up or down there?&lt;/p&gt;
&lt;p&gt;-Priyanka&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: migrating from old sdk to ned sdk, spi.</title><link>https://devzone.nordicsemi.com/thread/510483?ContentTypeID=1</link><pubDate>Thu, 14 Nov 2024 12:46:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8038487c-c174-4645-84ba-beb255f84c99</guid><dc:creator>shlomots</dc:creator><description>&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote userid="107729" url="~/f/nordic-q-a/116283/migrating-from-old-sdk-to-ned-sdk-spi/510458"]Configuration on the pins is handled by the driver. You just need to set the pins you want to use, in the device tree.[/quote]
&lt;p&gt;shouldnt these lines of code set miso for example as pull down?&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1731588441303v2.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: migrating from old sdk to ned sdk, spi.</title><link>https://devzone.nordicsemi.com/thread/510458?ContentTypeID=1</link><pubDate>Thu, 14 Nov 2024 12:02:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6a241b94-b8b6-48d3-8b26-f9d8cf5943f0</guid><dc:creator>Priyanka</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="shlomots"]1. how can I control the orc and irq values?&amp;nbsp;[/quote]
&lt;p&gt;.orc Can be set in devicetree. e.g. with a overlay like this:&lt;/p&gt;
&lt;p&gt;&amp;amp;spi0 {&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; overrun-character = &amp;lt; 0xFF &amp;gt;;&lt;/p&gt;
&lt;p&gt;};&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;irq can also be set in devicetree. But the default value is the recommended option.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
[quote user="shlomots"]2.&amp;nbsp;how can I control the miso to be pull_up or pin_down.[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Configuration on the pins is handled by the driver. You just need to set the pins you want to use, in the device tree.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;-Priyanka&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: migrating from old sdk to ned sdk, spi.</title><link>https://devzone.nordicsemi.com/thread/510049?ContentTypeID=1</link><pubDate>Tue, 12 Nov 2024 08:58:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:10ca8bd2-47a4-437e-a685-4699654cf61e</guid><dc:creator>shlomots</dc:creator><description>&lt;p&gt;Thank you for your response!&lt;br /&gt;to be honest, this doesn&amp;#39;t answer my question.&lt;br /&gt;I am very much aware of the device tree and overlay files, but my question is about deeper in the process.&lt;br /&gt;I want to see these values when I debug the code, ensure that the pin information for example actually reaches the the spi driver&amp;nbsp;in code.&lt;br /&gt;I think with some pictures I can explain better the process I went through.&lt;br /&gt;this is the bus field returned by the devicetree macro.&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1731400579287v1.png" alt=" " /&gt;&lt;br /&gt;the information is inside the config field but as you can see it is not reachable from at this point.&lt;br /&gt;in order to reach it I had to look deeper inside the call stack and see what the proper casting is:&lt;br /&gt;I found it is&amp;nbsp;(const struct spi_nrfx_config *)&lt;br /&gt;so when I cast it, I can look inside it:&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1731400878253v2.png" alt=" " /&gt;&lt;br /&gt;if I open spi-&amp;gt;p_reg-&amp;gt;PSEL:&amp;nbsp;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1731400995024v3.png" alt=" " /&gt;&lt;br /&gt;I can find the actual pin numbers I wrote in my device tree.&amp;nbsp;&lt;br /&gt;when I went further in the call stack into the &lt;span&gt;transcieve&lt;/span&gt; function, I found where the freqauncy, bit order, mode and irq find . &lt;br /&gt;I found these lines:&amp;nbsp;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1731401285353v4.png" alt=" " /&gt;&lt;br /&gt;as you can see, in the call stack that starts at the transcieve function we got to these lines of configuration in which the orc, freqauncy an mode numbers go also into the p_reg.&lt;br /&gt;(the mode is not configurable through the device tree but through the operation variable that goes to the devicetree macro).&lt;br /&gt;so for conclusion I pretty much found the answers for my questions but I still have some followup questions:&lt;br /&gt;1. how can I control the orc and irq values?&amp;nbsp;&lt;br /&gt;2.&amp;nbsp;how can I control the miso to be pull_up or pin_down. this is another change I saw in the old code that I didn&amp;#39;t see mentioned in the samples based on the new SDK. The way it was don&amp;#39;t in the old code is this:&amp;nbsp;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1731401923748v5.png" alt=" " /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: migrating from old sdk to ned sdk, spi.</title><link>https://devzone.nordicsemi.com/thread/509987?ContentTypeID=1</link><pubDate>Mon, 11 Nov 2024 20:19:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:682db1f2-c832-48c8-ba22-7dd3a583f1bf</guid><dc:creator>rbmarcus</dc:creator><description>&lt;p&gt;What you&amp;#39;re looking for are the DeviceTree and DeviceTree overlay files. Nordic has a &lt;a href="https://docs.nordicsemi.com/bundle/nrf-connect-vscode/page/reference/ui_dve.html"&gt;GUI-based editor&lt;/a&gt; to help set this up for you. Generally you will have a base DeviceTree file for your board, and then an overlay to add your project-specific configurations. Here&amp;#39;s a (possibly outdated) example of what your overlay would look like:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;spi2 {
        status = &amp;quot;okay&amp;quot;;
        cs-gpios = &amp;lt;&amp;amp;gpio0 18 GPIO_ACTIVE_LOW&amp;gt;;
        pinctrl-0 = &amp;lt;&amp;amp;spi2_default&amp;gt;;
        pinctrl-1 = &amp;lt;&amp;amp;spi2_sleep&amp;gt;;
        pinctrl-names = &amp;quot;default&amp;quot;, &amp;quot;sleep&amp;quot;;
        mcp3201: mcp3201@0 {
                compatible = &amp;quot;vnd,spi-device&amp;quot;;
                reg = &amp;lt;0&amp;gt;;
                spi-max-frequency = &amp;lt;1600000&amp;gt;;
                label = &amp;quot;mcp3201&amp;quot;;
        };
};
&amp;amp;pinctrl {
        spi2_default: spi2_default {
                group1 {
                        psels = &amp;lt;NRF_PSEL(SPIM_SCK, 0, 19)&amp;gt;,
                                &amp;lt;NRF_PSEL(SPIM_MOSI, 0, 21)&amp;gt;,
                                &amp;lt;NRF_PSEL(SPIM_MISO, 0, 22)&amp;gt;;
                };
        };
        spi2_sleep: spi2_sleep {
                group1 {
                        psels = &amp;lt;NRF_PSEL(SPIM_SCK, 0, 19)&amp;gt;,
                                &amp;lt;NRF_PSEL(SPIM_MOSI, 0, 21)&amp;gt;,
                                &amp;lt;NRF_PSEL(SPIM_MISO, 0, 22)&amp;gt;;
                        low-power-enable;
                };
        };
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You can see the sensor is defined along with your target parameters (frequency, chip select pin, etc.) and the SPI pins are redefined at the bottom for cases where you may not want to use the default SPI pin configuration associated with your board.&lt;/p&gt;
&lt;p&gt;I recommend going through the &lt;a href="https://academy.nordicsemi.com/"&gt;Nordic Developer Academy&lt;/a&gt; beginner course before jumping in and setting up a project yourself. Zephyr is a lot more involved than the nRF5 SDK and you&amp;#39;ll likely run into more problems that would have otherwise been answered by quick-start tutorials.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>