User manual
...the world's most energy friendly microcontrollers
2012-04-24 - Giant Gecko Family - d0053_Rev0.96 418
www.energymicro.com
I2Cn_CTRL must be reset. This should be done regardless of whether the slave is going to be re-enabled
or not.
16.3.4 Clock Generation
The SCL clock signal generated by the I
2
C master determines maximum transmission rate on the bus.
The clock is generated as a division of the peripheral clock, and is given by Equation 16.2 (p. 418) :
I
2
C Maximum Transmission Rate
f
SCL
= f
HFPERCLK
/(((N
low
+ N
high
) x (DIV + 1)) + 4) (16.2)
N
low
and N
high
specify the number of prescaled clock cycles in the low and high periods of the clock
signal respectively. The worst case low and high periods of the signal are:
I
2
C High and Low Cycles Equations
T
high
= (N
high
x (DIV + 1) + 3)/f
HFPERCLK
T
low
= (N
low
x (DIV + 1)+ 3)/f
HFPERCLK
(16.3)
The values of N
low
and N
high
and thus the ratio between the high and low parts of the clock signal is
controlled by CLHR in the I2Cn_CTRL register. The available modes are summarized in Table 16.2 (p.
418) along with the highest I
2
C-bus frequencies in the given modes that can be achieved without
violating the timing specifications of the I
2
C-bus. The frequencies are calculated taking the maximum
allowed rise and fall times of SDA and SCL into account. Higher frequencies may be achieved in
practice. The 3 extra cycles are synchronization, and must be taken into consideration when DIV in the
I2Cn_CLKDIV register has a low value.
Note
DIV must be 1 or higher when slave is enabled.
Table 16.2. I
2
C Clock Modes
Mode CLHR N
low
: N
high
Sm max
frequency
Fm max
frequency
Fm+ max
frequency
STANDARD 0 4:4 93 kHz 313 kHz 806 kHz
ASYMMETRIC 1 6:3 75 kHz 392 kHz 980 kHz
FAST 2 14:9 79 kHz 383 kHz 987 kHz
16.3.5 Arbitration
Arbitration is enabled by default, but can be disabled by setting the ARBDIS bit in I2Cn_CTRL. When
arbitration is enabled, the value on SDA is sensed after each time the I
2
C module attempts to change
its value. If the sensed value is different than the value the I
2
C module tried to output, it is interpreted as
a simultaneous transmission by another device, and the I
2
C module has lost arbitration.
Whenever arbitration is lost, the ARBLOST interrupt flag in I2Cn_IF is set, any lines held are released,
and the I
2
C device goes idle. If an I
2
C master loses arbitration during the transmission of an address,
another master may be trying to address it. The master therefore receives the rest of the address, and
if the address matches the slave address of the master, the master goes into either slave transmitter
or slave receiver mode.
Note
Arbitration can be lost both when operating as a master and when operating as a slave.