<?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>Zephyr peripheral pin remap with overlay file</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/79547/zephyr-peripheral-pin-remap-with-overlay-file</link><description>My application uses a SPI LED driver, which I routed on a PCB to the most convenient pins for routing. 
 I have already tested my firmware on a nRF52833 DK with an Arduino shield. This uses the spi3 pin assignment on the default DTS. 
 
 Now i want to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 14 Sep 2021 08:34:01 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/79547/zephyr-peripheral-pin-remap-with-overlay-file" /><item><title>RE: Zephyr peripheral pin remap with overlay file</title><link>https://devzone.nordicsemi.com/thread/329344?ContentTypeID=1</link><pubDate>Tue, 14 Sep 2021 08:34:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0db5e3dc-885d-43da-90a1-e9533a0950be</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="Arturo H"]The macros solved the problem with the chip select issue, thanks.[/quote]
&lt;p&gt;I&amp;#39;m glad to hear this!&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="Arturo H"]&lt;p&gt;Each time I&amp;#39;m making a change on the overlay file, should I run CMake again?&lt;/p&gt;
&lt;p&gt;On SES does build can be configured to run CMake each build?&lt;/p&gt;[/quote]
&lt;p&gt;&amp;nbsp;.overlay changes isn&amp;#39;t always picked up by the build system, so it is recommended that you re-import the project to ensure that the changes have been applied.&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: Zephyr peripheral pin remap with overlay file</title><link>https://devzone.nordicsemi.com/thread/329326?ContentTypeID=1</link><pubDate>Tue, 14 Sep 2021 07:32:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ea4d871-f034-4327-af12-e631885c3306</guid><dc:creator>Arturo Hache</dc:creator><description>&lt;p&gt;Each time I&amp;#39;m making a change on the overlay file, should I run CMake again?&lt;/p&gt;
&lt;p&gt;On SES does build can be configured to run CMake each build?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The macros solved the problem with the chip select issue, thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr peripheral pin remap with overlay file</title><link>https://devzone.nordicsemi.com/thread/329168?ContentTypeID=1</link><pubDate>Mon, 13 Sep 2021 09:27:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e3cc99a-9764-4b7b-8f3f-e9de8ceea420</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;This is not the correct format for the cs-gpios member:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;cs-gpios = &amp;lt;31&amp;gt;; //P0.31&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can see the expected format in the yml file for the generic spi controller:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.6.99-ncs1-rc1/dts/bindings/spi/spi-controller.yaml#L24-L63"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/v2.6.99-ncs1-rc1/dts/bindings/spi/spi-controller.yaml#L24-L63&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For your scenario, where you want to use P0.31, it should be:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;cs-gpios = &amp;lt;&amp;amp;gpio0 31 GPIO_ACTIVE_LOW&amp;gt;;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]I tested this modification running some dupont cables to the appropiate pins, still with the nRF52833. What does work is changing the pin assignment on the code, for example using a custom structure like:[/quote]
&lt;p&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;const struct spi_cs_control ctrl =
{
.gpio_dev = DEVICE_DT_GET(DT_NODELABEL(gpio0)),
.delay = 0,
.gpio_pin = 31,
.gpio_dt_flags = (GPIO_ACTIVE_LOW)
};&lt;/pre&gt;&lt;/p&gt;
[quote user=""]Which is the best way to get this to work?[/quote]
&lt;p&gt;&amp;nbsp;The code has omitted the defines that were emitted by the compiled device tree, as you&amp;#39;re not fetching the cs-gpios member, which is just fine (you end up in the same scenario), but if you change it in dts, nothing will happen on the application level.&lt;/p&gt;
&lt;p&gt;You can use these helper macros:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.4.99-ncs2/subsys/disk/disk_access_spi_sdhc.c#L844-L848"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/v2.4.99-ncs2/subsys/disk/disk_access_spi_sdhc.c#L844-L848&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As long as you set this in the top of main:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/sigurdnev/ncs-playground/blob/master/samples/spi_test/src/main.c#L11"&gt;https://github.com/sigurdnev/ncs-playground/blob/master/samples/spi_test/src/main.c#L11&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>