This commit is contained in:
renpeiying
2025-05-14 17:20:49 +08:00
parent 1fa908a7a5
commit 8e4da0b71c
2 changed files with 13 additions and 3 deletions

View File

@ -244,8 +244,8 @@ Once the RTC I2C controller is initialized, the I2C slave device address must be
The RTC I2C peripheral issues two kinds of I2C transactions:
- **READ**: [start] → write device address → write device sub-register address → [repeated start] → write device address → read N bytes → [stop]
- **WRITE**: [start] → write device address → write device sub-register address → [repeated start] → write device address → write N bytes → [stop]
- **READ**: [start] → write device address → write device sub-register address → [repeated start] → write device address → read N bytes → [stop]
- **WRITE**: [start] → write device address → write device sub-register address → [repeated start] → write device address → write N bytes → [stop]
In both cases, sending the sub-register address is required and cannot be disabled. Therefore, the peripheral always expects a slave sub-register address to be set using the :cpp:func:`ulp_riscv_i2c_master_set_slave_reg_addr` API. If it is not set explicitly, the peripheral uses the value in ``SENS_SAR_I2C_CTRL_REG[18:11]`` as the sub-register address for subsequent transactions.

View File

@ -242,7 +242,17 @@ RTC I2C 控制器提供了在 RTC 电源域中作为 I2C 主机的功能。ULP R
.. note::
RTC I2C 外设首先将检查 :cpp:func:`ulp_riscv_i2c_master_set_slave_reg_addr` API 是否将从机子寄存器地址编入程序。如未编入I2C 外设将以 ``SENS_SAR_I2C_CTRL_REG[18:11]`` 作为后续读写操作的子寄存器地址。这可能会导致 RTC I2C 外设与某些无需对子寄存器进行配置的 I2C 设备或传感器不兼容。
RTC I2C 外设发起两种类型的 I2C 事务:
- **读取 (READ)** [start] → 写入设备地址 → 写入设备子寄存器地址 → [repeated start] → 写入设备地址 → 读取 N 字节 → [stop]
- **写入 (WRITE)** [start] → 写入设备地址 → 写入设备子寄存器地址 → [repeated start] → 写入设备地址 → 写入 N 字节 → [stop]
在这两类事务中,都必须发送子寄存器的地址,且不能禁用此行为。因此,该外设始终需要通过 :cpp:func:`ulp_riscv_i2c_master_set_slave_reg_addr` API 显式地设置从设备的子寄存器地址。如未显式设置,该外设会使用 ``SENS_SAR_I2C_CTRL_REG[18:11]`` 中的值作为后续事务的子寄存器地址。
正因此, RTC I2C 外设不兼容以下情况:
- 不期望在读写事务前写入子寄存器地址的设备;
- 需要 16 位或更宽的寄存器地址的设备,因为该外设仅支持 8 位地址访问。
.. note::