<?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>error: &amp;#39;NRF_DRV_TWI_INSTANCE_0&amp;#39; undeclared here</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/33621/error-nrf_drv_twi_instance_0-undeclared-here</link><description>I&amp;#39;m trying to enable TWI in the eddystone example based on this article but I get the following compilation error: 
 
 
 
 nrfx/legacy/nrf_drv_twi.h:120:37: error: &amp;#39;NRF_DRV_TWI_INSTANCE_0&amp;#39; undeclared here (not in a function) 
 main.c 
 
 sdk_config.h</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 22 Jan 2021 09:47:52 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/33621/error-nrf_drv_twi_instance_0-undeclared-here" /><item><title>RE: error: 'NRF_DRV_TWI_INSTANCE_0' undeclared here</title><link>https://devzone.nordicsemi.com/thread/290684?ContentTypeID=1</link><pubDate>Fri, 22 Jan 2021 09:47:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d193e298-ae9e-4a49-b64a-fdba1e7cc1a1</guid><dc:creator>usmanmehmood55</dc:creator><description>&lt;p&gt;Hi. I am having the exact same issue, but my config file has all these enabled&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define NRFX_TWIM_ENABLED 1
#define NRFX_TWI_ENABLED 1
#define TWI_ENABLED 1
#define TWI0_ENABLED 1
#define TWI0_USE_EASY_DMA 1&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;What could be the issue?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: error: 'NRF_DRV_TWI_INSTANCE_0' undeclared here</title><link>https://devzone.nordicsemi.com/thread/222877?ContentTypeID=1</link><pubDate>Sat, 30 Nov 2019 01:14:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8781d33-4bb1-4200-9b84-fa2f6eb55b87</guid><dc:creator>Garth@ESS</dc:creator><description>&lt;p&gt;I had this problem as well.&lt;/p&gt;
&lt;p&gt;I solved it by modifying sdk_config.h as follows (find these lines and update the values):&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define NRFX_TWIM_ENABLED 1
#define NRFX_TWI_ENABLED 1
#define TWI_ENABLED 1
#define TWI0_ENABLED 1
#define TWI0_USE_EASY_DMA 1&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;If you look in&amp;nbsp;SDK 15.2 ...\integration\nrfx\legacy\nrf_drv_twi.h, you will see the following around line 120.&amp;nbsp;In order for NRF_DRV_TWI_INSTANCE_0 to be defined, one of the&amp;nbsp;four #if statements must evaluate to true. In my case it should have been the first one, NRFX_TWIM0_ENABLED.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**
 * @brief Macro for creating a TWI master driver instance.
 */
#define NRF_DRV_TWI_INSTANCE(id)    NRF_DRV_TWI_INSTANCE_(id)
#define NRF_DRV_TWI_INSTANCE_(id)   NRF_DRV_TWI_INSTANCE_ ## id
#if NRFX_CHECK(NRFX_TWIM0_ENABLED)
    #define NRF_DRV_TWI_INSTANCE_0 \
        { 0, { .twim = NRFX_TWIM_INSTANCE(0) }, true }
#elif NRFX_CHECK(NRFX_TWI0_ENABLED)
    #define NRF_DRV_TWI_INSTANCE_0 \
        { 0, { .twi = NRFX_TWI_INSTANCE(0) }, false }
#endif
#if NRFX_CHECK(NRFX_TWIM1_ENABLED)
    #define NRF_DRV_TWI_INSTANCE_1 \
        { 1, { .twim = NRFX_TWIM_INSTANCE(1) }, true }
#elif NRFX_CHECK(NRFX_TWI1_ENABLED)
    #define NRF_DRV_TWI_INSTANCE_1 \
        { 1, { .twi = NRFX_TWI_INSTANCE(1) }, false }
