MediaTek-Labs / mt3620_m4_software

mt3620_m4_driver
Other
32 stars 29 forks source link

I2C Write and Read always returns I2C_EINVAL #4

Closed LennardSchmit closed 4 years ago

LennardSchmit commented 4 years ago

Hi,

Every time i try to write or read from I2C with the os_hal_i2c library, the read/write functions return "I2C_EINVAL". After debugging i found out that in the i2c struct, mode is first set to I2C_MASTER_MODE. But after passing the struct to "mtk_mhal_i2c_trigger_transfer" the mode is set to unknown, and an error is returned. My code is the following:

int initRet = mtk_os_hal_i2c_ctrl_init(OS_HAL_I2C_ISU2); int speedRet = mtk_os_hal_i2c_speed_init(OS_HAL_I2C_ISU2, I2C_SCL_100kHz); int ret = mtk_os_hal_i2c_write_read(OS_HAL_I2C_ISU2, SHT31_ADR, i2cTxBuf, &i2cRxBuf, sizeof(i2cTxBuf), sizeof(i2cRxBuf));

LawranceLiu commented 4 years ago

Hi, Thanks for your feedback. Please refer to the release_191211 for the bug fix: https://github.com/MediaTek-Labs/mt3620_m4_software/commit/78cfe221e108e5ebf8140a6a9e60b7bb5fa4916e