<?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>Including drivers in my project</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/85306/including-drivers-in-my-project</link><description>Development Kit: NRF52840 
 IDE: Segger Embedded Studios 
 
 I&amp;#39;m trying to use the nrf_drv_twi driver in my project. I&amp;#39;ve included the .c file in my nFR_Drivers folder. My base project is the uart_pca10056 example and I&amp;#39;m referencing the twi_sensor example</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 03 Mar 2022 10:21:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/85306/including-drivers-in-my-project" /><item><title>RE: Including drivers in my project</title><link>https://devzone.nordicsemi.com/thread/355990?ContentTypeID=1</link><pubDate>Thu, 03 Mar 2022 10:21:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4bceb4dd-bcb9-4f16-b238-69f0da09543d</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello again, Jason&lt;br /&gt;&lt;br /&gt;Thank you for providing this information, it is very helpful!&lt;br /&gt;&lt;br /&gt;I suspect that the issue now might stem from that you are using the legacy nrf_drv_* calls instead of the nrfx_* function calls, while only having enabled the NRFX drivers.&lt;br /&gt;The legacy drivers are now just forwarding macros to the nrfx implementation, but if their driver is not enabled then the forwarding will be missing as well.&lt;br /&gt;I recommend updating your project to use the nrfx driver calls directly.&lt;/p&gt;
