<?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>[nRF52840] SPI data control pin definition (.dts)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/91994/nrf52840-spi-data-control-pin-definition-dts</link><description>Hi, 
 
 I&amp;#39;m porting my SSD1333 (Solomon IC for OLED displays) code driver to Zephyr OS drivers for ease of use along with LVGL (going from `&amp;lt; nrfx_spim.h&amp;gt;` to `&amp;lt;drivers/spi.h&amp;gt;`) . 
 
 Actually, I want to know if there is way of defining custom bindings</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 16 Sep 2022 11:52:34 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/91994/nrf52840-spi-data-control-pin-definition-dts" /><item><title>RE: [nRF52840] SPI data control pin definition (.dts)</title><link>https://devzone.nordicsemi.com/thread/386627?ContentTypeID=1</link><pubDate>Fri, 16 Sep 2022 11:52:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e8e1c881-3e75-4753-be95-67311a95da61</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 is hard to test on my end, as you&amp;#39;re developing your own driver, and I do not have the build artifacts to look at.&lt;/p&gt;
&lt;p&gt;What you can try is to rather address the variable like this and see if this helps?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;DT_PROP(DT_NODELABEL(ssd1333), width)&lt;/pre&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: [nRF52840] SPI data control pin definition (.dts)</title><link>https://devzone.nordicsemi.com/thread/386533?ContentTypeID=1</link><pubDate>Fri, 16 Sep 2022 08:11:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd5fc4e7-f25f-444c-af36-86ddd0a323e8</guid><dc:creator>AnomalySmith</dc:creator><description>&lt;p&gt;Sure, I&amp;#39;ve got an overlay file that describes:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/*
* nRF52840_dk      SSD1333 (160x128)
* 
* P0.28 (RESET)   RES
* P0.30 (D5)      DC (DATA/CMD)
* P0.5 (SCK)      SCL
* P1.0 (MOSI)     SDA
* P1.08 (CS)      SDA
*/

/ {
  chosen {
    zephyr,display = &amp;amp;ssd1333;
  };
};

&amp;amp;pinctrl {
 spi3_default: spi3_default {
   group1 {
     psels = &amp;lt;NRF_PSEL(SPIM_SCK, 0, 5)&amp;gt;,
       &amp;lt;NRF_PSEL(SPIM_MOSI, 0, 32)&amp;gt;,
       &amp;lt;NRF_PSEL(SPIM_MISO, 0, 31)&amp;gt;;
   };
 };

 spi3_sleep: spi3_sleep {
   group1 {
     psels = &amp;lt;NRF_PSEL(SPIM_SCK, 0, 5)&amp;gt;,
       &amp;lt;NRF_PSEL(SPIM_MOSI, 0, 32)&amp;gt;,
       &amp;lt;NRF_PSEL(SPIM_MISO, 0, 31)&amp;gt;;
     low-power-enable;
   };
 };
};

