<?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>[nRF51 to nRF52 Migration] TWI issues</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/41163/nrf51-to-nrf52-migration-twi-issues</link><description>Hi, 
 I am currently migrating my controller from nRF51 to nRF52832 . I am facing an issue where in when I try to do an TWI communication with MPU9250 on nRF52 the code gets stuck in the TWI commands. 
 I am using SDK12.3. 
 The code that I am using to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 04 Dec 2018 13:43:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/41163/nrf51-to-nrf52-migration-twi-issues" /><item><title>RE: [nRF51 to nRF52 Migration] TWI issues</title><link>https://devzone.nordicsemi.com/thread/160213?ContentTypeID=1</link><pubDate>Tue, 04 Dec 2018 13:43:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c175ae85-b53b-44ec-aef8-b4074ef1b3d5</guid><dc:creator>pmantri0412</dc:creator><description>&lt;p&gt;Ok, I believe the issue was that I was using the NCF 1 pin with disabling the NFC. Once I added the preprocessor directive&amp;nbsp;&lt;span&gt;CONFIG_NFCT_PINS_AS_GPIOS.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I was able to get the Sensor working.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF51 to nRF52 Migration] TWI issues</title><link>https://devzone.nordicsemi.com/thread/160210?ContentTypeID=1</link><pubDate>Tue, 04 Dec 2018 13:31:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:03b3c9b3-959e-4386-9608-e1c9d519e0b4</guid><dc:creator>pmantri0412</dc:creator><description>&lt;p&gt;I have 10K resistors pulling up my SCL and SDA lines to VDD. But when I check the voltage (without enabling TWI) my SDA is not pulled up to VDD.&lt;/p&gt;
&lt;p&gt;I have connected SDA to pin 9 which is the NFC1 input. Does this cause any issues ? My SCL is connected to Pin 8 and that is pulled up to VDD.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF51 to nRF52 Migration] TWI issues</title><link>https://devzone.nordicsemi.com/thread/160205?ContentTypeID=1</link><pubDate>Tue, 04 Dec 2018 12:57:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e979c43a-c2d0-4786-8f31-5fc70d7d49e9</guid><dc:creator>pmantri0412</dc:creator><description>&lt;p&gt;Hi Kenneth,&lt;/p&gt;
&lt;p&gt;I used used the twi example in SDKv12.3 and modified the code to read the who am I register in MPU9250 .&lt;/p&gt;
&lt;p&gt;I am getting an&amp;nbsp;&amp;quot;NRF_ERROR_BUSY&amp;quot; error when I try to read the register.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So the code progress all the way till line 44 and gets stuck there.&lt;/p&gt;
&lt;p&gt;Here is the code snippet.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**
 * @brief TWI initialization.
 */
void twi_init (void)
{
    ret_code_t err_code;

    const nrf_drv_twi_config_t twi_lm75b_config = {
       .scl                = SCL_PIN_NUMBER,
       .sda                = SDA_PIN_NUMBER,
       .frequency          = NRF_TWI_FREQ_400K,
       .interrupt_priority = APP_IRQ_PRIORITY_HIGH,
       .clear_bus_init     = false
    };

    err_code = nrf_drv_twi_init(&amp;amp;m_twi, &amp;amp;twi_lm75b_config, twi_handler, NULL);
    APP_ERROR_CHECK(err_code);

    nrf_drv_twi_enable(&amp;amp;m_twi);
}

/**
 * @brief Function for reading data from MPU9250 sensor.
 */
static void read_whi_data()
{
    m_xfer_done = false;
    ret_code_t err_code;
    uint8_t data[2] ={0,0};

   
    err_code= nrf_drv_twi_tx(&amp;amp;m_twi,0x68,&amp;amp;who_am_i_reg,1,1);
    if (err_code!=NRF_SUCCESS)
    {
        CYAN_ON();
        while(1){}
    }

    BLUE_ON();
    
    err_code = nrf_drv_twi_rx(&amp;amp;m_twi,0x68,data,1);
    if (err_code == NRF_ERROR_BUSY)
    {
        WHITE_ON();
        while(1){}
    }

    if (data[0] == 0x71)
    {
        PURPLE_ON();
    }
    else
    {
        GREEN_ON();
    }

}

/**
 * @brief Function for main application entry.
 */
int main(void)
{
    LED_init();
    
    twi_init();
    
    RED_ON();
    nrf_delay_ms(1000);
    read_whi_data();
    while (true)
    {
        nrf_delay_ms(500);

        do
        {
            __WFE();
        }while (m_xfer_done == false);
    }
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF51 to nRF52 Migration] TWI issues</title><link>https://devzone.nordicsemi.com/thread/160182?ContentTypeID=1</link><pubDate>Tue, 04 Dec 2018 11:51:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e3edf00b-2a9c-4a61-bdee-8986a2d1cc5c</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Can you first confirm that the twi example in SDKv12.3 works &amp;quot;as-is&amp;quot;, just to rule out hardware issues (pins, pull-ups, address etc).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>