[quote user="JasonPierpont"]&lt;p&gt;I tried adding these variations of the file path and still had the same error.&lt;/p&gt;
&lt;p&gt;../../../../../../ntegration/nrfx/legacy&lt;/p&gt;
&lt;p&gt;../../../../../../ntegration/nrfx/legacy/nrf_drv_twi&lt;/p&gt;
&lt;p&gt;../../../../../../ntegration/nrfx/legacy/nrf_drv_twi_h&lt;/p&gt;[/quote]
&lt;p&gt;These paths are misspelt - the folder is called &lt;em&gt;integration -&amp;nbsp;&lt;/em&gt;and also you will only need to point to the /modules/nrfx/drivers/include/ in order for it to find the nrfx_twi(m) header file.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote user="JasonPierpont"]I am not intentionally using TWI instead of TWIM. I am trying to communicate with a sensor via I2C and I read that TWI was the Nordic equivalent. Is TWIM better/easier to use than TWI?[/quote]
&lt;p&gt;The difference between the nrfx_twi and nrfx_twim peripheral is made to use easyDMA, which enabled you to perform and stage operations without direct involvement from the CPU. I would recommend that you use the nrfx_twim driver if you will be operating as a TWI Master on your nRF device.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Including drivers in my project</title><link>https://devzone.nordicsemi.com/thread/355902?ContentTypeID=1</link><pubDate>Wed, 02 Mar 2022 17:27:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:94eb8f26-dddb-402c-b7b7-ab2e3aa3424b</guid><dc:creator>JasonPierpont</dc:creator><description>&lt;p&gt;I meant to add this into my previous response.&lt;br /&gt;&lt;br /&gt;In nrf_drv_twi.h, this is the block of code where the error is appearing:&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1646241990003v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1646242005386v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Being caused by my call&amp;nbsp;&lt;br /&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1646242043563v3.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I hope this information is helpful.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Jason&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Including drivers in my project</title><link>https://devzone.nordicsemi.com/thread/355898?ContentTypeID=1</link><pubDate>Wed, 02 Mar 2022 17:11:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8988bfd4-d139-4945-b7e9-1127214df164</guid><dc:creator>JasonPierpont</dc:creator><description>&lt;p&gt;Hi Karl,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here are the contents of my User Include Directories from the Project Options.&lt;/p&gt;
&lt;p&gt;../../../config&lt;/p&gt;
&lt;p&gt;../../../../../../components&lt;/p&gt;
&lt;p&gt;../../../../../../components/boards&lt;/p&gt;
&lt;p&gt;../../../../../../components/drivers_nrf/nrf_soc_nosd&lt;/p&gt;
&lt;p&gt;../../../../../../components/libraries/atomic&lt;/p&gt;
&lt;p&gt;../../../../../../components/libraries/balloc&lt;/p&gt;
&lt;p&gt;../../../../../../components/libraries/bsp&lt;/p&gt;
&lt;p&gt;../../../../../../components/libraries/delay&lt;/p&gt;
&lt;p&gt;../../../../../../components/libraries/experimental_section_vars&lt;/p&gt;
&lt;p&gt;../../../../../../components/libraries/fifo&lt;/p&gt;
&lt;p&gt;../../../../../../components/libraries/log&lt;/p&gt;
&lt;p&gt;../../../../../../components/libraries/log/src&lt;/p&gt;
&lt;p&gt;../../../../../../components/libraries/memobj&lt;/p&gt;
&lt;p&gt;../../../../../../components/libraries/ringbuf&lt;/p&gt;
&lt;p&gt;../../../../../../components/libraries/strerror&lt;/p&gt;
&lt;p&gt;../../../../../../components/libraries/uart&lt;/p&gt;
&lt;p&gt;../../../../../../components/libraries/util&lt;/p&gt;
&lt;p&gt;../../../../../../components/toolchain/cmsis/include&lt;/p&gt;
&lt;p&gt;../../..&lt;/p&gt;
&lt;p&gt;../../../../../../external/fprintf&lt;/p&gt;
&lt;p&gt;../../../../../../integration/nrfx&lt;/p&gt;
&lt;p&gt;../../../../../../integration/nrfx/legacy&lt;/p&gt;
&lt;p&gt;../../../../../../modules/nrfx&lt;/p&gt;
&lt;p&gt;../../../../../../modules/nrfx/drivers/include&lt;/p&gt;
&lt;p&gt;../../../../../../modules/nrfx/hal&lt;/p&gt;
&lt;p&gt;../../../../../../modules/nrfx/mdk&lt;/p&gt;
&lt;p&gt;../config&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I tried adding these variations of the file path and still had the same error.&lt;/p&gt;
&lt;p&gt;../../../../../../ntegration/nrfx/legacy&lt;/p&gt;
&lt;p&gt;../../../../../../ntegration/nrfx/legacy/nrf_drv_twi&lt;/p&gt;
&lt;p&gt;../../../../../../ntegration/nrfx/legacy/nrf_drv_twi_h&lt;/p&gt;
&lt;p&gt;I am not intentionally using TWI instead of TWIM. I am trying to communicate with a sensor via I2C and I read that TWI was the Nordic equivalent. Is TWIM better/easier to use than TWI?&lt;br /&gt;&lt;br /&gt;I am using the TWI0 instance. I am trying to define it like this:&lt;/p&gt;
&lt;p&gt;#define TWI_INSTANCE_ID 0&lt;/p&gt;
&lt;p&gt;static const nrf_drv_twi_t m_twi = NRF_DRV_TWI_INSTANCE(TWI_INSTANCE_ID);&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Jason&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Including drivers in my project</title><link>https://devzone.nordicsemi.com/thread/355896?ContentTypeID=1</link><pubDate>Wed, 02 Mar 2022 16:56:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:912ff4f9-0f7a-4dcf-8b7d-447942abe3c8</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello again, Jason&lt;br /&gt;&lt;br /&gt;You will need to go to the project options (right click on the project title in the project navigator), not to the options of the particular I2CHandler.c file which you are currently looking in.&lt;/p&gt;
[quote user="JasonPierpont"]I&amp;#39;ve updated my sdk_config.h with the NRFX_TWI_ENABLED defines.[/quote]
&lt;p&gt;Great! This looks correct, so now we just need to make sure that the user included paths match up.&lt;br /&gt;Are you intentionally using the TWI peripheral, or do you intend to use it with easyDMA (TWIM)?&lt;br /&gt;Just for good measure, could you confirm that you are using the TWI0 instance in your application as well?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Including drivers in my project</title><link>https://devzone.nordicsemi.com/thread/355872?ContentTypeID=1</link><pubDate>Wed, 02 Mar 2022 15:18:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c76eea30-b1b1-4450-8fb1-fbfbb87a5c16</guid><dc:creator>JasonPierpont</dc:creator><description>&lt;p&gt;I&amp;#39;ve updated my sdk_config.h with the NRFX_TWI_ENABLED defines. (Error is still occurring)&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/4617.sdk_5F00_config.h"&gt;devzone.nordicsemi.com/.../4617.sdk_5F00_config.h&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I was looking at the Common Configuration. I&amp;#39;ll attach a screenshot of what I see.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/commonconfig.png" /&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Jason&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Including drivers in my project</title><link>https://devzone.nordicsemi.com/thread/355866?ContentTypeID=1</link><pubDate>Wed, 02 Mar 2022 15:08:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c93e329-3be4-41dc-a643-ae3f5915cfe9</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello Jason,&lt;/p&gt;
[quote user="JasonPierpont"]My User Include Directory is set to &amp;quot;Inherits&amp;quot; and when I click the [...] to Set User Include Directories, a text editor appears with only a single &amp;quot;.&amp;quot; in it. What is the syntax for adding directories?[/quote]
&lt;p&gt;This likely means that you are looking for the project options for the&amp;nbsp;&lt;em&gt;release&amp;nbsp;&lt;/em&gt;or&amp;nbsp;&lt;em&gt;debug&amp;nbsp;&lt;/em&gt;configuration. You should be looking at the&amp;nbsp;&lt;em&gt;common&amp;nbsp;&lt;/em&gt;configuration since this applies to both of the two others.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote user="JasonPierpont"]I will also attach my sdk_config.h. It currently does not have any defines for NRFX_TWI_ENABLED. Am I able to type these in manually? I&amp;#39;ve noticed the others seem to be auto generated.[/quote]
&lt;p&gt;Yes, you may add these yourself. I recommend going into the twi example you are trying to merge, and get the required sdk_config.h configurations from there. I also recommend that you only include the nrfx_twim configuration into your project, since as mentioned if the legacy TWI_ENABLED is&amp;nbsp;&lt;em&gt;defined&amp;nbsp;&lt;/em&gt;in sdk_config.h it will overwrite your nrfx_twi configuration.&lt;br /&gt;Please also make sure to enable the specific TWIM instance you intend on using in the sdk_config.h along with enabling the peripheral as a whole with the NRFX_TWIM_ENABLED define.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Including drivers in my project</title><link>https://devzone.nordicsemi.com/thread/355860?ContentTypeID=1</link><pubDate>Wed, 02 Mar 2022 14:49:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e5c69ce2-2b2b-4105-9635-4f80bd31b10a</guid><dc:creator>JasonPierpont</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;My User Include Directory is set to &amp;quot;Inherits&amp;quot; and when I click the [...] to Set User Include Directories, a text editor appears with only a single &amp;quot;.&amp;quot; in it. What is the syntax for adding directories? Do I need to add &amp;quot;nrf_drv_twi.h&amp;quot; to this?&lt;/p&gt;
&lt;p&gt;I will attach a screenshot of the nRF_Drivers folder in my Project Navigator to show which source files I have.&lt;/p&gt;
&lt;p&gt;I will also attach my sdk_config.h. It currently does not have any defines for NRFX_TWI_ENABLED. Am I able to type these in manually? I&amp;#39;ve noticed the others seem to be auto generated.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Jason&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/8424.sdk_5F00_config.h"&gt;devzone.nordicsemi.com/.../8424.sdk_5F00_config.h&lt;/a&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/projectNavDrivers.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Including drivers in my project</title><link>https://devzone.nordicsemi.com/thread/355752?ContentTypeID=1</link><pubDate>Wed, 02 Mar 2022 09:44:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f8791645-f345-4948-8084-213350155909</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;Could you confirm that you have added the path to the header file into your&amp;nbsp;&lt;em&gt;Project Options -&amp;gt; Common Configuration -&amp;gt; Preprocessor -&amp;gt; User Included Directories&lt;/em&gt;? Please also confirm that you have added the required source files to your project navigator.&lt;/p&gt;
[quote user=""]&lt;p&gt;I&amp;#39;ve read some discussions that I need to enable something in the sdk_config.h file but when I go to do that, I notice the file does not contain the nrf_drv_twi defines to do so.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve tried copying the defines from the twi_sensor example into my sdk_config.h and that still does not solve the problem.&lt;/p&gt;[/quote]
&lt;p&gt;Yes, you will need to add the NRFX_TWI_ENABLED define to your sdk_config, and remove the TWI_ENABLED define.&lt;br /&gt;If the TWI_ENABLED define is present it will overwrite your nrfx_twi defines.&lt;br /&gt;&lt;br /&gt;You will also need to enable the specific TWI instance you intend to use.&lt;br /&gt;Could you share your sdk_config with me so that I may take a look?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>