&amp;amp;spi3 {
  compatible = &amp;quot;nordic,nrf-spim&amp;quot;;
  status = &amp;quot;okay&amp;quot;;
  pinctrl-0 = &amp;lt;&amp;amp;spi3_default&amp;gt;;
  pinctrl-1 = &amp;lt;&amp;amp;spi3_sleep&amp;gt;;
  cs-gpios = &amp;lt;&amp;amp;gpio0 25 GPIO_ACTIVE_LOW&amp;gt;;
  pinctrl-names = &amp;quot;default&amp;quot;, &amp;quot;sleep&amp;quot;;

  ssd1333: ssd1333@0 {
    compatible = &amp;quot;solomon,ssd1333&amp;quot;;
    label = &amp;quot;SSD1333&amp;quot;;
    spi-max-frequency = &amp;lt;20000000&amp;gt;;
    reg = &amp;lt;0&amp;gt;;
    cmd-data-pin = &amp;lt;&amp;amp;gpio0 30 GPIO_ACTIVE_LOW&amp;gt;;
    reset-pin = &amp;lt; &amp;amp;gpio0 28 GPIO_ACTIVE_LOW &amp;gt;;
    width = &amp;lt;160&amp;gt;;
    height = &amp;lt;128&amp;gt;;
    x-offset = &amp;lt;0&amp;gt;;
    y-offset = &amp;lt;0&amp;gt;;
    vcom = &amp;lt;0x19&amp;gt;;
    gctrl = &amp;lt;0x35&amp;gt;;
  };
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Otherwise, I don&amp;#39;t have any&amp;nbsp;&lt;span&gt;ssd1333-common.yaml file (as I don&amp;#39;t see any on displays drivers and samples)&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52840] SPI data control pin definition (.dts)</title><link>https://devzone.nordicsemi.com/thread/386530?ContentTypeID=1</link><pubDate>Fri, 16 Sep 2022 07:55:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:386cb799-770c-4ff5-81bf-b5ac45abdb50</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Have you checked that &amp;quot;width&amp;quot; and &amp;quot;height&amp;quot; is&amp;nbsp;described&amp;nbsp;in your ssd1333-common.yaml file?&lt;/p&gt;
&lt;p&gt;Can you share your build-folder/zephyr/zephyr.dts file?&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: [nRF52840] SPI data control pin definition (.dts)</title><link>https://devzone.nordicsemi.com/thread/386491?ContentTypeID=1</link><pubDate>Fri, 16 Sep 2022 06:28:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:56bec43a-06e1-4d71-bf1f-0f395cc695d1</guid><dc:creator>AnomalySmith</dc:creator><description>&lt;p&gt;Thanks, applying this logic makes more sense :)&lt;/p&gt;
&lt;p&gt;But now, just&amp;nbsp;another error comes up about the custom properties :&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;In file included from /opt/nordic/ncs/v2.0.2/zephyr/include/zephyr/arch/arm/aarch32/arch.h:20,
                 from /opt/nordic/ncs/v2.0.2/zephyr/include/zephyr/arch/cpu.h:19,
                 from /opt/nordic/ncs/v2.0.2/zephyr/include/zephyr/kernel_includes.h:33,
                 from /opt/nordic/ncs/v2.0.2/zephyr/include/zephyr/kernel.h:17,
                 from /opt/nordic/ncs/v2.0.2/zephyr/include/zephyr/init.h:11,
                 from /opt/nordic/ncs/v2.0.2/zephyr/include/zephyr/device.h:29,
                 from /opt/nordic/ncs/v2.0.2/zephyr/drivers/display/ssd1333.c:13:
/opt/nordic/ncs/v2.0.2/zephyr/drivers/display/ssd1333.c: In function &amp;#39;ssd1333_get_capabilities&amp;#39;:
/opt/nordic/ncs/v2.0.2/zephyr/include/zephyr/devicetree.h:305:40: error: &amp;#39;DT_N_INST_3_solomon_ssd1333_P_width&amp;#39; undeclared (first use in this function)
  305 | #define DT_INST(inst, compat) UTIL_CAT(DT_N_INST, DT_DASH(inst, compat))
      | &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;On the related driver&amp;#39;s function :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void ssd1333_get_capabilities(const struct device *dev, struct display_capabilities *caps) {
  memset(caps, 0, sizeof(struct display_capabilities));
  caps-&amp;gt;x_resolution = DT_INST_PROP(3, width);
  caps-&amp;gt;y_resolution = DT_INST_PROP(3, height);
  caps-&amp;gt;supported_pixel_formats = PIXEL_FORMAT_RGB_565;
  caps-&amp;gt;current_pixel_format = PIXEL_FORMAT_RGB_565;
  caps-&amp;gt;screen_info = 0;
  caps-&amp;gt;current_orientation = DISPLAY_ORIENTATION_NORMAL;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m trying to see any difference between the ssd1306 sample but still can&amp;#39;t find any :/&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Do you have an idea ? Where should I also define those ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&amp;nbsp;I&amp;#39;ve changed slightly the driver file to align with the&amp;nbsp;&lt;em&gt;ssd16xx &lt;/em&gt;one and the error is gone for now :&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;caps-&amp;gt;x_resolution = config-&amp;gt;width; // instead of DT_INST_PROP(0, width);...
caps-&amp;gt;y_resolution = config-&amp;gt;height;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Still others error but will go into it and let you know the final outcome &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52840] SPI data control pin definition (.dts)</title><link>https://devzone.nordicsemi.com/thread/386430?ContentTypeID=1</link><pubDate>Thu, 15 Sep 2022 14:11:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d43e1161-56ff-4b7f-9fa9-c5c1daaa18de</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 your current DT setup:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;spi3 {
  status = &amp;quot;okay&amp;quot;;
  device_type = &amp;quot;spi&amp;quot;;
  compatible = &amp;quot;nordic,nrf-spim&amp;quot;;
  sck-pin = &amp;lt; 5 &amp;gt;;
  mosi-pin = &amp;lt; 32 &amp;gt;;
  data-ctrl-pin = &amp;lt;&amp;amp;gpio0 30 GPIO_ACTIVE_LOW&amp;gt;;
  clock-frequency = &amp;lt;8000000&amp;gt;;
  cs-pin = &amp;lt; &amp;amp;gpio1 8 GPIO_ACTIVE_LOW &amp;gt;;
  reset-pin = &amp;lt; &amp;amp;gpio0 28 GPIO_ACTIVE_LOW &amp;gt;;

  ssd1333: ssd1333@0 {
      compatible = &amp;quot;solomon,ssd1333&amp;quot;;
      status = &amp;quot;okay&amp;quot;;
      reg = &amp;lt; 0x0 &amp;gt;;
      label = &amp;quot;OLED_DISPLAY&amp;quot;;
      spi-max-frequency = &amp;lt; 0x16e3600 &amp;gt;;
      width = &amp;lt;160&amp;gt;;
      height = &amp;lt;128&amp;gt;;
  };&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You should move the non-standard SPI properties to your sensor definition, ie:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;spi3 {
  status = &amp;quot;okay&amp;quot;;
  compatible = &amp;quot;nordic,nrf-spim&amp;quot;;
  ...


  ssd1333: ssd1333@0 {
      compatible = &amp;quot;solomon,ssd1333&amp;quot;;
      ...
      reset-pin = &amp;lt; &amp;amp;gpio0 28 GPIO_ACTIVE_LOW &amp;gt;;
      data-ctrl-pin = &amp;lt;&amp;amp;gpio0 30 GPIO_ACTIVE_LOW&amp;gt;;
  };&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Similar to how it&amp;#39;s done in ssd1306:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v3.1.99-ncs1-rc1/boards/shields/ssd1306/ssd1306_128x64_spi.overlay#L29-L30"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/v3.1.99-ncs1-rc1/boards/shields/ssd1306/ssd1306_128x64_spi.overlay#L29-L30&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]Also, if I use this &lt;strong&gt;spi3&lt;/strong&gt; on&amp;nbsp;nRF52840 that way, will I be able to set the max&amp;nbsp;&lt;span&gt;32MHz clock over SPI (and Easy DMA but I think not)?&lt;/span&gt;[/quote]
&lt;p&gt;spi3 is 32M capable, but I would strongly recommend that you test on lower speeds to ensure that your driver works first.&lt;/p&gt;
&lt;p&gt;32M speed also has strict requirements wrt. pcb trace length and the GPIOs used needs to be set in high-drive (configured in NRF_Px-&amp;gt;PIN_CNF[] register)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&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>