Variable I2C speed

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
pacr_284376
Level 5
Level 5
100 replies posted 10 solutions authored 50 sign-ins

I need to change the I2C speed while running my program. For example first check on low-speed which slaves are present, and if these slaves are all high-speed I would like to use high speed for the further communication.

   

I do this by defining 2 I2C components (I2C_Slow and I2C_Fast) and multiplexing between them as indicated in "Figure 8 : I2C Bus Sharing". This example is for slaves but it also works for masters. 

   

For the future, I would like to use a more  flexible way to change the I2C speed of the master.

   

I cannot find and API to change to i2c rate. Am I overlooking it ? I did find the possibility to use external clocking but this seems rather complex.

   

I'm using PSOC5LP and PSOC Creator 3.3SP1 with I2C Version 3.5

   

Thanks

   

Patrick

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Patrick, I am afraid that the external clock will be the one and only solution, but it is probably not as complicated as you think. You may use a PWM to get clock divider between 2 and 255,

   

 

   

Bob

View solution in original post

0 Likes
4 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Patrick, I am afraid that the external clock will be the one and only solution, but it is probably not as complicated as you think. You may use a PWM to get clock divider between 2 and 255,

   

 

   

Bob

0 Likes
pacr_284376
Level 5
Level 5
100 replies posted 10 solutions authored 50 sign-ins

Ok, thanks. I'll give it a try. I also found the I2C_IntClock_SetDividerRegister function that I might give a try.

0 Likes

Hi, Patrick,

   

I did try I2C_IntClock_SetDividerRegister, it doesn't work for me, how about your side?

   

I did use CY_SET_REG8(CYDEV_CLKDIST_MSTR0,x), looks work.

   

Richard

0 Likes
pacr_284376
Level 5
Level 5
100 replies posted 10 solutions authored 50 sign-ins

Thanks for the answer, Richard. I now closed that part of the software and kept it as is. As soon as I continue on that part, I'll share my results

0 Likes