This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to use acc-gyro 6050 with nrf51822 and soft device?

Hi. I read in the sdk documentation, there is a library to use MPU-6050. So i try to find it but I did not succeed. i want to read data from 6050 and send this data with advartising method. someone can help me communicate with the sensor? I think the soft device can give me some trouble.

best regards

  • Which SDK version are you using? In the newest SDK (7.1.0) the drivers are located in the (SDK path)\components\drivers_ext\mpu6050 folder. You must include mpu6050.h as well as the components\drivers_nrf\twi_master\twi_master.h library in your main.c file. The two corresponding c-files mpu6050.c and twi_sw_master.c must be added to you Keil project.

    If you are using packs for Keil, the mpu6050 drivers and TWI library are found under nRF_Drivers_External and nRF_Drivers respectively (In the "Manage Run-time Environment" window)

    The mpu6050 drivers provide you with the functions:

    • mpu6050_init()
    • mpu6050_register_write()
    • mpu6050_register_read()
    • mpu6050_verify_product_id()

    In main(), first initialize TWI, then the mpu6050:

    twi_master_init();
    mpu6050_init(addr);
    

    If you use the software TWI (twi_sw_master.c, not twi_hw_master.c) it should work with the softdevice enabled.

Related