<?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>Can we connect two I2C(TWI) masters at same time to nrf52?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/23350/can-we-connect-two-i2c-twi-masters-at-same-time-to-nrf52</link><description>I am specific about master as I have to connect two simultaneously(obviously to two different pins pair). Plz provide any code outline if you have, Thank you in Advance</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 11 Jul 2017 14:29:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/23350/can-we-connect-two-i2c-twi-masters-at-same-time-to-nrf52" /><item><title>RE: Can we connect two I2C(TWI) masters at same time to nrf52?</title><link>https://devzone.nordicsemi.com/thread/91790?ContentTypeID=1</link><pubDate>Tue, 11 Jul 2017 14:29:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dca842b4-8c9d-4426-a2fe-4fd1a2be6eac</guid><dc:creator>vishal</dc:creator><description>&lt;p&gt;thank you so much Jorgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can we connect two I2C(TWI) masters at same time to nrf52?</title><link>https://devzone.nordicsemi.com/thread/91789?ContentTypeID=1</link><pubDate>Tue, 11 Jul 2017 09:00:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05d0e5d9-f30e-4f2d-80e4-4ac51319e2bb</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Given that you use SDK version 12.0.0 or higher, the following twi_init should work:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/* TWI PIN numbers. */
#define SCL_PIN_1			  26
#define SDA_PIN_1			  27
#define SCL_PIN_2			  28
#define SDA_PIN_2			  29

/* TWI instance ID. */
#define TWI_INSTANCE_ID_1     0
#define TWI_INSTANCE_ID_2     1

/* TWI instance. */
static const nrf_drv_twi_t m_twi_1 = NRF_DRV_TWI_INSTANCE(TWI_INSTANCE_ID_1);
static const nrf_drv_twi_t m_twi_1 = NRF_DRV_TWI_INSTANCE(TWI_INSTANCE_ID_2);

/**
 * @brief TWI initialization.
 */
void twi_init (void)
{
    ret_code_t err_code;

    const nrf_drv_twi_config_t twi_1_config = {
       .scl                = SCL_PIN_1,
       .sda                = SDA_PIN_1,
       .frequency          = NRF_TWI_FREQ_100K,
       .interrupt_priority = APP_IRQ_PRIORITY_HIGH,
       .clear_bus_init     = false
    };
	
	const nrf_drv_twi_config_t twi_2_config = {
       .scl                = SCL_PIN_2,
       .sda                = SDA_PIN_2,
       .frequency          = NRF_TWI_FREQ_100K,
       .interrupt_priority = APP_IRQ_PRIORITY_HIGH,
       .clear_bus_init     = false
    };

    err_code = nrf_drv_twi_init(&amp;amp;m_twi_1, &amp;amp;twi_1_config, twi_handler_1, NULL);
    APP_ERROR_CHECK(err_code);

    err_code = nrf_drv_twi_init(&amp;amp;m_twi_2, &amp;amp;twi_2_config, twi_handler_2, NULL);
    APP_ERROR_CHECK(err_code);

    nrf_drv_twi_enable(&amp;amp;m_twi_1);
    nrf_drv_twi_enable(&amp;amp;m_twi_2);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Note that you need to enable two TWI interfaces in &lt;em&gt;sdk_config.h&lt;/em&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define TWI0_ENABLED 1
#define TWI1_ENABLED 1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can we connect two I2C(TWI) masters at same time to nrf52?</title><link>https://devzone.nordicsemi.com/thread/91788?ContentTypeID=1</link><pubDate>Mon, 10 Jul 2017 16:10:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ac1123e-d08e-4d03-9efe-4d8cd41e7923</guid><dc:creator>vishal</dc:creator><description>&lt;p&gt;I want them(two i2c masters) to work simultaneously. As I need a higher data transfer rate&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can we connect two I2C(TWI) masters at same time to nrf52?</title><link>https://devzone.nordicsemi.com/thread/91787?ContentTypeID=1</link><pubDate>Mon, 10 Jul 2017 07:39:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c03b635-7f6a-4332-adf8-25c383fe71ac</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Why do you need to connect the devices to different pin pairs? The TWI bus can interface multiple devices using addresses.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>