Skip to content

Small clarifications to the ULP I2C peripheral documentation about what is possible (and what's not). (IDFGH-15254) #15917

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/en/api-reference/system/ulp-risc-v.rst
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ Once the RTC I2C controller is initialized, the I2C slave device address must be

.. note::

The RTC I2C peripheral always expects a slave sub-register address to be programmed via the :cpp:func:`ulp_riscv_i2c_master_set_slave_reg_addr` API. If it is not, the I2C peripheral uses the ``SENS_SAR_I2C_CTRL_REG[18:11]`` as the sub-register address for the subsequent read or write operations. This could make the RTC I2C peripheral incompatible with certain I2C devices or sensors which do not need any sub-register to be programmed.
The RTC I2C peripheral can issue two kinds of I2C transactions: 1) READ: [start]->write one byte ("register")->[repeated start]->read N bytes->[stop] and 2) WRITE: [start]->write one byte ("register")->write N bytes->[stop]. Sending of the "register" byte is required and unavoidable. As such the peripheral always expects a slave sub-register address to be programmed via the :cpp:func:`ulp_riscv_i2c_master_set_slave_reg_addr` API. If it is not, the I2C peripheral uses the ``SENS_SAR_I2C_CTRL_REG[18:11]`` as the sub-register address for the subsequent read or write operations. This makes the RTC I2C peripheral incompatible with certain I2C devices or sensors which require a READ transaction without a WRITE transaction or which need a register pointer of 16 bits or wider.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to reformat this note even a bit more.

Suggested change
The RTC I2C peripheral can issue two kinds of I2C transactions: 1) READ: [start]->write one byte ("register")->[repeated start]->read N bytes->[stop] and 2) WRITE: [start]->write one byte ("register")->write N bytes->[stop]. Sending of the "register" byte is required and unavoidable. As such the peripheral always expects a slave sub-register address to be programmed via the :cpp:func:`ulp_riscv_i2c_master_set_slave_reg_addr` API. If it is not, the I2C peripheral uses the ``SENS_SAR_I2C_CTRL_REG[18:11]`` as the sub-register address for the subsequent read or write operations. This makes the RTC I2C peripheral incompatible with certain I2C devices or sensors which require a READ transaction without a WRITE transaction or which need a register pointer of 16 bits or wider.
The RTC I2C peripheral issues two kinds of I2C transactions:
1) **READ**: [start] → write one byte ("register") → [repeated start] → read N bytes → [stop]
2) **WRITE**: [start] → write one byte ("register") → write N bytes → [stop]
In both cases, sending the "register" byte 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.
This behavior makes the RTC I2C peripheral incompatible with:
- Devices that expect a read transaction without a preceding "register" address write.
- Devices requiring 16-bit or wider register addresses, since only 8-bit addressing is supported.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am totally fine as long as the clarification remains (i.e. what's possible and what's not).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, I already took this PR in our internal repo. It is in review now.


.. note::

Expand Down