#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I found the #define&amp;nbsp;NRFX_TWIM0_ENABLED&amp;nbsp;in&amp;nbsp;SDK 15.2 ...\integration\nrfx\legacy\apply_old_config.h&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define NRFX_TWIM0_ENABLED (TWI0_ENABLED &amp;amp;&amp;amp; TWI0_USE_EASY_DMA)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;So, I went into my sdk_config.h and updated those #defines with&amp;nbsp;non-zero values, and voila! Problem solved!&amp;nbsp;&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: error: 'NRF_DRV_TWI_INSTANCE_0' undeclared here</title><link>https://devzone.nordicsemi.com/thread/184006?ContentTypeID=1</link><pubDate>Fri, 26 Apr 2019 09:17:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26bec555-7210-419b-b989-66afb2cf98de</guid><dc:creator>nikhilesh</dc:creator><description>&lt;p&gt;Hey rolandvagyok,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Please let us know what is it you did with sdk_config.h to get it work :o&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: error: 'NRF_DRV_TWI_INSTANCE_0' undeclared here</title><link>https://devzone.nordicsemi.com/thread/158047?ContentTypeID=1</link><pubDate>Mon, 19 Nov 2018 16:33:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90663c66-e32b-48ae-94f0-c858f91f700e</guid><dc:creator>Rajneesh</dc:creator><description>&lt;p&gt;Hi Saral&lt;/p&gt;
&lt;p&gt;I also faced this issue when I move from SDK-11 to SDK-15. Please take a look on &lt;strong&gt;examples\peripheral\twi_sensor&lt;/strong&gt; example, main.c and sdk_config.h file it will help you a lot.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: error: 'NRF_DRV_TWI_INSTANCE_0' undeclared here</title><link>https://devzone.nordicsemi.com/thread/157238?ContentTypeID=1</link><pubDate>Wed, 14 Nov 2018 09:22:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:160a745e-de10-460c-a323-ef8007a367a7</guid><dc:creator>ps_anu</dc:creator><description>&lt;p&gt;hi....gos ... hope you can help me.. i couldn&amp;#39;t understand the above pic&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: error: 'NRF_DRV_TWI_INSTANCE_0' undeclared here</title><link>https://devzone.nordicsemi.com/thread/157236?ContentTypeID=1</link><pubDate>Wed, 14 Nov 2018 09:18:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40b32506-1d66-4be7-b244-7c720bcf73de</guid><dc:creator>ps_anu</dc:creator><description>&lt;p&gt;i am also having problem related TWI_INSTANCE_0 .. pls help me.. i have merged two examples uart and twi sensor in segger 15.2 version . it showing error like this what to do&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;see the pic below&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/0647.Capture-3.JPG" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: error: 'NRF_DRV_TWI_INSTANCE_0' undeclared here</title><link>https://devzone.nordicsemi.com/thread/147443?ContentTypeID=1</link><pubDate>Wed, 05 Sep 2018 20:19:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14a636ec-9b06-45d2-911f-f349188f87dc</guid><dc:creator>gos</dc:creator><description>&lt;p&gt;Fantastic! Solved my problem as well. Thanks for sharing!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: error: 'NRF_DRV_TWI_INSTANCE_0' undeclared here</title><link>https://devzone.nordicsemi.com/thread/130702?ContentTypeID=1</link><pubDate>Thu, 03 May 2018 03:17:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a665c04-2cb1-4a4d-9cab-5c8a4b28316d</guid><dc:creator>maiden</dc:creator><description>&lt;p&gt;I had the exact same problem, The cause was that NRFX_TWI_ENABLED was set but not TWI_ENABLED.&lt;/p&gt;
&lt;p&gt;See here:&lt;/p&gt;
&lt;p&gt;&lt;img alt="TWI config" src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/sdk_5F00_config_5F00_twi_5F00_scanner.png_2D00_320x240-_2800_1_2900_.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: error: 'NRF_DRV_TWI_INSTANCE_0' undeclared here</title><link>https://devzone.nordicsemi.com/thread/130027?ContentTypeID=1</link><pubDate>Thu, 26 Apr 2018 17:18:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:93f5c4f6-3140-481f-80bf-17829ed69031</guid><dc:creator>davidlr</dc:creator><description>&lt;p&gt;could you share the solution? Thanks! :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: error: 'NRF_DRV_TWI_INSTANCE_0' undeclared here</title><link>https://devzone.nordicsemi.com/thread/129326?ContentTypeID=1</link><pubDate>Mon, 23 Apr 2018 11:15:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f20e9d0-bcd3-4143-928c-32266e03e758</guid><dc:creator>rolandvagyok</dc:creator><description>&lt;p&gt;Solved the issue, it was with my sdk_config.h&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>