<?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>How to use NRF51 DK I2C(TWI) with SDK 12.2 with Keil MDK?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/21042/how-to-use-nrf51-dk-i2c-twi-with-sdk-12-2-with-keil-mdk</link><description>I need to connect VL53Xl to NRF51 DK&amp;gt; I am using latest 12.2 SDK with Keil MDK.I cannot find any I2C(TWI) example. I can find examples for NRF52 based devices. but not for NRF51. 
 I tried using Hal functions but ended up with missing definitions which</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 05 Apr 2017 13:27:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/21042/how-to-use-nrf51-dk-i2c-twi-with-sdk-12-2-with-keil-mdk" /><item><title>RE: How to use NRF51 DK I2C(TWI) with SDK 12.2 with Keil MDK?</title><link>https://devzone.nordicsemi.com/thread/82207?ContentTypeID=1</link><pubDate>Wed, 05 Apr 2017 13:27:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2025af5c-f08a-4880-8ab1-dfcad99fed90</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Happy to help :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use NRF51 DK I2C(TWI) with SDK 12.2 with Keil MDK?</title><link>https://devzone.nordicsemi.com/thread/82206?ContentTypeID=1</link><pubDate>Wed, 05 Apr 2017 13:23:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:189e93b9-777a-44f0-9bb2-4a99d25eb2f9</guid><dc:creator>fenogy</dc:creator><description>&lt;p&gt;@Bjorn Thanks, I removed existing TWI section from ble_app_uart sdk_config.h and pasted the same from twi_sensor sdk_config and its compile now. Thank you very much. saved hours.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use NRF51 DK I2C(TWI) with SDK 12.2 with Keil MDK?</title><link>https://devzone.nordicsemi.com/thread/82205?ContentTypeID=1</link><pubDate>Wed, 05 Apr 2017 06:26:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6412d120-b372-4a15-9eb3-2ee1e3636a3d</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Did you change the&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#ifndef TWI1_ENABLED
#define TWI1_ENABLED 0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;to&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#ifndef TWI1_ENABLED
#define TWI1_ENABLED 1 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;in the ble_app_uart sdk_config.h file?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use NRF51 DK I2C(TWI) with SDK 12.2 with Keil MDK?</title><link>https://devzone.nordicsemi.com/thread/82204?ContentTypeID=1</link><pubDate>Wed, 05 Apr 2017 06:15:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:96c7ff05-62cc-4514-ae0d-33f1501862d0</guid><dc:creator>fenogy</dc:creator><description>&lt;p&gt;@Bjorn Thanks for the reply. I tested sdk_config.h earlier and ble_app_uart sdk_config.h had the TWI_ENABLED section already. I tested functionality of sdk_config.h by using some #warning and it was observed the TWI ENABLED section is not got executed for some weird reason. I removed definitions check points by directly defining them as below and now compilation is ok. This is bad but I cant find any other issue.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;// &amp;lt;e&amp;gt; TWI_ENABLED - nrf_drv_twi - TWI/TWIM peripheral driver
//==========================================================
#ifndef TWI_ENABLED
#define TWI_ENABLED 0
#endif

//#if  TWI_ENABLED
// &amp;lt;o&amp;gt; TWI_DEFAULT_CONFIG_FREQUENCY  - Frequency
 
// &amp;lt;26738688=&amp;gt; 100k 
// &amp;lt;67108864=&amp;gt; 250k 
// &amp;lt;104857600=&amp;gt; 400k 

#ifndef TWI_DEFAULT_CONFIG_FREQUENCY
#define TWI_DEFAULT_CONFIG_FREQUENCY 26738688
#endif

// &amp;lt;q&amp;gt; TWI_DEFAULT_CONFIG_CLR_BUS_INIT  - Enables bus clearing procedure during init
 

#ifndef TWI_DEFAULT_CONFIG_CLR_BUS_INIT
#define TWI_DEFAULT_CONFIG_CLR_BUS_INIT 0
#endif

// &amp;lt;q&amp;gt; TWI_DEFAULT_CONFIG_HOLD_BUS_UNINIT  - Enables bus holding after uninit
 

#ifndef TWI_DEFAULT_CONFIG_HOLD_BUS_UNINIT
#define TWI_DEFAULT_CONFIG_HOLD_BUS_UNINIT 0
#endif

