<?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>Adding twi support to ble_app_hrs_freertos</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/32766/adding-twi-support-to-ble_app_hrs_freertos</link><description>Hi, 
 
 I read so many articles but just can&amp;#39;t find the correct way to add twi support to the ble_app_hrs_feertos app in the latest SDK15. 
 This what did: 
 - Copied 3 lines from twi_sensor example that define nrf_drv_twi_t object just before my main</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 24 Feb 2019 11:37:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/32766/adding-twi-support-to-ble_app_hrs_freertos" /><item><title>RE: Adding twi support to ble_app_hrs_freertos</title><link>https://devzone.nordicsemi.com/thread/172642?ContentTypeID=1</link><pubDate>Sun, 24 Feb 2019 11:37:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cdc5dd1e-c96e-41a5-bda6-761ac07b0aff</guid><dc:creator>Adib</dc:creator><description>&lt;p&gt;I think there is an error in this file apply_old_config.h&lt;/p&gt;
&lt;p&gt;it is:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#if defined(TWI_ENABLED)

#undef NRFX_TWI_ENABLED
#define NRFX_TWI_ENABLED   (TWI_ENABLED &amp;amp;&amp;amp; (NRFX_TWI0_ENABLED  || NRFX_TWI1_ENABLED))
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;but in sdk_config.h is&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define TWI_ENABLED 0&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;which actually DEFINES but does not ENABLES the preprocessor defines TWI_ENABLED&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Correct should be:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#if TWI_ENABLED

