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

fix(PeriphDrivers): Calculate I3C timeout based on data size #1296

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

ttmut
Copy link
Contributor

@ttmut ttmut commented Dec 13, 2024

Description

Default timeout values used for transactions fall short on large data transfers. Use data size and SCL frequency to calculate a proper timeout value.

Below formulas are used to come up with rough estimations.
timeout = (40 * period_in_us) * writeCount
timeout = (80 * period_in_us) * readCount

@ttmut ttmut changed the title fix(PeriphDrivers)Calculate I3C read timeout based on input size and SCL frequency fix(PeriphDrivers): Calculate I3C read timeout based on read size Dec 13, 2024
@ttmut ttmut marked this pull request as draft December 13, 2024 17:06
@ttmut ttmut changed the title fix(PeriphDrivers): Calculate I3C read timeout based on read size fix(PeriphDrivers): Calculate I3C timeout based on data size Dec 16, 2024
@ttmut ttmut marked this pull request as ready for review December 16, 2024 10:02
@@ -612,7 +616,9 @@ int MXC_I3C_RevA_Controller_Transaction(mxc_i3c_reva_regs_t *i3c, const mxc_i3c_
goto err;
}

ret = MXC_I3C_RevA_WriteTXFIFO(i3c, req->tx_buf, req->tx_len, true, 100);
timeout = (uint32_t)(40 * 1000000 / freq) * req->tx_len;
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be helpful to add a comment on what the formula is or how this timeout calculation was derived.

Default timeout values used during transactions fall short on large data
transfers. Use SCL frequency and data size to calculate a dynamic
timeout value.

Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
@sihyung-maxim
Copy link
Contributor

Will merge after Alperen reviews.

@sihyung-maxim sihyung-maxim merged commit 1d174f0 into main Dec 16, 2024
13 checks passed
@sihyung-maxim sihyung-maxim deleted the fix/i3c_timeout branch December 16, 2024 22:57
sihyung-maxim pushed a commit to analogdevicesinc/hal_adi that referenced this pull request Dec 16, 2024
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.

3 participants