主题:SysConfig 中讨论的其他器件
工具/软件:
您好:
在升级到 MCU+SDK 11.0.0.15后、我尝试在 M4F 上使用 MCU_I2C0。 我正在使用高级驱动程序、I2C_TRANSFER()函数总是返回状态 I2C_STS_ERR_TIMEOUT。 之前、我使用的是 MCU+SDK 9.1.0.41、它使 I2C 正常工作。 我还应注意、M4F 运行 FreeRTOS 并使用 IPC RPMsg 与 A53 (运行 Linux)进行通信。
以下是在 M4F 上执行 I2C 传输的代码:
#define I2C_BUF_SIZE 16u
#define I2C_TIMEOUT_MS 100u
uint8_t i2c_rx_buf[I2C_BUF_SIZE] = {0u};
uint8_t i2c_tx_buf[I2C_BUF_SIZE] = {0u};
I2C_Handle i2c_handle;
I2C_Transaction i2c_transaction_handle;
static int32_t i2c_transfer_msg(uint8_t i2c_send_buf[], uint8_t send_buf_len, uint8_t i2c_recv_buf[], uint8_t recv_buf_len, uint8_t i2c_addr)
{
if ((i2c_send_buf == NULL) || (i2c_recv_buf == NULL)) // Ensure the pointers aren't NULL
{
return I2C_STS_ERR;
}
memset(i2c_rx_buf, 0, I2C_BUF_SIZE); // Clear the I2C Rx buffer
int32_t status;
i2c_transaction_handle.targetAddress = i2c_addr;
i2c_transaction_handle.writeBuf = i2c_send_buf;
i2c_transaction_handle.writeCount = send_buf_len;
i2c_transaction_handle.readBuf = i2c_recv_buf;
i2c_transaction_handle.readCount = recv_buf_len;
i2c_transaction_handle.timeout = I2C_TIMEOUT_MS;
//i2c_transaction_handle.controllerMode = true;
//i2c_transaction_handle.expandSA = false;
status = I2C_transfer(i2c_handle, &i2c_transaction_handle);
if (status != I2C_STS_SUCCESS)
{
status = I2C_recoverBus(gI2cHandle[CONFIG_I2C0], I2C_TIMEOUT_MS);
}
memset(i2c_tx_buf, 0, I2C_BUF_SIZE); // Clear the I2C Tx buffer
return status;
}
这是用于 I2C 的 SysConfig: 
我还应该注意的是、在我更改了 ${MCU+SDK}/source/drivers/i2c/v0/i2c_v0.c.中 I2C_OPEN ()函数的这一行之前、MCU_I2C0没有正确初始化

我 将 I/O 连接到 I2C、让它在这个新的 MCU+SDK 版本上运行会非常好。
感谢您的帮助!

