cancel
Showing results for 
Search instead for 
Did you mean: 

I2C speed on STM32F303KT8

baptor
Associate III
Posted on March 01, 2018 at 22:25

Hi everybody, I would require some help on an I2C link between TSL2591 and my nucleo nano F303K8T6.

I did it working well  on the mbed website TSL2591_F3, but I want to use SW4STM32 environment and also CUBEMX.

Using my scope I can see that on in mbed configuration that I have I2S clk and data that can be decoded :

0690X00000609s1QAA.png

but when I use my code ( was working fine on e stm32F411re ), I get this signal :

0690X00000609s6QAA.png

I kept the same time base to show you the speed difference.

I generate my project using cubemx and in the system clock configuration, I have this config :

0690X00000609qLQAQ.png

In the top right corner I can see the I2C clock speed at 8MHz, I would like to change it but I do not find any solution to reach 100kHz.

Can I get the system clock configuration from mbed at any way ?

Thanks for your help.

Baptiste

Well, after a lot of investigation, I had a look at the nucleo f303K8T6 schematic. This board is delivered with straps between I2C and SPI signals, the after removing it, it worked well.

#stm32f303k8t6 #i2c #speed
3 REPLIES 3
Posted on March 01, 2018 at 23:06

>>

Can I get the system clock configuration from mbed at any way ?

If you can read memory, read the peripheral register content and print it out.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Bill Dempsey
Senior
Posted on March 01, 2018 at 23:37

In CubeMx be sure to go over to the 'Configuration' tab and then select I2C from the peripherals.  In there you can set the clock speed.  By default it should be prescaling the 8MHz clock down to operate the I2C bus at 100kHz.

As stated above, dump out the registers and look up their values in the Reference Manual to confirm what settings you really have on your board.

Posted on March 02, 2018 at 09:46

Hi, I moved forward on this problem. I forgot to mention that I also use a SPI link at a 2MHz. I changed the SPI link speed to 100kHz, then I got the I2C link moving from 2MHz to 100Khz. Well that is fine, but the polarity of the signals are not the same in spi and I2C. so If I have spi working, I2C will not work... I tried to to make a spi init before use spi, then a I2C init before using I2C in my while loop. But It still do not write the good I2C data on the line.