From 9fbf2bbf085a065a96fb6b2db11d03c3112bf7ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Sun, 14 Jan 2018 17:59:41 +0100 Subject: [PATCH] Iterate mult of I2C_MasterSetBaudRate from 0 to 2 instead of just 0. This allows for a more accurate actual I2C frequency. Make sure not to use repeated start because of the related silicon bug. --- devices/MK22F51212/drivers/fsl_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devices/MK22F51212/drivers/fsl_i2c.c b/devices/MK22F51212/drivers/fsl_i2c.c index d46ed5e..4aca3b5 100644 --- a/devices/MK22F51212/drivers/fsl_i2c.c +++ b/devices/MK22F51212/drivers/fsl_i2c.c @@ -562,7 +562,7 @@ void I2C_MasterSetBaudRate(I2C_Type *base, uint32_t baudRate_Bps, uint32_t srcCl /* Search for the settings with the lowest error. Mult is the MULT field of the I2C_F register, * and ranges from 0-2. It selects the multiplier factor for the divider. */ - for (mult = 0u; (mult <= 0u) && (bestError != 0); ++mult) + for (mult = 0u; (mult <= 2u) && (bestError != 0); ++mult) { multiplier = 1u << mult;