The TWI supports several transmission modes with different frequency limitations:
Standard mode (Sm) up to 100
kHz
Fast mode (Fm) up to 400 kHz
Fast mode Plus (Fm+) up to 1
MHz
Write the Host Baud Rate (TWIn.MBAUD) register to a value that will result in a TWI
bus clock frequency equal to or less than those frequency limits, depending on the
transmission mode.
The low (tLOW) and high (tHIGH) times are determined by the Host Baud Rate (TWIn.MBAUD) register, while
the rise (tR) and fall (tOF) times are determined by
the bus topology.
Figure 29-3. SCL Timing
tLOW is the low period of the SCL clock
tHIGH is the high period of the SCL
clock
tR is determined by the bus impedance; for
internal pull-ups. Refer to the Electrical Characteristics section for
details.
tOF is the output fall time and is determined
by the open-drain current limit and bus impedance. Refer to the Electrical
Characteristics section for details.
Properties of the SCL Clock
The SCL frequency is given
by:Equation 29-1. SCL Frequency
fSCL=1tLOW+tHIGH+tOF+tR[Hz]
The SCL clock is designed to have a 50/50 duty cycle, where the low portion of the
duty cycle is comprised of tOF and tLOW. tHIGH will
not start until a high state of SCL has been detected. The following formula shows
the relationship between the BAUD bit field in the TWIn.MBAUD register and the SCL
frequency:
Equation 29-2. SCL Frequency
fSCL=fCLK_PER10+2×BAUD+fCLK_PER×tR
Figure 3 can be transformed to express BAUD:Equation 29-3. BAUD
BAUD=fCLK_PER2×fSCL−(5+fCLK_PER×tR2)
Calculation of the BAUD Value
To ensure operation within the specifications of the desired speed mode
(Sm, Fm, Fm+), follow these steps:
Calculate a value for the
BAUD bit field using Figure 4.
Calculate tLOW
using the BAUD value from step 1:Equation 29-4. tLOW
tLOW=BAUD+5fCLK_PER−tOF
Check if tLOW from
Figure 5 is above the specified minimum of the desired mode (tLOW_Sm =
4700 ns, tLOW_Fm = 1300 ns, tLOW_Fm+ = 500 ns).
If the calculated
tLOW is above the limit, use the BAUD value from
Figure 4
If not meeting the
limit, calculate a new BAUD value using Figure 6 below, where tLOW_mode is either
tLOW_Sm, tLOW_Fm, or tLOW_Fm+
from the mode specifications: Equation 29-5. BAUD
BAUD=fCLK_PER×(tLOW_mode+tOF)−5
The online versions of the documents are provided as a courtesy. Verify all content and data in the device’s PDF documentation found on the device product page.