I got an issue recently when I was trying to set up the I2C speeds for STM32L476RG. I can set it up for an approximate value but never get the exact one. For example, I want to achieve 100 kHz while I can only achieve 104 kHz. I found it has something to do with the tsync value which come from the SCL internal detection delay. In the I2C control Register I can set up PRESC, SCLL, SCLH, SDADEL and SCLDEL, while I can do nothing with tsync. On page 1145 of reference manual (Rev.4), I found some example of the register settings for L4 to reach certain speeds, however the values given in the examples varies quite a lot (what was given is a range actually) and I couldn't find out the exact value of tsync1+ tsync2. I believe this value will affect the I2C speed if we don’t set it correctly.
There is some additional info I found in the AN4235 discussing about what the I2C duration depends on, but there is no explanation to determine the exact tsync1+tsync2..
I also tried the excel version I2C timing tool for the F4 family since there isn't one available for the L4 family. This tool can generate some value but I can't see the calculation behind it so it doesn't help a lot..
Thanks advance for the help!