ulp coprocessor interfacing with MPU6050

Redstoned_boy
Posts: 1
Joined: Thu Jan 10, 2019 8:54 pm

ulp coprocessor interfacing with MPU6050

Postby Redstoned_boy » Thu Jan 10, 2019 9:07 pm

I wanted to use an MPU6050 accelerometer with the ulp-coprocessor.
I have set the registers according to the technical reference https://www.espressif.com/sites/defaul ... en.pdf#183 but I can't communicate with it.

Here's my code:

Code: Select all

    .text
    .global entry
entry:

//jump to i2c_read if already set up
    move r3, 10
    ld   r1, r3, 0
    jumpr loop, 1, GE
    add r1, r1, 1
    st r1, r3, 0

//1  set i2c speed to 100 KHz
    WRITE_RTC_REG(RTC_I2C_SCL_LOW_PERIOD_REG, 0, 18, 40)
    WRITE_RTC_REG(RTC_I2C_SCL_HIGH_PERIOD_REG, 0, 19, 40)
//2
    WRITE_RTC_REG(RTC_I2C_SDA_DUTY_REG, 0, 19, 16)
//3
    WRITE_RTC_REG(RTC_I2C_SCL_START_PERIOD_REG, 0, 19, 30)
//4
    WRITE_RTC_REG(RTC_I2C_SCL_STOP_PERIOD_REG, 0, 19, 44)
//5
    WRITE_RTC_REG(RTC_I2C_TIMEOUT_REG, 0, 19, 200)
//6
    WRITE_RTC_REG(RTC_I2C_CTRL_REG, 4, 1, 1)
//7
    WRITE_RTC_REG(SENS_SAR_SLAVE_ADDR1_REG, 11, 10, 0x68) 

//pins:
    WRITE_RTC_REG(RTC_IO_SAR_I2C_IO_REG, 28, 2, 1)//SCL = GPIO 15 
    WRITE_RTC_REG(SAR_I2C_IO_REG, 30, 2, 0)//SDA = GPIO 4 
    
 .global loop
 loop:
    I2C_RD 0x48, 7, 0, 0

//save read register in RTC_SLOW_MEM[12]
    move r3, 12
    st r0, r3, 0
    halt
As I don't know much about I2C I have no clue if I done something wrong and how to fix it. Could You please help me?

Return to “ESP32 IDF”

Who is online

Users browsing this forum: Google [Bot], loboris and 19 guests