Skip to main content
sruthi
Associate II
May 31, 2018
Question

Is it possible to work I2C fast mode(400KHz) and USB FS together in STM32F103VCT6

  • May 31, 2018
  • 1 reply
  • 2209 views
Posted on May 31, 2018 at 15:05

I want to use I2C fast mode(400KHz) and USB full speed mode in parallel. My controller is STM32F103VCT6. In reference manual I had read that for USB we must use 48MHz clock and also for I2C fast mode communication  i2c clock frequency must be a multiple of 10MHz . I'm not able to set a sysclk compactable for these two peripherals. Is there any solution for this? Please help...

    This topic has been closed for replies.

    1 reply

    T J
    Senior III
    June 1, 2018
    Posted on June 01, 2018 at 02:17

    did you use the cubeMx ? it has a clock configuration visually, much easier to understand.

    if you have a cube file, please send it over, I can check your clocks

    sruthi
    sruthiAuthor
    Associate II
    June 1, 2018
    Posted on June 01, 2018 at 12:56

    Actually I'm working with Keiluv4. I'm not using cubeMx

    In reference manual RM0008 they had written, for i2c fast mode operation i2c clock frequency must be a multiple of 10MHz. To achieve this I had set SYSCLK 40MHz (HSE: 8MHz and PLL :5). Configured Duty bit as 1(in I2C_CCR register,Actually I didn't understand yet the purpose of duty bit. I have attached the images from RM0008) . I had tested with this configuration and I was able to get fast mode I2C frequency(400KHz ).

    But while integrating with USB full speed configuration I got stuck because USB

    requires 

    48MHz clk  frequency to work. Due to this I can only give sysclock 72MHz or 48MHz

    to make USB working. By changing sysclk to 72MHz I2C clock becomes 36MHz(not a multiple of 10MHz). Using this clock configuration I tested I2C fast mode again. But now my I2C clock frequency changed from 400KHz to 480KHz(Data transfer is working normal) . But my requirement is 400KHz . I want use USB also.....

    I believe that u are able to understand my problem now... Is there any solution for this....?

    I tested with 48MHz sysclk and I couldn't acquire 400KHz

    My requirement is I2C fast mode(400KHz) + USB full speed

    0690X0000060L4QQAU.png0690X0000060L4LQAU.png
    T J
    Senior III
    June 1, 2018
    Posted on June 01, 2018 at 13:48

    I made cube file for you...

    I changed the crystal many times, there is no solution for 48MHz USB and x10MHz IIC