<?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>i2cDevlib port to nRF52 SDK15</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/74493/i2cdevlib-port-to-nrf52-sdk15</link><description>Hi. 
 I&amp;#39;m trying to make the i2cDevlib work on an nRF52 DK board. 
 There are several ports of the same to nRF51, and one to nRF25 but on the old SDK11. 
 I&amp;#39;m using SDK15 and cannot shift rest of my application to SDK11. 
 The closest I&amp;#39;ve gotten is this</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 28 Apr 2021 10:03:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/74493/i2cdevlib-port-to-nrf52-sdk15" /><item><title>RE: i2cDevlib port to nRF52 SDK15</title><link>https://devzone.nordicsemi.com/thread/307194?ContentTypeID=1</link><pubDate>Wed, 28 Apr 2021 10:03:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:15a4ce81-6e1e-4b9a-a5f8-5be70227ae83</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;What, exactly, is &amp;quot;not working&amp;quot; ?&lt;/p&gt;
&lt;p&gt;Have you looked at the SDK examples?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: i2cDevlib port to nRF52 SDK15</title><link>https://devzone.nordicsemi.com/thread/307141?ContentTypeID=1</link><pubDate>Wed, 28 Apr 2021 06:42:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f00ec804-2422-40c8-ae1a-ae55998947c9</guid><dc:creator>usmanmehmood55</dc:creator><description>&lt;p&gt;Hi Awneil.&lt;/p&gt;
&lt;p&gt;I cannot use the Arduino framework, I have to stick to the baremetal C for my app.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The issue starts when the TWI is initialized. On the top, my old (working) code and the i2cDevlib (not working) code seem very alike. I even swapped the working initialization code with the non working one, but that doesn&amp;#39;t work either.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Working code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static const nrf_drv_twi_t twi_instance = NRF_DRV_TWI_INSTANCE(TWI_INSTANCE_ID);
void twi_init(void)
{
    ret_code_t err_code;

    const nrf_drv_twi_config_t twi_config = {
        .scl = TWI_SCL_PIN,
        .sda = TWI_SDA_PIN,
        .frequency = NRF_DRV_TWI_FREQ_400K,
        .interrupt_priority = APP_IRQ_PRIORITY_LOW,
        .clear_bus_init = false};

    err_code = nrf_drv_twi_init(&amp;amp;twi_instance, &amp;amp;twi_config, NULL, NULL);
    APP_ERROR_CHECK(err_code);
    nrf_drv_twi_enable(&amp;amp;twi_instance);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Not working code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static const nrf_drv_twi_t m_twi = NRF_DRV_TWI_INSTANCE(0);
void i2cdev_initialize(void)
{
    ret_code_t err_code;

    const nrf_drv_twi_config_t config = {
        .scl = SCL_PIN,
        .sda = SDA_PIN,
        .frequency = NRF_TWI_FREQ_400K,
        .interrupt_priority = APP_IRQ_PRIORITY_HIGH};
        
    err_code = nrf_drv_twi_init(&amp;amp;m_twi, &amp;amp;config, NULL, NULL);
    APP_ERROR_CHECK(err_code);
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: i2cDevlib port to nRF52 SDK15</title><link>https://devzone.nordicsemi.com/thread/306987?ContentTypeID=1</link><pubDate>Tue, 27 Apr 2021 11:11:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1138c939-b2cb-4d88-880e-8f136e7f78a2</guid><dc:creator>awneil</dc:creator><description>[quote userid="94615" url="~/f/nordic-q-a/74493/i2cdevlib-port-to-nrf52-sdk15"]Any help in this matter would be highly appreciated[/quote]
&lt;p&gt;It&amp;#39;s not clear how far you&amp;#39;ve got, and where you&amp;#39;re stuck on this?&lt;/p&gt;
&lt;p&gt;Does the&amp;nbsp;&lt;span&gt;i2cDevlib&amp;nbsp;site/documentation provide guidance for porting?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Have you tried the i2cDevlib forums:&amp;nbsp;&lt;a href="http://www.i2cdevlib.com/contact"&gt;http://www.i2cdevlib.com/contact&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;One would hope that it would be well-structure, so the target-specific stuff should be well-isolated ... ?&lt;/p&gt;
&lt;p&gt;EDIT&lt;/p&gt;
&lt;p&gt;Step 1 under &amp;#39;Implementation&amp;#39; seems to be the key:&amp;nbsp;&lt;a href="http://www.i2cdevlib.com/usage"&gt;http://www.i2cdevlib.com/usage&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1619522111991v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>