// &amp;lt;o&amp;gt; TWI_DEFAULT_CONFIG_IRQ_PRIORITY  - Interrupt priority
 

// &amp;lt;i&amp;gt; Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice
// &amp;lt;0=&amp;gt; 0 (highest) 
// &amp;lt;1=&amp;gt; 1 
// &amp;lt;2=&amp;gt; 2 
// &amp;lt;3=&amp;gt; 3 

#ifndef TWI_DEFAULT_CONFIG_IRQ_PRIORITY
#define TWI_DEFAULT_CONFIG_IRQ_PRIORITY 3
#endif

// &amp;lt;e&amp;gt; TWI0_ENABLED - Enable TWI0 instance
//==========================================================
#ifndef TWI0_ENABLED
#define TWI0_ENABLED 0
 
#endif
//#if  TWI0_ENABLED
// &amp;lt;q&amp;gt; TWI0_USE_EASY_DMA  - Use EasyDMA (if present)


#ifndef TWI0_USE_EASY_DMA
#define TWI0_USE_EASY_DMA 0

#endif

//#endif //TWI0_ENABLED
// &amp;lt;/e&amp;gt;

// &amp;lt;e&amp;gt; TWI1_ENABLED - Enable TWI1 instance
//==========================================================
#ifndef TWI1_ENABLED
#define TWI1_ENABLED 0
#endif
#if  TWI1_ENABLED
// &amp;lt;q&amp;gt; TWI1_USE_EASY_DMA  - Use EasyDMA (if present)
 

#ifndef TWI1_USE_EASY_DMA
#define TWI1_USE_EASY_DMA 0
#endif

#endif //TWI1_ENABLED
// &amp;lt;/e&amp;gt;

// &amp;lt;e&amp;gt; TWI_CONFIG_LOG_ENABLED - Enables logging in the module.
//==========================================================
#ifndef TWI_CONFIG_LOG_ENABLED
#define TWI_CONFIG_LOG_ENABLED 0
#endif
#if  TWI_CONFIG_LOG_ENABLED
// &amp;lt;o&amp;gt; TWI_CONFIG_LOG_LEVEL  - Default Severity level
 
// &amp;lt;0=&amp;gt; Off 
// &amp;lt;1=&amp;gt; Error 
// &amp;lt;2=&amp;gt; Warning 
// &amp;lt;3=&amp;gt; Info 
// &amp;lt;4=&amp;gt; Debug 

#ifndef TWI_CONFIG_LOG_LEVEL
#define TWI_CONFIG_LOG_LEVEL 3
#endif

// &amp;lt;o&amp;gt; TWI_CONFIG_INFO_COLOR  - ANSI escape code prefix.
 
// &amp;lt;0=&amp;gt; Default 
// &amp;lt;1=&amp;gt; Black 
// &amp;lt;2=&amp;gt; Red 
// &amp;lt;3=&amp;gt; Green 
// &amp;lt;4=&amp;gt; Yellow 
// &amp;lt;5=&amp;gt; Blue 
// &amp;lt;6=&amp;gt; Magenta 
// &amp;lt;7=&amp;gt; Cyan 
// &amp;lt;8=&amp;gt; White 

#ifndef TWI_CONFIG_INFO_COLOR
#define TWI_CONFIG_INFO_COLOR 0
#endif

// &amp;lt;o&amp;gt; TWI_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
 
// &amp;lt;0=&amp;gt; Default 
// &amp;lt;1=&amp;gt; Black 
// &amp;lt;2=&amp;gt; Red 
// &amp;lt;3=&amp;gt; Green 
// &amp;lt;4=&amp;gt; Yellow 
// &amp;lt;5=&amp;gt; Blue 
// &amp;lt;6=&amp;gt; Magenta 
// &amp;lt;7=&amp;gt; Cyan 
// &amp;lt;8=&amp;gt; White 

#ifndef TWI_CONFIG_DEBUG_COLOR
#define TWI_CONFIG_DEBUG_COLOR 0
#endif

#endif //TWI_CONFIG_LOG_ENABLED
// &amp;lt;/e&amp;gt;

