<?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>nRF9160 samples : undefined device names for device_get_binding</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/60132/nrf9160-samples-undefined-device-names-for-device_get_binding</link><description>Hello, 
 
 I&amp;#39;m using ncs 1.2.0 and trying to compile sample projects like v1.2.0\nrf\samples\sensor\bh1749, also v1.2.0\zephyr\samples\sensor\* but all the defines for device label like &amp;quot;DT_INST_0_ROHM_BH1749_BUS_NAME&amp;quot; passed to device_get_binding() are</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 25 Apr 2020 15:26:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/60132/nrf9160-samples-undefined-device-names-for-device_get_binding" /><item><title>RE: nRF9160 samples : undefined device names for device_get_binding</title><link>https://devzone.nordicsemi.com/thread/246625?ContentTypeID=1</link><pubDate>Sat, 25 Apr 2020 15:26:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dfe9d5f6-6124-499a-ab5e-f3054caf5a1e</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;Thank you Heidi very much for your help, now it is working, I just had to enable some stuff in the prj.conf file.&lt;/p&gt;
&lt;p&gt;Below is the config that worked for me&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_SERIAL=n
CONFIG_CAN=y
CONFIG_CAN_1=y
CONFIG_SPI=y
CONFIG_CAN_MCP2515=y
CONFIG_CAN_INIT_PRIORITY=80
CONFIG_CAN_MAX_FILTER=5

