I am trying to interface NRF51422 with MPU6050 via twi(I2C) and I found one library for that in drivers_ext folder but it has some mismatch issue with twi library deprecated version and its latest version, I am new to NRF so can anyone guide me with it ?

I want 3 Axis Acceleration and Gyro data Via I2C bus, I have tried several ways and used some external libraries but nothing worked for me. And I am New to this so Please help me with this.

Parents
  • Hi,

    There is not much to go on here. Please explain more about:

    • which SDK version you use
    • how you use this driver
    • your HW configuration
    • how you have tested and in what way it does not work (what have you found while debugging)?
  • Hello Einar,

    • I am using SDK-12.3.
    • Actually I have a need of tri axis acceleration data. And I have MPU6050 Module and NRF51DK board(NRF51422 SOC) with me. So I decided to get acceleration data via I2C bus where  NRF51DK  is acting as a mater and MPU6050 is acting as a slave device. I found one example in C:\Nordic\nRF5_SDK_12.3.0_d7731ad\examples\peripheral\twi_sensor\pca10028\blank\arm5_no_packs location. and I found one lib in driver_ext folder after that I given compiler path to MPU6050 header file and added c file to the project and compiled it but it is showing some errors in this mpu6050_register_read function implementation related to implicit deceleration of twi_master_transfer function. After some doing some search on community I found that it uses TWI lib and twi Library has two versions one is deprecated and other one is its successor version. So my Example was using twi successor version and MPU lib that I found on driver_ext was implemented in deprecated version because of that It was showing me implicit deceleration of some function. So after that I replaced those deprecated lib version functions to the its successor lib function in mpu6050.c . After that everything was compiled successfully and I modified the twi_sensor example according to my described configuration. 
    • Interfaced NRF51 DK with MPU6050 by connecting SDA and SCL line respectively via jumper wires and gave it required 5V power source.    
    • I tested this hw according to my mention in second point. Actually I Do not have any hardware like Logic analyzer to analyze its signaling behavior at this point of time. And I am directly coming form Arduino apis based background so I would be little difficult for me to work with lower level drivers. Because of that I am looking for Higher level library apis to work with that but not able to use it in a proper manner. I am ready to move on to another acceleration sensor if there is any library example and library is there. It would be easier for me to start.
    • If possible, You can suggest another acceleration sensor with good example and libs which is compactible with this NRF51422.

    Thank You Einar. 

  • Hi,

    I suggest you obtain a logic analyzer as that will make it much easier to understand issues when working with I2C/TWI, or any other serial interface for that matter.

    Generally most if not all accelerometers you find that you talk to using I2C or SPI is compatible with the nRF51. But you may have to do some work to port the driver to SDK 12.3 if you cannot find something that allready exists. Regarding that, there is a thread here with code for using MPU6050. Not sure if that can be of use or not.

    For alternative accelerometers, you have for instance the LIS3DH which is used in the Thingy:52. For that you can refer to the Thingy52 firmware to see how it can be used.

Reply Children
No Data
Related