//#endif //TWI_ENABLED
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use NRF51 DK I2C(TWI) with SDK 12.2 with Keil MDK?</title><link>https://devzone.nordicsemi.com/thread/82203?ContentTypeID=1</link><pubDate>Tue, 04 Apr 2017 12:16:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:405c27ae-9877-4fa2-b0e7-e95ade5f3174</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;&lt;code&gt;TWI0_USE_EASY_DMA&lt;/code&gt; is defined in the &lt;code&gt;sdk_config.h&lt;/code&gt; file in the twi_sensor example, but not in the &lt;code&gt;sdk_config.h&lt;/code&gt;file of the ble_app_uart example. You will have to copy the TWI_ENABLED section starting from line 74 to 208 into the &lt;code&gt;sdk_config.h&lt;/code&gt; file of the ble_app_uart example.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use NRF51 DK I2C(TWI) with SDK 12.2 with Keil MDK?</title><link>https://devzone.nordicsemi.com/thread/82202?ContentTypeID=1</link><pubDate>Tue, 04 Apr 2017 04:20:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:62e2717a-aac4-4737-a5cc-1248db3a0876</guid><dc:creator>fenogy</dc:creator><description>&lt;p&gt;@Bjorn, after I declare &lt;strong&gt;nrf_drv_twi_t twi_instance = NRF_DRV_TWI_INSTANCE(0);&lt;/strong&gt; on &lt;strong&gt;main.c&lt;/strong&gt; the following error appeared.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;..\..\..\main.c(92): error:  #20: identifier &amp;quot;TWI0_USE_EASY_DMA&amp;quot; is undefined
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then I added &lt;strong&gt;nrf_drv_twi_dox_config.h&lt;/strong&gt; and then the below error comes&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;..\..\..\..\..\..\components\drivers_nrf\twi_master\nrf_drv_twi_dox_config.h(13): warning:  #47-D: incompatible redefinition of macro &amp;quot;TWI_ENABLED&amp;quot; (declared at line 2530 of &amp;quot;..\config\sdk_config.h&amp;quot;)
  #define TWI_ENABLED
..\..\..\main.c(92): error:  #29: expected an expression
  nrf_drv_twi_t twi_instance = 
RF_DRV_TWI_INSTANCE(0);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Do you have any idea. Pls help. I can compile peripheral example separately. I wonder why this happen.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use NRF51 DK I2C(TWI) with SDK 12.2 with Keil MDK?</title><link>https://devzone.nordicsemi.com/thread/82201?ContentTypeID=1</link><pubDate>Mon, 03 Apr 2017 13:17:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc29efed-e90f-4ba9-ad6d-91ba8623eff7</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;@fenogy: Have you added all the necessary .c files to the ble_app_uart project and added the correct include paths? If you get any compile errors, then please post them here so that we can help you figure out which files that are missing.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use NRF51 DK I2C(TWI) with SDK 12.2 with Keil MDK?</title><link>https://devzone.nordicsemi.com/thread/82200?ContentTypeID=1</link><pubDate>Sun, 02 Apr 2017 16:24:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f18d1ba6-2d23-40be-bd54-98ed83ee4444</guid><dc:creator>fenogy</dc:creator><description>&lt;p&gt;@Daniel, The TWI examples in peripheral folder works (twi_sensor_pca10028). but when the same code with same headers would not compile with (ble_app_uart_pca10028_s130) project. Is there anything specific here to soft-devices or sdk configuration to consider. Sorry I didnt went through all documentation. apperciate help for quick catch up.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use NRF51 DK I2C(TWI) with SDK 12.2 with Keil MDK?</title><link>https://devzone.nordicsemi.com/thread/82199?ContentTypeID=1</link><pubDate>Sun, 02 Apr 2017 15:26:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:13418a6a-b894-4253-a5b7-a28b3398b7ae</guid><dc:creator>fenogy</dc:creator><description>&lt;p&gt;Hi Daniel.thanks for reply. I will try that as well. I was finally stuck due to missing  definition for NRF_TWIM_Type. I tried it does not defined in nrf51.h file. I am thinking of writing from scratch. But I will try examples with app_twi as well.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use NRF51 DK I2C(TWI) with SDK 12.2 with Keil MDK?</title><link>https://devzone.nordicsemi.com/thread/82198?ContentTypeID=1</link><pubDate>Sun, 02 Apr 2017 12:21:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3983bbfe-207a-4434-9686-0c30f7e71fe6</guid><dc:creator>Daniel Wang</dc:creator><description>&lt;p&gt;You can find the examples in the SDK folder: \examples\peripheral\&lt;/p&gt;
&lt;p&gt;What missing definitions are you getting?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>