
EM358x
Rev. 0.4
91
Compatible with Philips’ I
2
C-bus slave devices
8.5.1
GPIO Usage
The TWI master controller uses just two signals:
SDA (Serial Data) – bidirectional serial data
SCL (Serial Clock) – bidirectional serial clock
Table 8-7 lists the GPIO pins used by the SC1 and SC2 TWI master controllers. Because the pins are configured
as open-drain outputs, they require external pull-up resistors.
Table 8-7. TWI Master GPIO Usage
SDA
SCL
Direction
Input / Output
Input / Output
GPIO Configuration
Alternate Output
(open drain)
Alternate Output
(open drain)
SC1 pin
PB1
PB2
SC2 pin
PA1
PA2
8.5.2
Set Up and Configuration
The TWI controller is enabled by writing 3 to the SCx_MODE register. The TWI controller operates only in master
mode and supports both Standard (100 kbps) and Fast (400 kbps) TWI modes. Address arbitration is not
implemented, so multiple master applications are not supported.
The TWI master controller’s serial clock (SCL) is produced by a programmable clock generator. SCL is produced
by dividing down 12 MHz according to this equation:
EXP
LIN
MHz
rate
2
*
)
1
(
12
EXP is the value written to the SCx_RATEEXP register and LIN is the value written to the SCx_RATELIN register.
Table 8-8 shows the rate settings for Standard-Mode TWI (100 kbps) and Fast-Mode TWI (400 kbps) operation.
Table 8-8. TWI Clock Rate Programming
Clock Rate
SCx_RATELIN
SCx_RATEEXP
100 kbps
14
3
375 kbps
15
1
400 kbps
14
1
Note:
At 400 kbps, the Philips I2C Bus specification requires the minimum low period of SCL to be 1.3 µs, but on
the EM358x it is 1.25 µs. If a slave device requires strict compliance with SCL timing, the clock rate must
be lowered to 375 kbps.
The EM358x supports clock stretching. The slave device can hold SCL low on any received or transmitted data
bit. This inhibits further data transfers until SCL is allowed to go high again.
8.5.3
Constructing Frames
The TWI master controller supports generating various frame segments by means of the SC_TWISTART,
SC_TWISTOP, SC_TWISEND, and SC_TWIRECV bits in the SCx_TWICTRL1 registers. Table 8-9 summarizes
these frames.
Содержание EMBER EM358 series
Страница 2: ...EM358x 2 Rev 0 4 ...
Страница 7: ...EM358x Rev 0 4 7 ...