cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L476 I2C speed setting accurately?

jiayuan
Associate II
Posted on September 22, 2016 at 18:53

Hi there,

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!

Best,

Mike Wang

#!stm32-!clock
1 REPLY 1
slimen
Senior
Posted on September 26, 2016 at 09:20

Hi users,

Keeping responses in this duplicated [DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/STM32L476%20I2C%20speed%20setting%20accurately%204992&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=10]thread .

Regards