<?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>nRF52832 with MPU9250 using i2c (TWI) on SDK15.2, SD132, Segger Embedded Studio</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/70466/nrf52832-with-mpu9250-using-i2c-twi-on-sdk15-2-sd132-segger-embedded-studio</link><description>Hi. 
 I&amp;#39;m trying to integrate the MPU9250 with nRF52832 using i2c (TWI) on my nRF52-DK 
 I have found various libraries but none of them are working on my hardware. All of them have compilation errors and missing files (or parts inside files) 
 If anyone</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 19 Jan 2021 18:30:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/70466/nrf52832-with-mpu9250-using-i2c-twi-on-sdk15-2-sd132-segger-embedded-studio" /><item><title>RE: nRF52832 with MPU9250 using i2c (TWI) on SDK15.2, SD132, Segger Embedded Studio</title><link>https://devzone.nordicsemi.com/thread/290073?ContentTypeID=1</link><pubDate>Tue, 19 Jan 2021 18:30:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e68377e-bce9-4087-a628-61f8275423b4</guid><dc:creator>usmanmehmood55</dc:creator><description>&lt;p&gt;I actually did click the verify answer button, but didn&amp;#39;t wait for it to actually update before closing the browser. That&amp;#39;s my bad.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 with MPU9250 using i2c (TWI) on SDK15.2, SD132, Segger Embedded Studio</title><link>https://devzone.nordicsemi.com/thread/290071?ContentTypeID=1</link><pubDate>Tue, 19 Jan 2021 18:26:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:83bc2633-412b-401b-8917-bd84d97e23f4</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/8360._5F00_Verify_2D00_answer_2D00_nordic_5F00_2.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 with MPU9250 using i2c (TWI) on SDK15.2, SD132, Segger Embedded Studio</title><link>https://devzone.nordicsemi.com/thread/289937?ContentTypeID=1</link><pubDate>Tue, 19 Jan 2021 08:40:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:596d7f89-cc76-418a-b7da-dedc73e2e563</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;Glad to hear, good job! :D&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 with MPU9250 using i2c (TWI) on SDK15.2, SD132, Segger Embedded Studio</title><link>https://devzone.nordicsemi.com/thread/289915?ContentTypeID=1</link><pubDate>Tue, 19 Jan 2021 06:36:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cea3681c-f806-49f3-bf19-bb73cda1d065</guid><dc:creator>usmanmehmood55</dc:creator><description>&lt;p&gt;I managed to make it work. Thank you so much for your help.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 with MPU9250 using i2c (TWI) on SDK15.2, SD132, Segger Embedded Studio</title><link>https://devzone.nordicsemi.com/thread/289463?ContentTypeID=1</link><pubDate>Fri, 15 Jan 2021 14:15:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fcb616f9-5cf0-4b81-84d6-eead657ba8d7</guid><dc:creator>awneil</dc:creator><description>[quote userid="13562" url="~/f/nordic-q-a/70466/nrf52832-with-mpu9250-using-i2c-twi-on-sdk15-2-sd132-segger-embedded-studio/289409#289409"]It&amp;#39;s a SW vs HW implementation[/quote]
