<?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>How do I make a peripheral driver on ncs?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/75504/how-do-i-make-a-peripheral-driver-on-ncs</link><description>Hi, 1. In ncs v1.5.0 nRF5340 I need to drive a spi peripheral w25q128 2. How do I generate this file? 
 3. Where can I find the syntax rules that generated this file? 4. Can you create a tool to generate such files, or provide examples of peripherals</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 03 Jun 2021 08:14:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/75504/how-do-i-make-a-peripheral-driver-on-ncs" /><item><title>RE: How do I make a peripheral driver on ncs?</title><link>https://devzone.nordicsemi.com/thread/313305?ContentTypeID=1</link><pubDate>Thu, 03 Jun 2021 08:14:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c69f9bf-f081-4dd3-bc67-f2a9154a9326</guid><dc:creator>peter.min</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;I&amp;#39;ve found the following information to gain a better understanding of how to build peripheral drivers&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a href="http://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.5.0/zephyr/guides/dts/howtos.html"&gt;http://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.5.0/zephyr/guides/dts/howtos.html&lt;/a&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;Thank&amp;ensp;you&amp;ensp;for&amp;ensp;all&amp;ensp;your&amp;ensp;assistance.&lt;br /&gt;Kind regards,&lt;br /&gt;Peter.Min&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I make a peripheral driver on ncs?</title><link>https://devzone.nordicsemi.com/thread/311518?ContentTypeID=1</link><pubDate>Tue, 25 May 2021 14:05:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26c8520d-ada8-44d9-8373-74f2e145bc6c</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=""]1. In ncs v1.5.0 nRF5340 I need to drive a spi peripheral w25q128&lt;br /&gt;2. How do I generate this file?[/quote]
&lt;p&gt;You generally have two options:&lt;/p&gt;
&lt;p&gt;1. Use a standard zephyr driver component (not always available!)&lt;/p&gt;
&lt;p&gt;2. Setup the SPIM directly, then interface the device manually.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For this particular device, you can have a look at the other boards available, which use the w25qxx series, for instance the feather board (nrf9160 based):&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/master/boards/arm/circuitdojo_feather_nrf9160/circuitdojo_feather_nrf9160_common.dts#L133-L146"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/master/boards/arm/circuitdojo_feather_nrf9160/circuitdojo_feather_nrf9160_common.dts#L133-L146&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You should then copy the above section into your .overlay file, and edit according to the device that you are communicating with.&lt;/p&gt;
&lt;p&gt;For the kconfig side of things, this is the one&amp;#39;s needed for normal SPIM operation:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/master/samples/subsys/fs/littlefs/boards/circuitdojo_feather_nrf9160.conf#L6-L8"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/master/samples/subsys/fs/littlefs/boards/circuitdojo_feather_nrf9160.conf#L6-L8&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;While QSPI has different kconfig entries:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/master/samples/subsys/fs/littlefs/boards/nrf52840dk_nrf52840.conf"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/master/samples/subsys/fs/littlefs/boards/nrf52840dk_nrf52840.conf&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]3. Where can I find the syntax rules that generated this file?[/quote]
&lt;p&gt;This is a descriptive language called Device Tree. You can read more about this in our NCS tutorial:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/nordic/b/archives/posts/ncs-tutorial---temporary"&gt;https://devzone.nordicsemi.com/nordic/b/archives/posts/ncs-tutorial---temporary&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The syntax for the spim is derived from the compatible = &amp;quot;component&amp;quot;, where &amp;quot;component&amp;quot; in this case is &amp;quot;nordic,nrf-spim&amp;quot;, described in this yaml file:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/master/dts/bindings/spi/nordic,nrf-spim.yaml"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/master/dts/bindings/spi/nordic,nrf-spim.yaml&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]4. Can you create a tool to generate such files, or provide examples of peripherals directly?[/quote]
&lt;p&gt;This is unfortunately not something that we have available at this time. As for examples, there are some in the zephyr samples section, but not for your specific device (although the device series should be supported).&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;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>