#undef NRFX_TWI_ENABLED
#define NRFX_TWI_ENABLED   (TWI_ENABLED &amp;amp;&amp;amp; (NRFX_TWI0_ENABLED  || NRFX_TWI1_ENABLED))
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And so there comes this misunderstanding. ....&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I hope this will be fixed.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards, Adib.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding twi support to ble_app_hrs_freertos</title><link>https://devzone.nordicsemi.com/thread/126503?ContentTypeID=1</link><pubDate>Mon, 02 Apr 2018 03:44:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6d84780-8999-4880-8761-7bdb61b47280</guid><dc:creator>T&amp;#250;lio</dc:creator><description>&lt;p&gt;Problem solved!&lt;/p&gt;
&lt;p&gt;Hello, eyalasko, I had the same problem, and I did exactly what you did.&lt;br /&gt;I followed the &lt;span&gt;NRFX_TWI0_ENABLED of the line&amp;nbsp;&lt;/span&gt;#if NRFX_CHECK(NRFX_TWI0_ENABLED)&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/NordicFollow.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;and it got me to this kind of transition file name &lt;strong&gt;apply_old_config.h&amp;nbsp;&lt;/strong&gt;and at this file NRFX_TWI0_ENABLED and NRFX_TWI_ENABLED appear as a combination of TWI0_ENABLED and TWI_ENABLED and so on, as you can see in the image below.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1522640487446v1.png" alt=" " /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;So I basically did the same sdk_config.h as you and also enabled &lt;strong&gt;TWI0_ENABLED and TWI_ENABLED&amp;nbsp;&lt;/strong&gt; and it worked like that!&lt;/p&gt;
&lt;p&gt;Hope it also solves your issue ;) !&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding twi support to ble_app_hrs_freertos</title><link>https://devzone.nordicsemi.com/thread/126075?ContentTypeID=1</link><pubDate>Tue, 27 Mar 2018 09:26:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d90657b-578f-40e4-86c1-e7a7230d7311</guid><dc:creator>eyalasko</dc:creator><description>&lt;p&gt;In SDK14.2 it works fine !&lt;/p&gt;
&lt;p&gt;- Included&amp;nbsp;&amp;nbsp;#include &amp;quot;nrf_drv_twi.h&amp;quot;&lt;/p&gt;
&lt;p&gt;- added nrf_drv_twi.c from &amp;lt;SDK142 folder&amp;gt;\components\drivers_nrf\twi_master to nRF_Drivers group&lt;/p&gt;
&lt;p&gt;- In sdk_config.h enabled TWI_ENABLE &amp;amp; TWI0_ENABLED&lt;/p&gt;
&lt;p&gt;- Add twi init code&lt;/p&gt;
&lt;p&gt;Voilla, compiles without errors&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding twi support to ble_app_hrs_freertos</title><link>https://devzone.nordicsemi.com/thread/126069?ContentTypeID=1</link><pubDate>Tue, 27 Mar 2018 08:58:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b601f71-3375-4a55-afd1-2b9e743c49cd</guid><dc:creator>eyalasko</dc:creator><description>&lt;p&gt;Hi Nordic,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I did some further research and need your assistance in figuring out this Mystery ....&lt;/p&gt;
&lt;p&gt;recap - I&amp;#39;m trying to implement twi support on freertos ble project (SDK15.0) the following way -&lt;/p&gt;
&lt;p&gt;- My target project is a copy of ble_app_hrs_freertos folder&lt;/p&gt;
&lt;p&gt;- My reference project is twi_sensor&lt;/p&gt;
&lt;p&gt;- Added nrfx_twi.c &amp;amp; nrfx_twim.c to the nRF_Drivers group of the target project (imported from &amp;lt;SDK_folder&amp;gt;\modules\nrfx\drivers\src as in the reference project)&lt;/p&gt;
&lt;p&gt;- Included the following at the beginning of main.c:&lt;/p&gt;
&lt;p&gt;#include &amp;lt;nrfx.h&amp;gt;&lt;/p&gt;
&lt;p&gt;#include &amp;quot;sdk_config.h&amp;quot;&lt;/p&gt;
&lt;p&gt;#include &amp;quot;nrf_drv_twi.h&amp;quot;&lt;/p&gt;
&lt;p&gt;- In sdk_config.h I&amp;#39;ve enabled NRFX_TWI_ENABLED &amp;amp; NRFX_TWIM_ENABLED and their immediate child NRFX_TWI0_ENABLED &amp;amp; ERFX_TWIM0_ENABLED&lt;/p&gt;
&lt;p&gt;- in my main.c just before main() I&amp;#39;ve copied two lines from the reference project:&lt;/p&gt;
&lt;p&gt;/* TWI instance ID. */ &lt;br /&gt;#define TWI_INSTANCE_ID 0 &lt;br /&gt;/* TWI instance. */ &lt;br /&gt;static const nrf_drv_twi_t m_twi = NRF_DRV_TWI_INSTANCE(TWI_INSTANCE_ID)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Mysteriously I keep getting &amp;quot;NRF_DRV_TWI_INSTANCE_0 undefined&amp;quot; error and noticed that although I&amp;#39;ve enabled TWI &amp;amp; TWIM in sdk_config.h they remained undef&amp;#39;d when looking in nrfx_twi.c &amp;amp; nrfx_twim.c (code grayed out). See screen capture&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/1040x1200/__key/communityserver-discussions-components-files/4/2018_2D00_03_2D00_27-11_5F00_48_5F00_37_2D00_.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " height="906" src="https://devzone.nordicsemi.com/resized-image/__size/900x1200/__key/communityserver-discussions-components-files/4/2018_2D00_03_2D00_27-11_5F00_52_5F00_07_2D00_C_5F005F00_DevTools_5F00_Nordic_5F00_nRF5_5F00_SDK_5F00_15.0.0_5F00_a53641a_5F00_nRF5_5F00_SDK_5F00_15.0.0_5F00_a53641a_5F00_examples_5F00_ble_5F00_.png" width="659" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;What make it even stranger is that in the reference project, again, both NRF_TWI_ENABLED &amp;amp; NRF_TWIM_ENABLED are set to 1 in sdk_config.h, but this time nrfx_twim.c become enabled while nerfx_twi.c remains grayed out...&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/1040x1200/__key/communityserver-discussions-components-files/4/2018_2D00_03_2D00_27-12_5F00_04_5F00_16_2D00_.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I tried to follow the definition route and everything looks OK so I&amp;#39;m pretty lost here......&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks in advance for any support&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>