<?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>Issues compiling custom I2C driver</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/93458/issues-compiling-custom-i2c-driver</link><description>Hey, 
 
 Trying to compile a custom driver for an I2C device and running into issues getting the actual DT node to link with the driver at build time. 
 Specifically, (because it looks like it&amp;#39;ll never go in) I&amp;#39;m trying to use this driver https://github</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 16 Nov 2022 23:21:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/93458/issues-compiling-custom-i2c-driver" /><item><title>RE: Issues compiling custom I2C driver</title><link>https://devzone.nordicsemi.com/thread/396096?ContentTypeID=1</link><pubDate>Wed, 16 Nov 2022 23:21:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f205f0d7-b330-453d-b292-3f6f15caef93</guid><dc:creator>napei_</dc:creator><description>&lt;p&gt;A solution that doesn&amp;#39;t require every one of my team to custom-patch zephyr for every&amp;nbsp;out-of-tree sensor would be nice if possible. Understandable if nrf SDK isn&amp;#39;t set up for this at the moment, however could this raised internally as a feature request?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issues compiling custom I2C driver</title><link>https://devzone.nordicsemi.com/thread/395596?ContentTypeID=1</link><pubDate>Mon, 14 Nov 2022 14:48:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5fdd2b56-24b5-485f-aa56-7efd4075bf71</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I tried this, and seems to work.&lt;/p&gt;
&lt;p&gt;First I download&amp;nbsp;&lt;a href="https://patch-diff.githubusercontent.com/raw/zephyrproject-rtos/zephyr/pull/48389.diff"&gt;https://patch-diff.githubusercontent.com/raw/zephyrproject-rtos/zephyr/pull/48389.diff&lt;/a&gt;&amp;nbsp;and placed it in&amp;nbsp;\v2.1.2\zephyr&lt;/p&gt;
&lt;p&gt;Then I apply the commit:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/2870.pastedimage1668437012475v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Then for instance opened the lis2dh example project and added the following to the overlay file:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;i2c0 {
&amp;#160; &amp;#160; mcp9600: mcp9600@67 {
&amp;#160; &amp;#160; &amp;#160; &amp;#160; compatible = &amp;quot;microchip,mcp9600&amp;quot;;
&amp;#160; &amp;#160; &amp;#160; &amp;#160; label = &amp;quot;MCP9600_I2C&amp;quot;;
&amp;#160; &amp;#160; &amp;#160; &amp;#160; reg = &amp;lt;0x67&amp;gt;;
&amp;#160; &amp;#160; &amp;#160; &amp;#160; status = &amp;quot;okay&amp;quot;;
&amp;#160; &amp;#160; &amp;#160; };
};&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;And in main.c I added microchip_mcp9600 similar to st_lis2dh:&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="text"&gt;void main(void)
{
	const struct device *sensor = DEVICE_DT_GET_ANY(st_lis2dh);

	if (sensor == NULL) {
		printf(&amp;quot;sensor No device found\n&amp;quot;);
		//return; // commented out to ensure the core run further.
	}
	if (!device_is_ready(sensor)) {
		printf(&amp;quot;sensorDevice %s is not ready\n&amp;quot;, sensor-&amp;gt;name);
		//return; // commented out to ensure the core run further.
	}

	const struct device *sensor2 = DEVICE_DT_GET_ANY(microchip_mcp9600);

	if (sensor2 == NULL) {
		printf(&amp;quot;sensor2 No device found\n&amp;quot;);
		return;
	}
	if (!device_is_ready(sensor2)) {
		printf(&amp;quot;sensor2 Device %s is not ready\n&amp;quot;, sensor2-&amp;gt;name);
		return;
	}&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Build and flash.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/0726.pastedimage1668437206211v2.png" alt=" " /&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;I don&amp;#39;t have any sensor connected, so I get the standard reply &amp;quot;is not ready&amp;quot;.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Best regards,&lt;br /&gt;Kenneth&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issues compiling custom I2C driver</title><link>https://devzone.nordicsemi.com/thread/395409?ContentTypeID=1</link><pubDate>Sat, 12 Nov 2022 01:44:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:52935481-21df-4832-b83a-b46b4201a5b4</guid><dc:creator>napei_</dc:creator><description>&lt;p&gt;I&amp;#39;m still stuck on this, wondering if there&amp;#39;s any internal samples that implement drivers like this?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issues compiling custom I2C driver</title><link>https://devzone.nordicsemi.com/thread/393639?ContentTypeID=1</link><pubDate>Wed, 02 Nov 2022 12:20:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f36c8648-9613-4628-8e17-ae69be7768e2</guid><dc:creator>napei_</dc:creator><description>&lt;p&gt;I&amp;#39;ve previously looked through these. I also followed along with a nordic person&amp;#39;s presentation on drivers in Zephyr as well (outside nrf SDK)&amp;nbsp;&lt;a href="https://www.youtube.com/watch?v=o-f2qCd2AXo"&gt;https://www.youtube.com/watch?v=o-f2qCd2AXo&lt;/a&gt;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Only other thing that I can see is some Zephyr-only guides place the board definition and the driver implementations outside the app/ folder where the nrf SDK code would usually be. I&amp;#39;m at a loss at the moment because it should &amp;quot;just work&amp;quot;.&lt;br /&gt;&lt;br /&gt;I can&amp;#39;t find (unless I&amp;#39;m just missing it) any samples in either nrf or zephyr that do per-application drivers like this.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issues compiling custom I2C driver</title><link>https://devzone.nordicsemi.com/thread/393633?ContentTypeID=1</link><pubDate>Wed, 02 Nov 2022 12:07:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:036be9c8-a848-45a6-978b-43d2e4762fd1</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Not entirely sure what you have forgotten here, but I suggest to take a look at these threads on some suggested links that you can look at for comparison:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/89759/making-a-device-driver-for-nrf52833-using-device-tree-for-spi-supported-device-that-is-not-available-in-zephyr-drivers-sensors"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/89759/making-a-device-driver-for-nrf52833-using-device-tree-for-spi-supported-device-that-is-not-available-in-zephyr-drivers-sensors&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/peripherals/posts/writing-device-drivers-for-uart-peripherals"&gt;https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/peripherals/posts/writing-device-drivers-for-uart-peripherals&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>