<?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>MPU9250 TWI Data Retrieve Crashing</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/57506/mpu9250-twi-data-retrieve-crashing</link><description>Hi 
 I&amp;#39;m have and NRF52840 with a MPU9250 connected via TWI. The connection to the MPU9250 is successful, I can find its address on the bus (0x68). 
 I&amp;#39;ve implemented a very simple couple of uint32_t structs to based upon other examples available: 
 Read</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 11 Feb 2020 12:40:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/57506/mpu9250-twi-data-retrieve-crashing" /><item><title>RE: MPU9250 TWI Data Retrieve Crashing</title><link>https://devzone.nordicsemi.com/thread/233730?ContentTypeID=1</link><pubDate>Tue, 11 Feb 2020 12:40:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:524907c1-23bb-4f8a-9a82-1395b6b91f99</guid><dc:creator>aplatts</dc:creator><description>&lt;p&gt;Hi Vidar&lt;/p&gt;
&lt;p&gt;You are correct, I had ported a library which was using other legacy library&amp;#39;s which was causing the issue. It has been a big&amp;nbsp;learning&amp;nbsp;curve, thanks for your excellent support.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MPU9250 TWI Data Retrieve Crashing</title><link>https://devzone.nordicsemi.com/thread/233728?ContentTypeID=1</link><pubDate>Tue, 11 Feb 2020 12:33:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:57275e29-b84f-4a5c-a496-89abb52bedcd</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Thanks, so it looks like you are getting the NRF_ERROR_TIMEOUT from nrf_drv_mpu_read_registers(). Maybe you can add some more logging in your TWI callback and see if you get the NRF_DRV_TWI_EVT_ADDRESS_NACK or NRF_DRV_TWI_EVT_DATA_NACK event instead of the expected&amp;nbsp;NRF_DRV_TWI_EVT_DONE.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MPU9250 TWI Data Retrieve Crashing</title><link>https://devzone.nordicsemi.com/thread/233310?ContentTypeID=1</link><pubDate>Fri, 07 Feb 2020 13:56:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:908b231b-d27c-490a-88f7-d8aa615bc58d</guid><dc:creator>aplatts</dc:creator><description>&lt;p&gt;Great, set that an now I get a much better view of the issue (but still don&amp;#39;t understand):&lt;/p&gt;
&lt;p&gt;New -DDEBUG Output:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;info&amp;gt; app: Read accelerometer sensor values

&amp;lt;error&amp;gt; app: ERROR 13 [NRF_ERROR_TIMEOUT] at ../../../main.c:741

PC at: 0x0002B413&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;In my code line 741 is line 31 in the code snippet below:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;int main(void)
{
    // Initialize.
    log_init();
    leds_init();
    timers_init();
    buttons_init();
    power_management_init();
    twi_init();
    ble_stack_init();
    gap_params_init();
    gatt_init();
    services_init();
    advertising_init();
    conn_params_init();

    // Start execution.
    twiScanning();
    advertising_start();

    NRF_LOG_INFO(&amp;quot;StingRay Started.&amp;quot;);

    NRF_LOG_FLUSH();

    if (MPU9250) {
        // Read accelerometer sensor values
        NRF_LOG_INFO(&amp;quot;Read accelerometer sensor values&amp;quot;);
        uint32_t err_code;
        accel_values_t acc_values;
        err_code = app_mpu_read_accel(&amp;amp;acc_values);
        APP_ERROR_CHECK(err_code);
        NRF_LOG_INFO(&amp;quot;Accel %d\r\nX: %06d\r\nY: %06d\r\nZ: %06d&amp;quot;, acc_values.x, acc_values.y, acc_values.z);
        NRF_LOG_FLUSH();
    }

    // Enter main loop.
    for (;;)
    {
        idle_state_handle();
    }
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MPU9250 TWI Data Retrieve Crashing</title><link>https://devzone.nordicsemi.com/thread/233300?ContentTypeID=1</link><pubDate>Fri, 07 Feb 2020 13:31:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f970e997-15d1-441e-b682-b291b16ed7b6</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Sorry. Are you using Makefiles from the SDK to compile? In that case, add this line &lt;strong&gt;&amp;quot;CFLAGS += -DDEBUG&lt;/strong&gt;&amp;quot; &lt;strong&gt;&lt;/strong&gt;together with the other C flags.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MPU9250 TWI Data Retrieve Crashing</title><link>https://devzone.nordicsemi.com/thread/233295?ContentTypeID=1</link><pubDate>Fri, 07 Feb 2020 13:17:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:67c6c978-3e78-473c-88e0-bf5b886f4b08</guid><dc:creator>aplatts</dc:creator><description>&lt;p&gt;Thanks, newbie ish. How do I do that?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MPU9250 TWI Data Retrieve Crashing</title><link>https://devzone.nordicsemi.com/thread/233276?ContentTypeID=1</link><pubDate>Fri, 07 Feb 2020 12:46:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0dacba9b-7bae-4921-96bd-e67bfb730a42</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Yes, if you add the &amp;quot;DEBUG&amp;quot; flag to your list of preprocessor symbols ( ie add -DDEBUG)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MPU9250 TWI Data Retrieve Crashing</title><link>https://devzone.nordicsemi.com/thread/233273?ContentTypeID=1</link><pubDate>Fri, 07 Feb 2020 12:43:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38efe653-357c-4262-b64d-05bcf11003e5</guid><dc:creator>aplatts</dc:creator><description>&lt;p&gt;I&amp;rsquo;m using VSC, can I get a similar output with NRF_LOG?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MPU9250 TWI Data Retrieve Crashing</title><link>https://devzone.nordicsemi.com/thread/233254?ContentTypeID=1</link><pubDate>Fri, 07 Feb 2020 12:08:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:35af22b2-56bc-4123-9ff7-700434098e88</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Are you using Segger Embedded Studio? In that case, please select the &amp;quot;Debug&amp;quot; target from the drop-down menu on the top left side before you start debugging. This will make the crash log more verbose. Instead of just &amp;quot;Fatal error&amp;quot; it will include the file name and line number of where the error occurred.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>