&lt;p&gt;hence the &lt;strong&gt;_sw_&lt;/strong&gt; and &lt;strong&gt;_hw_&lt;/strong&gt; in the file names!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 with MPU9250 using i2c (TWI) on SDK15.2, SD132, Segger Embedded Studio</title><link>https://devzone.nordicsemi.com/thread/289409?ContentTypeID=1</link><pubDate>Fri, 15 Jan 2021 12:46:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0d2dcdf0-3fe9-40ec-a8e7-6d54a48e55f1</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;It&amp;#39;s a SW vs HW implementation, use the HW one.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 with MPU9250 using i2c (TWI) on SDK15.2, SD132, Segger Embedded Studio</title><link>https://devzone.nordicsemi.com/thread/289393?ContentTypeID=1</link><pubDate>Fri, 15 Jan 2021 11:43:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e7f780b-773d-43e9-9554-0ab907f9c1a4</guid><dc:creator>usmanmehmood55</dc:creator><description>&lt;p&gt;Hi. I&amp;#39;m looking at Nordic&amp;#39;s &lt;strong&gt;twi_master.h&lt;/strong&gt; library. And there is something very confusing.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;There are two .c fies. One is&amp;nbsp;&lt;span&gt;&lt;strong&gt;twi_hw_master.c&lt;/strong&gt; and other is&amp;nbsp;&lt;strong&gt;twi_sw_master.c&lt;/strong&gt;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Now, each of these files contain their own definitions of the functions&amp;nbsp;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;strong&gt;twi_master_transfer&lt;/strong&gt;, and&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;strong&gt;twi_master_init&lt;/strong&gt;. And the functions are not being overloaded either. They have the same return type, same inputs.&amp;nbsp;&lt;br /&gt;For example, here&amp;#39;s&amp;nbsp;twi_master_transfer:&lt;br /&gt;In&amp;nbsp;&lt;span&gt;twi_hw_master.c&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;bool twi_master_transfer(uint8_t address,
                         uint8_t *data,
                         uint8_t data_length,
                         bool issue_stop_condition)
{
    bool transfer_succeeded = true;

    transfer_succeeded &amp;amp;= twi_master_issue_startcondition();
    transfer_succeeded &amp;amp;= twi_master_clock_byte(address);

    if (address &amp;amp; TWI_READ_BIT)
    {
        /* Transfer direction is from Slave to Master */
        while (data_length-- &amp;amp;&amp;amp; transfer_succeeded)
        {
            // To indicate to slave that we&amp;#39;ve finished transferring last data byte
            // we need to NACK the last transfer.
            if (data_length == 0)
            {
                transfer_succeeded &amp;amp;= twi_master_clock_byte_in(data, (bool)false);
            }
            else
            {
                transfer_succeeded &amp;amp;= twi_master_clock_byte_in(data, (bool)true);
            }
            data++;
        }
    }
    else
    {
        /* Transfer direction is from Master to Slave */
        while (data_length-- &amp;amp;&amp;amp; transfer_succeeded)
        {
            transfer_succeeded &amp;amp;= twi_master_clock_byte(*data);
            data++;
        }
    }

    if (issue_stop_condition || !transfer_succeeded)
    {
        transfer_succeeded &amp;amp;= twi_master_issue_stopcondition();
    }

    return transfer_succeeded;
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;And in&amp;nbsp;twi_sw_master.c&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;bool twi_master_transfer(uint8_t   address,
                         uint8_t * data,
                         uint8_t   data_length,
                         bool      issue_stop_condition)
{
    bool transfer_succeeded = false;
    if (data_length &amp;gt; 0 &amp;amp;&amp;amp; twi_master_clear_bus())
    {
        NRF_TWI1-&amp;gt;ADDRESS = (address &amp;gt;&amp;gt; 1);

        if ((address &amp;amp; TWI_READ_BIT))
        {
            transfer_succeeded = twi_master_read(data, data_length, issue_stop_condition);
        }
        else
        {
            transfer_succeeded = twi_master_write(data, data_length, issue_stop_condition);
        }
    }
    return transfer_succeeded;
}&lt;/pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;This seems very strange to me. Which one is the code supposed to use?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 with MPU9250 using i2c (TWI) on SDK15.2, SD132, Segger Embedded Studio</title><link>https://devzone.nordicsemi.com/thread/289159?ContentTypeID=1</link><pubDate>Thu, 14 Jan 2021 11:28:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:51c67e80-34eb-4d3c-8fee-41d293784f7f</guid><dc:creator>awneil</dc:creator><description>[quote userid="94615" url="~/f/nordic-q-a/70466/nrf52832-with-mpu9250-using-i2c-twi-on-sdk15-2-sd132-segger-embedded-studio/289150#289150"]I was hesitant to make my own R/W functions,[/quote]
&lt;p&gt;That&amp;#39;s just implementing the basic I2C bus access - for these, what Slave you use is irrelevant.&lt;/p&gt;
&lt;p&gt;so see the I2C drivers &amp;amp; examples in the SDK&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/twi_scanner_example.html"&gt;https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/twi_scanner_example.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/twi_sensor_example.html"&gt;https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/twi_sensor_example.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/twi_transaction_mgr_example.html"&gt;https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/twi_transaction_mgr_example.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/twi_master_with_twis_slave_example.html"&gt;https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/twi_master_with_twis_slave_example.html&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 with MPU9250 using i2c (TWI) on SDK15.2, SD132, Segger Embedded Studio</title><link>https://devzone.nordicsemi.com/thread/289151?ContentTypeID=1</link><pubDate>Thu, 14 Jan 2021 11:08:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:520b503e-64ef-462a-8414-e46550e01d49</guid><dc:creator>usmanmehmood55</dc:creator><description>&lt;p&gt;Indeed.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 with MPU9250 using i2c (TWI) on SDK15.2, SD132, Segger Embedded Studio</title><link>https://devzone.nordicsemi.com/thread/289150?ContentTypeID=1</link><pubDate>Thu, 14 Jan 2021 11:08:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:45c7aba0-bfe1-481e-abe0-031218d78ab9</guid><dc:creator>usmanmehmood55</dc:creator><description>&lt;p&gt;Hi.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I will try to do that as well.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I was hesitant to make my own R/W functions, but I might have to do it in the end.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Can you please give me a guide/advice on how to do so?&lt;/p&gt;
&lt;p&gt;Regards.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 with MPU9250 using i2c (TWI) on SDK15.2, SD132, Segger Embedded Studio</title><link>https://devzone.nordicsemi.com/thread/289140?ContentTypeID=1</link><pubDate>Thu, 14 Jan 2021 10:45:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0131684-4042-40f5-b06c-c1f344a8b81e</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;I suggest you ask Invensense for their driver and libraries, you should only need to implement the R/W functions with our TWI driver API.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;-Edit:&lt;br /&gt;&lt;br /&gt;From the invensense website: &amp;quot;Note: The MPU-9250 is marked as EOL and is not recommended for new designs&amp;quot;.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://invensense.tdk.com/products/motion-tracking/9-axis/mpu-9250/"&gt;https://invensense.tdk.com/products/motion-tracking/9-axis/mpu-9250/&lt;/a&gt;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;There&amp;#39;s also little stock left at distributors.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 with MPU9250 using i2c (TWI) on SDK15.2, SD132, Segger Embedded Studio</title><link>https://devzone.nordicsemi.com/thread/289125?ContentTypeID=1</link><pubDate>Thu, 14 Jan 2021 10:19:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac9c3e55-82cc-4e74-8d08-c485edf2a48f</guid><dc:creator>awneil</dc:creator><description>[quote userid="94615" url="~/f/nordic-q-a/70466/nrf52832-with-mpu9250-using-i2c-twi-on-sdk15-2-sd132-segger-embedded-studio/289112#289112"]Yes, I did[/quote]
&lt;p&gt;Jolly good.&lt;/p&gt;
&lt;p&gt;Amazing how many people don&amp;#39;t seem to think of that.&lt;/p&gt;
&lt;p&gt;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f61e.svg" title="Disappointed"&gt;&amp;#x1f61e;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 with MPU9250 using i2c (TWI) on SDK15.2, SD132, Segger Embedded Studio</title><link>https://devzone.nordicsemi.com/thread/289112?ContentTypeID=1</link><pubDate>Thu, 14 Jan 2021 09:54:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f6e63d34-5107-4dad-80d0-da0024edf8a8</guid><dc:creator>usmanmehmood55</dc:creator><description>&lt;p&gt;Yes, I did. But no reply so far. I figured someone here must&amp;#39;ve done this before, so I asked here as well.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 with MPU9250 using i2c (TWI) on SDK15.2, SD132, Segger Embedded Studio</title><link>https://devzone.nordicsemi.com/thread/289111?ContentTypeID=1</link><pubDate>Thu, 14 Jan 2021 09:53:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26ad3eca-65f4-46b8-ab26-329f94ac27f6</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;Have you tried raising a GitHub issue on any of those? Or contacting the authors?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 with MPU9250 using i2c (TWI) on SDK15.2, SD132, Segger Embedded Studio</title><link>https://devzone.nordicsemi.com/thread/289105?ContentTypeID=1</link><pubDate>Thu, 14 Jan 2021 09:42:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:201f07e2-96a9-41c6-b6f5-00b54ecf8b5f</guid><dc:creator>usmanmehmood55</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;I have tried the following libraries:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/Martinsbl/nrf5-mpu-examples"&gt;https://github.com/Martinsbl/nrf5-mpu-examples&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/e27182/nRF52832_pesky"&gt;https://github.com/e27182/nRF52832_pesky&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/simondlevy/MPU"&gt;https://github.com/simondlevy/MPU&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/loopj/i2c-hal"&gt;https://github.com/loopj/i2c-hal&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;None of them compiled. I should correct that in the question, sorry about that.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks for the help. :)&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 with MPU9250 using i2c (TWI) on SDK15.2, SD132, Segger Embedded Studio</title><link>https://devzone.nordicsemi.com/thread/289096?ContentTypeID=1</link><pubDate>Thu, 14 Jan 2021 09:33:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5153f91f-bf11-48b6-b449-b4d91bddad33</guid><dc:creator>awneil</dc:creator><description>[quote userid="94615" url="~/f/nordic-q-a/70466/nrf52832-with-mpu9250-using-i2c-twi-on-sdk15-2-sd132-segger-embedded-studio"]I have found various libraries[/quote]
&lt;p&gt;What libraries, exactly?&lt;/p&gt;
&lt;p&gt;Would help if you said what you&amp;#39;ve tried - so people don&amp;#39;t just repeat ones you&amp;#39;ve already looked at.&lt;/p&gt;
[quote userid="94615" url="~/f/nordic-q-a/70466/nrf52832-with-mpu9250-using-i2c-twi-on-sdk15-2-sd132-segger-embedded-studio"]Most of them have compilation errors[/quote]
&lt;p&gt;So what about the one(s) that build OK? What testing / debugging / investigation did you do to find out what&amp;#39;s going on and, thus, what&amp;#39;s wrong?&lt;/p&gt;
&lt;p&gt;Remember that the&amp;nbsp;&lt;span&gt;MPU9250&amp;nbsp;neither knows nor cares what microcontroller you use - all it sees is the transactions on the I2C bus.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Therefore key to this is being able to check what&amp;#39;s happening on the I2C bus - and verify that it&amp;#39;s correct, or see where it&amp;#39;s going wrong.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;So do you have an oscilloscope or analyser to see&amp;nbsp;what&amp;#39;s happening on the I2C bus?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>