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.

This commit is contained in:
László Monda
2018-01-14 17:59:41 +01:00
parent 217f0b3bdb
commit 9fbf2bbf08

View File

@@ -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;