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

mcu/stm32: Calculate I2C timing register #3112

Merged
merged 1 commit into from
Dec 4, 2023

Conversation

kasjer
Copy link
Contributor

@kasjer kasjer commented Nov 22, 2023

STM32 F1,F4,L1 do have ClockSpeed filed in I2C initialization API, so it easy to specify requested clock speed for I2C. For all other devices ST HAL does not provide such field and expect that TIMINGR register value is precomputed. This value is specified in each BSP and is likely incorrect for some of them.

This change introduces hic_speed to MCUs that has timing register and function that computes timing register base on requested speed and system clock.

If timing register is specified in settings it is still being used to to configure I2C. If timing register setting is 0 hic_speed is used.

STM32 F1,F4,L1 do have ClockSpeed filed in I2C initialization API,
so it easy to specify requested clock speed for I2C.
For all other devices ST HAL does not provide such field and
expect that TIMINGR register value is precomputed.
This value is specified in each BSP and is likely incorrect
for some of them.

This change introduces hic_speed to MCUs that has timing register and
function that computes timing register base on requested speed and system
clock.

If timing register is specified in settings it is still being used to
to configure I2C. If timing register setting is 0 hic_speed is used.

Signed-off-by: Jerzy Kasenberg <[email protected]>
@kasjer kasjer merged commit c801bb6 into apache:master Dec 4, 2023
15 checks passed
@kasjer kasjer deleted the kasjer/stm32-i2c-speed branch December 4, 2023 06:33
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.

2 participants