<?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>Problem with MPU6050 and nRF51822 to send Data over BLE..</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/42068/problem-with-mpu6050-and-nrf51822-to-send-data-over-ble</link><description>I am trying to send the MPU6050 data using BLE nRF51822. I have used ble_app_uart example modified it to read the data over I2C and send the data over BLE. I can successfuly read device ID but when i read accelerometer or gyroscope data I am unable to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 02 Jan 2019 13:00:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/42068/problem-with-mpu6050-and-nrf51822-to-send-data-over-ble" /><item><title>RE: Problem with MPU6050 and nRF51822 to send Data over BLE..</title><link>https://devzone.nordicsemi.com/thread/163434?ContentTypeID=1</link><pubDate>Wed, 02 Jan 2019 13:00:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3487142-1f56-4552-a378-d6a5bc27d81a</guid><dc:creator>Muhammad Nabeel</dc:creator><description>&lt;p&gt;Let me check and will reply and thanks for the help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with MPU6050 and nRF51822 to send Data over BLE..</title><link>https://devzone.nordicsemi.com/thread/163411?ContentTypeID=1</link><pubDate>Wed, 02 Jan 2019 11:39:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:513284e5-93c2-4f18-b1b6-30c4b8d643d1</guid><dc:creator>awneil</dc:creator><description>[quote userid="74022" url="~/f/nordic-q-a/42068/problem-with-mpu6050-and-nrf51822-to-send-data-over-ble/163399"]the same code which reads the accelerometer and gyroscope registers works fine when run separately.[/quote]
&lt;p&gt;So you need to find where the BLE is &amp;quot;disrupting&amp;quot; it.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&amp;nbsp;Does the combined code&amp;nbsp;&lt;span&gt;read the accelerometer &amp;amp; gyroscope registers fine if you just don&amp;#39;t enable the BLE?&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Does the combined code&amp;nbsp;read the accelerometer&amp;nbsp;&amp;amp;&amp;nbsp;gyroscope registers fine if the BLE is enabled, but not actually connected?&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Are you sure that it&amp;#39;s not reading the registers - or is it just that your transmission is corrupting the data?&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with MPU6050 and nRF51822 to send Data over BLE..</title><link>https://devzone.nordicsemi.com/thread/163401?ContentTypeID=1</link><pubDate>Wed, 02 Jan 2019 11:00:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:52736d94-32d7-4603-b79f-a4175c44f764</guid><dc:creator>Muhammad Nabeel</dc:creator><description>&lt;p&gt;BLE is working fine actually i am reading the device ID and send it&amp;nbsp; over BLE which works.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here is the snippet.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;	nrf_delay_ms(50);
	mpu6050_register_read(0x75U, &amp;amp;id, 1); // Read the device ID 
    err_code=ble_nus_string_send(&amp;amp;m_nus, gyrValue.temp2, 6); // Send over BLE
				
    APP_ERROR_CHECK(err_code);				
    nrf_delay_ms(2);			
	id=0;&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with MPU6050 and nRF51822 to send Data over BLE..</title><link>https://devzone.nordicsemi.com/thread/163399?ContentTypeID=1</link><pubDate>Wed, 02 Jan 2019 10:58:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac7e22f3-7a58-47e3-bb8f-d01117462a69</guid><dc:creator>Muhammad Nabeel</dc:creator><description>&lt;p&gt;Yeah, you are right. But the same code which reads the accelerometer and gyroscope registers works fine when run separately. Actually I merged two examples together one ble_app_uart and other reads data from MPU6050 and prints the data on the terminal.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here are some snippets&amp;nbsp;of the code which reads data.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void MPU6050_ReadAcc( int16_t *pACC_X , int16_t *pACC_Y , int16_t *pACC_Z )
{
    
	uint8_t buf[6];    		
//	uint8_t addr= MPU6050_ADDRESS &amp;lt;&amp;lt; 1;

    
	mpu6050_register_read(MPU6050_ACC_OUT, buf, 6);
  *pACC_X = (buf[0] &amp;lt;&amp;lt; 8) | buf[1];
	if(*pACC_X &amp;amp; 0x8000) *pACC_X-=65536;
		
	*pACC_Y= (buf[2] &amp;lt;&amp;lt; 8) | buf[3];
  if(*pACC_Y &amp;amp; 0x8000) *pACC_Y-=65536;
	
  *pACC_Z = (buf[4] &amp;lt;&amp;lt; 8) | buf[5];
	if(*pACC_Z &amp;amp; 0x8000) *pACC_Z-=65536;
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with MPU6050 and nRF51822 to send Data over BLE..</title><link>https://devzone.nordicsemi.com/thread/163383?ContentTypeID=1</link><pubDate>Wed, 02 Jan 2019 09:54:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d1a6f890-9230-4ac4-8f50-26d4b9ffc65f</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;So your question is actually just about how to read the sensor - not (yet) about how to send data over BLE.&lt;/p&gt;
&lt;p&gt;It is important to take these things one step at a time!&lt;/p&gt;
[quote userid="74022" url="~/f/nordic-q-a/42068/problem-with-mpu6050-and-nrf51822-to-send-data-over-ble"]I can successfuly read device ID[/quote]
&lt;p&gt;So you must have your basic I2C comms working, then.&lt;/p&gt;
[quote userid="74022" url="~/f/nordic-q-a/42068/problem-with-mpu6050-and-nrf51822-to-send-data-over-ble"]but when i read accelerometer or gyroscope data I am unable to read any register[/quote]
&lt;p&gt;So there must be something wrong with your higher-level code.&lt;/p&gt;
&lt;p&gt;You need to check your code carefully against the&amp;nbsp;MPU6050&amp;#39;s &lt;strong&gt;datasheet&lt;/strong&gt; - and confirm that you are doing &lt;em&gt;&lt;strong&gt;exactly&lt;/strong&gt; &lt;/em&gt;what it says.&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You should also look at the I2C line with an analyser or oscilloscope to see what is acually happening - and, again, confirm that it meets&amp;nbsp;the datasheet requirements.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;This is all standard interface debugging stuff - nothing specifically to do with Nordic.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a href="https://www.avrfreaks.net/comment/2418156#comment-2418156"&gt;www.avrfreaks.net/.../2418156&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>