2022-05-20 07:22 AM
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?
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
Solved! Go to Solution.
2022-05-20 10:34 AM
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
2022-05-20 10:34 AM
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