![FTDI FT51A Скачать руководство пользователя страница 45](http://html1.mh-extra.com/html/ftdi/ft51a/ft51a_application-note_2341158045.webp)
Application Note
AN_289 FT51A Programming Guide
Version 1.0
Document Reference No.: FT_000962 Clearance No.: FTDI# 483
44
Copyright © 2015 Future Technology Devices International Limited
2.5.5
I2CMTP
Bit
Position
Bit Field Name
Type
Reset
Description
7
HS_TIMER_SELECT
R/W
0
Set to select the timer period register
for HIGH speed I
2
C Master.
Clear for timer period register for
STANDARD, FAST and FAST+.
6..0
timer
R/W
0x01
Timer Period register.
Table 2.49 I
2
C Master Timer Period Register
F
scl
= F
clk
/ (2 * (1 + timer) * 10)
F
scl
– I2C Master clock frequency.
F
clk
– CPU system clock frequency.
timer – Timer period divider.
The I
2
C Master will automatically adopt the relevant I
2
C mode (STANDARD, FAST, FAST-
PLUS, HIGH-SPEED) depending on the SCL frequency calculated. The maximum
frequency is limited to the lesser of one tenth of the system clock frequency or
3,400,000Hz. This will support the standard I
2
C modes:
100 kbit/s standard
400 kbit/s Fast
1 Mbit/s Fast+
3.4 Mbit/s High Speed
If the system clock frequency is changed then the value in this register will need to be recalculated
to ensure correct operation.
2.5.6
Use Case
The I
2
C Master can process single bytes or bursts of an indeterminate length from the I
2
C Slave.
2.5.6.1
Interface Setup
To setup the I
2
C Master the following steps have to be performed:
The I
2
C Master must first be reset by writing a ‘1’ to the
RSTB
bit in the
I2CMCR register
.
Set the frequency via the
I2CMTP
register.
// Reset I2C Master block
I2CMCR |= 0x80;
__asm NOP __endasm;
// Set freqency
I2CMTP = 0x20;
__asm NOP __endasm;