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

MPU6050 Init failed when integrated with PCA 10028 (nrf51822)

Hi..! I am trying to ***Receive ACCELEROMETER DATA FROM MPU6050 to PCA10028(NRF51822) AND WANTING TO PRINT IT ONTO UART using KEIL IDE. Code is getting compiled & getting Output on UART as:-

mpu6050 test

mpu6050 init fail

mpu6050 id is 0

ACC: 10249 32 24327 GYRO: 12297 32 24327 ACC: 10249 32 0 GYRO: 12297 32 0 ACC: 10249 32 0 GYRO: 12297 32 0 ACC: 10249 32 0 GYRO: 12297 32 0 ACC: 10249 32 0 GYRO: 12297 32 0 ACC: 10249 32 0 GYRO: 12297 32 0 ACC: 10249 32 0 GYRO: 12297 32 0 ACC: 10249 32 0 GYRO: 12297 32 0 problem are

  • Hello Rajat

    From the file you uploaded I can see the MPU6050 init fail message is displayed when the mpu6050_init function is unable to verify the presence of the MPU6050. The mpu6050_init returns the variable transfer_succeeded, which can be set to false either at the first register write, or from the mpu6050_verify_product_id function.

    I would recommend you debug to try to pinpoint the source of the error, and make sure you are using the correct device address.

    Best regards

    Jørn Frøysa

  • Hello Jorn..! Thanks for your Instant reply. I got the data as:-- mpu6050 test mpu6050 id is 104 ACC: -2832 -8748 -14872 GYRO: 1367 -3020 4402 ACC: -2880 -7632 -15596 GYRO: 2569 2349 -47 ACC: -1784 -9320 -15936 GYRO: 147 -221 209 ACC: -3988 -8056 -14992 GYRO: -53 55 -31 ACC: -3620 -7924 -14956 GYRO: -78 63 -39 ACC: -3960 -8048 -14816 GYRO: -40 69 -19 ACC: -3680 -7904 -15132 GYRO: 250 -61 146 ACC: -3872 -8060 -14888 GYRO: -42 70 -37 ACC: -3920 -7972 -14892 GYRO: -42 69 -25 ACC: -3532 -7968 -14968 GYRO: -27 160 62 ACC: -4068 -7768 -14856 GYRO: -56 72 -93 ACC: -3844 -7804 -15088 GYRO: -64 66 -39 ACC: -3788 -7812 -14928 GYRO: -18 69 -20 ACC: -3952 -7868 -15012 GYRO: -56 50 -46 ACC: -3740 -7828 -15064 GYRO: -82 55 -35 ACC: -3688 -7836 -14908 GYRO: -39 73 -22 ACC: -4072 -7896 -14848 GYRO: -35 76 -27 ACC: -3896 -7740 -14956 GYRO: -43 61 -37 ACC: -3976 -7788 -14896 GYRO: -35 52 -38 ACC: -3948 -7964 -15056 GYRO: -35 66 -26 ACC: -3840 -7776 -14924 GYRO: -36 64 -32 ACC: -4068 -7880 -15028 GYRO: -30 64 -34 ACC: -3856 -7780 -15056 GYRO: -38 59 -42 ACC: -3816 -7776 -14992 GYRO: -45 58 -36 ACC: -3972 -7896 -15052 GYRO: -42 67 -25 ACC: -3784 -7756 -15036 GYRO: -31 67 -22 ACC: -3872 -7860 -14868 GYRO: -50 70 -38 ACC: -4004 -7816 -15060 GYRO: -47 52 -43 ACC: -3884 -7800 -15000 GYRO: -52 55 -37 ACC: -3872 -7852 -15224 GYRO: -43 70 -20 ACC: -3976 -7852 -15028 GYRO: -42 68 -23 ACC: -3936 -7764 -15024 GYRO: -51 54 -40 ACC: -3924 -7784 -15068 GYRO: -47 58 -41 ACC: -3808 -7804 -14956 GYRO: -48 55 -23 Actually there was a problem in interfacing the mpu6050 with the development board. I was connecting SCL and SDA with p0.7 and p0.30 respectively which should be P0.24 and P0.25 instead.

  • Connecting SCL and SDA with P0.24 and P0.25 instead will solve the problem.

Related