@@ -47,38 +47,37 @@ extern "C" {
47
47
#define I2CAPI_I2C1_CLKSRC RCC_I2C1CLKSOURCE_SYSCLK
48
48
#define I2CAPI_I2C2_CLKSRC RCC_I2C2CLKSOURCE_SYSCLK
49
49
#define I2CAPI_I2C3_CLKSRC RCC_I2C3CLKSOURCE_SYSCLK
50
- #define I2CAPI_I2C4_CLKSRC RCC_I2C4CLKSOURCE_SYSCLK
51
50
52
51
/* Provide the suitable timing depending on requested frequency */
53
52
static inline uint32_t get_i2c_timing (int hz )
54
53
{
55
54
uint32_t tim = 0 ;
56
- if (SystemCoreClock == 80000000 ) {
57
- // Common settings: I2C clock = 80 MHz, Analog filter = ON, Digital filter coefficient = 0
55
+ if (SystemCoreClock == 64000000 ) {
56
+ // Common settings: I2C clock = 64 MHz, Analog filter = ON, Digital filter coefficient = 0
58
57
switch (hz ) {
59
58
case 100000 :
60
- tim = 0x30C14E6B ; // Standard mode with Rise Time = 400ns and Fall Time = 100ns
59
+ tim = 0x10707DBC ; // Standard mode with Rise Time = 400ns and Fall Time = 100ns
61
60
break ;
62
61
case 400000 :
63
- tim = 0x10D1143A ; // Fast mode with Rise Time = 250ns and Fall Time = 100ns
62
+ tim = 0x00602173 ; // Fast mode with Rise Time = 250ns and Fall Time = 100ns
64
63
break ;
65
64
case 1000000 :
66
- tim = 0x00810E27 ; // Fast mode Plus with Rise Time = 60ns and Fall Time = 100ns
65
+ tim = 0x00300B29 ; // Fast mode Plus with Rise Time = 60ns and Fall Time = 100ns
67
66
break ;
68
67
default :
69
68
break ;
70
69
}
71
- } else if (SystemCoreClock == 48000000 ) {
72
- // Common settings: I2C clock = 48 MHz, Analog filter = ON, Digital filter coefficient = 0
70
+ } else if (SystemCoreClock == 32000000 ) {
71
+ // Common settings: I2C clock = 32 MHz, Analog filter = ON, Digital filter coefficient = 0
73
72
switch (hz ) {
74
73
case 100000 :
75
- tim = 0x20A03E55 ; // Standard mode with Rise Time = 400ns and Fall Time = 100ns
74
+ tim = 0x00707CBB ; // Standard mode with Rise Time = 400ns and Fall Time = 100ns
76
75
break ;
77
76
case 400000 :
78
- tim = 0x10800C21 ; // Fast mode with Rise Time = 250ns and Fall Time = 100ns
77
+ tim = 0x00300F38 ; // Fast mode with Rise Time = 250ns and Fall Time = 100ns
79
78
break ;
80
79
case 1000000 :
81
- tim = 0x00500816 ; // Fast mode Plus with Rise Time = 60ns and Fall Time = 100ns
80
+ tim = 0x00100413 ; // Fast mode Plus with Rise Time = 60ns and Fall Time = 100ns
82
81
break ;
83
82
default :
84
83
break ;
0 commit comments