Connecting MPU6050 with rak5205 using rui and I2C problem

I have a project with rak 5205. In this project i want to connect the rak 5205 via I2C as a master device and read data from the slave MPU6050. But i am having the below problems with rui api.

rui_return_status = rui_i2c_rw(&I2c_2, RUI_IF_READ, mpu6050.devAddr,
MPU6050_RA_PWR_MGMT_1, mpu6050.buffer, 8);

Above function returns the status ok even if i haven’t connect the
sensor. And the buffer returns in serial monitor always 0. What can be
the cause of this problem?

I tried bypassing the rui api and use stm32 native functions, but failed.
I tried bypassing the rui and use stm32 native functions but failed.

My mpu6050.devAddr defined as 0x68
My register MPU6050_RA_PWR_MGMT_1 address is 0x6B

MPU6050_t mpu6050;

typedef struct MPU6050_t {
uint8_t devAddr;
uint8_t buffer[14];
} MPU6050_t;

And i also want to write onto the specific bit number of the register address of the sensor. Please help me about this. How can i do that?

Hi @dnlrkaan
You can refer to the 5205 operation of the i2c sensor: https://github.com/RAKWireless/Products_practice_based_on_RUI/tree/master/based%20on%20RAK811/app_5205
Also note that external circuits will affect I2C address,AD0 ->GND:0x68, AD0->VDD:0x69.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.