CONFIG_SHELL=y
CONFIG_CAN_SHELL=y
CONFIG_DEVICE_SHELL=y&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 samples : undefined device names for device_get_binding</title><link>https://devzone.nordicsemi.com/thread/245576?ContentTypeID=1</link><pubDate>Mon, 20 Apr 2020 13:46:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f660a36a-4efc-46af-9ca7-cea9e1cd69ff</guid><dc:creator>Heidi</dc:creator><description>&lt;p&gt;Okay, it builds for me now, just had to change a few things.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;1. First of all the .overlay file should have the same name as the board you&amp;#39;re building for, so &amp;quot;nrf9160_pca10090ns.overlay&amp;quot;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;2. Second, SPI1 will crash with UART1 on the DK by default, so it&amp;#39;s easier to just avoid that one and use SPI3 instead.&lt;/p&gt;
&lt;p&gt;3. And then in the .overlay file in your project, there were a few errors in the definitions of GPIO&amp;#39;s.&lt;/p&gt;
&lt;p&gt;The overlay filed here works for me, just make sure to have the correct name.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;spi3 {
    status = &amp;quot;okay&amp;quot;;
    cs-gpios = &amp;lt;&amp;amp;gpio0 13 0&amp;gt;; /* D10 */
    sck-pin = &amp;lt;10&amp;gt;;
    mosi-pin = &amp;lt;11&amp;gt;;
    miso-pin = &amp;lt;12&amp;gt;;
    can1: mcp2515@0 {
        compatible = &amp;quot;microchip,mcp2515&amp;quot;;
        spi-max-frequency = &amp;lt;1000000&amp;gt;;
        int-gpios = &amp;lt;&amp;amp;gpio0 31 0&amp;gt;; /* D2 */
        status = &amp;quot;okay&amp;quot;;
        label = &amp;quot;CAN_1&amp;quot;;
        reg = &amp;lt;0x0&amp;gt;;
        osc-freq = &amp;lt;16000000&amp;gt;;
        bus-speed = &amp;lt;125000&amp;gt;;
        sjw = &amp;lt;1&amp;gt;;
        prop-seg = &amp;lt;2&amp;gt;;
        phase-seg1 = &amp;lt;7&amp;gt;;
        phase-seg2 = &amp;lt;6&amp;gt;;
        #address-cells = &amp;lt;1&amp;gt;;
        #size-cells = &amp;lt;0&amp;gt;;
    };
};
/ {
 aliases {
    can-primary = &amp;amp;can1;
    };
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Heidi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 samples : undefined device names for device_get_binding</title><link>https://devzone.nordicsemi.com/thread/245086?ContentTypeID=1</link><pubDate>Thu, 16 Apr 2020 17:42:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c23db539-30ab-4346-b4b3-88e735c7f83f</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/CAN.zip"&gt;devzone.nordicsemi.com/.../CAN.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I attached the project that I copied from&amp;nbsp;v1.2.0\zephyr\samples\drivers\CAN.&lt;/p&gt;
&lt;p&gt;I only&amp;nbsp;added the overlay file for mcp2515 to cMakeLists.txt&lt;/p&gt;
&lt;p&gt;I get the following error&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;../src/main.c: In function &amp;#39;main&amp;#39;:
../src/main.c:198:44: error: &amp;#39;DT_ALIAS_CAN_PRIMARY_LABEL&amp;#39; undeclared (first use in this function); did you mean &amp;#39;DT_ALIAS_TIMER_1_LABEL&amp;#39;?
   printk(&amp;quot;DT_ALIAS_CAN_PRIMARY_LABEL %d\n&amp;quot;,DT_ALIAS_CAN_PRIMARY_LABEL);
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
                                            DT_ALIAS_TIMER_1_LABEL&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;One this is that not clear for me, what child name should I use&amp;nbsp;to enable CAN over SPI&lt;/p&gt;
&lt;p&gt;I simply put CAN as showing below&lt;/p&gt;
&lt;p&gt;set(CAN_DTC_OVERLAY_FILE&lt;br /&gt; ${CMAKE_CURRENT_SOURCE_DIR}/mcp2515.overlay&lt;br /&gt;)&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thank you Heidi for your help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 samples : undefined device names for device_get_binding</title><link>https://devzone.nordicsemi.com/thread/245008?ContentTypeID=1</link><pubDate>Thu, 16 Apr 2020 13:16:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f86a352f-729a-4793-bfaa-6095438b6281</guid><dc:creator>Heidi</dc:creator><description>&lt;p&gt;Okay, I see.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user="Hicham_c"]so my question is, how to add the CAN&amp;nbsp;into the nrf9160 DK ?&amp;nbsp;[/quote]
&lt;p&gt;&amp;nbsp;It looks like what you have done is correct.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user=""] but all the defines for device label like &amp;quot;DT_INST_0_ROHM_BH1749_BUS_NAME&amp;quot; passed to&amp;nbsp;&lt;span style="font-size:inherit;"&gt;&lt;strong&gt;device_get_binding()&lt;/strong&gt;&lt;/span&gt; are unknown.&amp;nbsp;[/quote]
&lt;p&gt;What error are you seeing specifically?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Can you attach the mcp2515.overlay file?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="Hicham_c"]cmake_minimum_required(VERSION 3.13.1)&lt;br /&gt;set(&amp;lt;image_name&amp;gt;_DTC_OVERLAY_FILE&lt;br /&gt; ${CMAKE_CURRENT_SOURCE_DIR}/mcp2515.overlay&lt;br /&gt;)[/quote]
&lt;p&gt;For this line just beware that if &amp;lt;image_name&amp;gt; has an overlay file from before, you need to put the existing file name between those two arguments.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 samples : undefined device names for device_get_binding</title><link>https://devzone.nordicsemi.com/thread/244539?ContentTypeID=1</link><pubDate>Tue, 14 Apr 2020 17:45:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:56014095-6b69-49fd-89c6-087b765ba011</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;Thank you Heidi for your response.&lt;/p&gt;
&lt;p&gt;I have followed the tuotorials series and have a good understanding of the ncs usage.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m actually trying to&amp;nbsp;add CAN data tusing the nrF9160 DK and mcp2515 chip. So I started from this&amp;nbsp;ncs\v1.2.0\zephyr\samples\drivers\CAN which uses the same chip.&lt;/p&gt;
&lt;p&gt;building the project right away doesn&amp;#39;t work obviously, It says undefined&amp;nbsp;&amp;nbsp;&lt;span&gt;DT_ALIAS_CAN_PRIMARY_LABEL passing in&amp;nbsp;&lt;/span&gt;device_get_binding();&lt;/p&gt;
&lt;p&gt;so I added the&amp;nbsp;mcp2515.overlay in the&amp;nbsp;CMakeLists.txt as shown below&lt;/p&gt;
&lt;p&gt;cmake_minimum_required(VERSION 3.13.1)&lt;br /&gt;set(&amp;lt;image_name&amp;gt;_DTC_OVERLAY_FILE&lt;br /&gt; ${CMAKE_CURRENT_SOURCE_DIR}/mcp2515.overlay&lt;br /&gt;)&lt;/p&gt;
&lt;p&gt;so my question is, how to add the CAN&amp;nbsp;into the nrf9160 DK ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 samples : undefined device names for device_get_binding</title><link>https://devzone.nordicsemi.com/thread/244517?ContentTypeID=1</link><pubDate>Tue, 14 Apr 2020 15:48:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:85254896-84e0-436c-b24d-3d59ee533a02</guid><dc:creator>Heidi</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;The sample you refer to for BH1749 only works with the Thingy:91 not the nRF91 DK, because the DK does not have that sensor. If you build it using the nrf9160_pca20035ns board you shouldn&amp;#39;t be getting any errors.&lt;/p&gt;
&lt;p&gt;Please take a look at &lt;a href="https://github.com/NordicPlayground/fw-nrfconnect-nrf/blob/master/boards/arm/nrf9160_pca20035/nrf9160_pca20035_common.dts#L121"&gt;this line&lt;/a&gt;&amp;nbsp;in the .dts file of the Thingy:91 boards file. This is how the sensor should be defined in an overlay file (in another case, where you, for example, included an external sensor).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""] if yes, how can I link between lets say the SPI and the device ?[/quote]
&lt;p&gt;&amp;nbsp;You can take a look at the .dts file I linked to above to see how these defines should look.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/nordic/nrf-connect-sdk-guides/b/getting-started/posts/nrf-connect-sdk-tutorial---part-3-temporary#h56sk0f6zs6u1qqs6nj2hbrjty9raxu"&gt;This NCS tutorial&lt;/a&gt;&amp;nbsp;explains how to use the sensor drivers and what overlay files are.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Heidi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>