Setting I2Cclock dividers
I2C规范对I2C时钟脉冲的高电平和低电平周期设置了限制。
为了满足这些限制,可以对QUP寄存器I2C_CLK_CTL进行编程,以设置I2C时钟分频器。
1、Defaultvalues
如果hs_div不为0,如何计算fs_div和hs_div的默认值:
I2C_FS_CLK =I2C_CLK/(fs_div+hs_div+6)
100K transfer rateas example:
19.2M (CXO)/100K(transfer rate) = fs_div+hs_div+6 fs_div+hs_div = 186
通常 fs_div = 2hs_div
这就是为什么默认是: 124/62 under 100K transfer rate.
Output clock frequency
FS divider
HS divider
100 kHz
124
62
400 kHz
28
14
1 MHz
8
5
Other non-standard frequency
OEM必须使用以上的公式计算FS和HS分配器。
2、Setvalues
时钟分频器值可以在不同的电路板上有所不同,以满足I2C规范限制。 您可以使用以下DTS字段覆盖驱动程序中设置的默认值:
i2c_2: i2c@f9924000 { /*BLSP1 QUP1 */
//snip
qcom,fs-clk-div = <28>;
qcom,high-time-clk-div =<14>;
};
The FS divider value is responsible for the LOW period (Tlow). Reducingit by 1 shortens Tlow by 52 ns (assuming the source clock is TCXO 19.2 MHz).
3、Dividersvs clock frequency
SCL期间计算如下:
T = TCXO * ( (FS_DIV+HT_DIV) +6 + NR) + Trise
where
TCXO is 52ns
NR is Noise Rejection level
Trise is SCL Rise time
Trise将> 0,因此输出时钟(1 / T)将小于我们设置的时钟(例如400 kHz)。
Output clock isless than 400 kHz due to added rise time
Output clock is 400 kHz due to excluded rise time
分频比FS_DIV / HTD应为2:1。 调整分频值以保持该比例并获得较小的和,以便可以生成更高的输出时钟。
例:
100K transfer rateas example:
19.2M (CXO)/100K(transfer rate) = fs_div+hs_div+6
fs_div+hs_div =186
The defaultfs_div/hs_div is: 124/62 under 100K transfer rate.
If OEMs want to achieve a longer output clock hightime, they can change the hs_div to 63 or a larger value, so that fs_div shouldbe (186 – hs_div) = 123, and vice versa, they can change the hs_div to asmaller value.
例如:
图