Skip to content
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

Remove code setting IC_DATA_CMD.RESTART bit #827

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jannic
Copy link
Member

@jannic jannic commented Aug 15, 2024

According to the datasheet, a restart is automatically triggered "if the transfer direction is changing from the previous command". The RESTART bit is only needed to trigger an unconditional RESTART sequence.

According to the contract of I2c::transaction, "Data from adjacent operations of the same type are sent after each other without an SP or SR" and "Between adjacent operations of a different type an SR and SAD+R/W is sent". This looks like it is exactly what the hardware provides out of the box.

(See: https://docs.rs/embedded-hal/1.0.0/ebedded_hal/i2c/trait.I2c.html#tymethod.transaction)

This fixes #825. Unfortunately, it breaks some of the on-target tests, which expect the additional restart conditions.

@jannic
Copy link
Member Author

jannic commented Aug 15, 2024

BTW, regarding the failing on-target tests, I already started to fix them.

@ithinuel
Copy link
Member

The change seem correct to me; And yes, updating the expected stop/restart of the on-target-test will be a bit tedious. It was a pain to figure in the first place because of how latency can cause several events to be merged/undicernable.

According to the datasheet, a restart is automatically triggered "if
the transfer direction is changing from the previous command". The
RESTART bit is only needed to trigger an unconditional RESTART sequence.

According to the contract of I2c::transaction, "Data from
adjacent operations of the same type are sent after each other without
an SP or SR" and "Between adjacent operations of a different type an SR
and SAD+R/W is sent". This looks like it is exactly what the hardware
provides out of the box.

(See: https://docs.rs/embedded-hal/1.0.0/ebedded_hal/i2c/trait.I2c.html#tymethod.transaction)
Some of the panic messages are longer than the default buffer, causing a lockup.
@jannic jannic marked this pull request as ready for review August 25, 2024 21:50
@jannic jannic requested a review from ithinuel August 25, 2024 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

I2C contract violation
2 participants