This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Problem with MPU6050 and nRF51822 to send Data over BLE..

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 read any register. Please help me 

Parents
  • 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. 

    Here are some snippets of the code which reads data.

    void MPU6050_ReadAcc( int16_t *pACC_X , int16_t *pACC_Y , int16_t *pACC_Z )
    {
        
    	uint8_t buf[6];    		
    //	uint8_t addr= MPU6050_ADDRESS << 1;
    
        
    	mpu6050_register_read(MPU6050_ACC_OUT, buf, 6);
      *pACC_X = (buf[0] << 8) | buf[1];
    	if(*pACC_X & 0x8000) *pACC_X-=65536;
    		
    	*pACC_Y= (buf[2] << 8) | buf[3];
      if(*pACC_Y & 0x8000) *pACC_Y-=65536;
    	
      *pACC_Z = (buf[4] << 8) | buf[5];
    	if(*pACC_Z & 0x8000) *pACC_Z-=65536;
    }
    

  • the same code which reads the accelerometer and gyroscope registers works fine when run separately.

    So you need to find where the BLE is "disrupting" it.

    •  Does the combined code read the accelerometer & gyroscope registers fine if you just don't enable the BLE?
    • Does the combined code read the accelerometer & gyroscope registers fine if the BLE is enabled, but not actually connected?
    • Are you sure that it's not reading the registers - or is it just that your transmission is corrupting the data?
  • Let me check and will reply and thanks for the help.

Reply Children
No Data
Related