cancel
Showing results for 
Search instead for 
Did you mean: 

Which value for I2C clock speed in STSW-IMG023 Ultra Lite Driver (ULD) Example for F401RE?

VNava.1
Associate III

Studying the example application in the STSW-IMG 023 software I noticed that in the main.c file in the static void MX_I2C1_Init (void) function a clock speed equal to 1000000 (10 ^ 6) is configured, but if I go to the CubeMX file from where the project was generated I read 100000 kbit / s instead (10^5). Is it correct?

0693W00000NqM9VQAV.png 

If in the main.c file I wrote 10^5 instead of 10^6, the application does not work correctly. Only 10^6 work correctly. Can you help me understand why? Moreover, in the comment on the field init.ClockSpeed I read "This parameter must be set to a value lower than 400kHz"

I was using version 1.3.0, but this fact is also present in 1.3.1

1 ACCEPTED SOLUTION

Accepted Solutions
VNava.1
Associate III

UPDATE: This fact is not present in 1.3.1, I checked again and I saw that in this case the I2C clock speed is set to 400k, but always in the CubeMX there is 100k.

I have done some tests and have drawn some conclusions that I have yet to verify via the API ULD manual. 100 kbit/s is not enough for my application in case I choose to use 8x8 resolution. To work with 8x8 resolution I have to use 400k. I think the 1M value is not accepted by the API and is understood as if it were 400k, for this reason, I was saying that using 1M, my application worked (But I do not understand why in the 1.3.0 version there is 1M as speed).

In conclusion, I think that in the case of 8x8 resolution we need to use the maximum speed allowed (400kbit/s) and we need to check with an oscilloscope if the I2C clock is clean with good rising and falling edge, especially if we use wiring connection and no routes in a PCB.

If I found some other important information in the UM of the API I will update this post.

Thank you

View solution in original post

1 REPLY 1
VNava.1
Associate III

UPDATE: This fact is not present in 1.3.1, I checked again and I saw that in this case the I2C clock speed is set to 400k, but always in the CubeMX there is 100k.

I have done some tests and have drawn some conclusions that I have yet to verify via the API ULD manual. 100 kbit/s is not enough for my application in case I choose to use 8x8 resolution. To work with 8x8 resolution I have to use 400k. I think the 1M value is not accepted by the API and is understood as if it were 400k, for this reason, I was saying that using 1M, my application worked (But I do not understand why in the 1.3.0 version there is 1M as speed).

In conclusion, I think that in the case of 8x8 resolution we need to use the maximum speed allowed (400kbit/s) and we need to check with an oscilloscope if the I2C clock is clean with good rising and falling edge, especially if we use wiring connection and no routes in a PCB.

If I found some other important information in the UM of the API I will update this post.

Thank you