Skip to content

Commit 16d3e99

Browse files
authored
Merge pull request #14915 from arduino/i2c_timing_fix
STM32 Fix i2c_compute_timing() API
2 parents 9a59145 + ccf8995 commit 16d3e99

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

targets/TARGET_STM/i2c_api.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,6 +1733,9 @@ uint32_t i2c_compute_timing(uint32_t clock_src_freq, uint32_t i2c_freq)
17331733
uint32_t speed;
17341734
uint32_t idx;
17351735

1736+
/* Reset valid timing count at the beginning of each new computation */
1737+
I2c_valid_timing_nbr = 0;
1738+
17361739
if ((clock_src_freq != 0U) && (i2c_freq != 0U)) {
17371740
for (speed = 0 ; speed <= (uint32_t)I2C_SPEED_FREQ_FAST_PLUS ; speed++) {
17381741
if ((i2c_freq >= I2C_Charac[speed].freq_min) &&

0 commit comments

Comments
 (0)