01.06.2014 Views

STM32W108C8

STM32W108C8

STM32W108C8

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Serial interfaces<br />

<strong>STM32W108C8</strong><br />

The I 2 C master controller uses just two signals:<br />

●<br />

SDA (Serial Data) - bidirectional serial data<br />

● SCL (Serial Clock) - bidirectional serial clock<br />

Table 45 lists the GPIO pins used by the SC1 and SC2 I 2 C master controllers. Because the<br />

pins are configured as open-drain outputs, they require external pull-up resistors.<br />

Table 45.<br />

I 2 C Master GPIO Usage<br />

Parameter SDA SCL<br />

Direction Input / Output Input / Output<br />

GPIO configuration<br />

Alternate Output<br />

(open drain)<br />

Alternate Output<br />

(open drain)<br />

SC1 pin PB1 PB2<br />

SC2 pin PA1 PA2<br />

9.5.1 Setup and configuration<br />

The I 2 C controller is enabled by writing 3 to the SCx_MODE register. The I 2 C controller<br />

operates only in master mode and supports both Standard (100 kbps) and Fast (400 kbps)<br />

I 2 C modes. Address arbitration is not implemented, so multiple master applications are not<br />

supported.<br />

The I 2 C master controller's serial clock (SCL) is produced by a programmable clock<br />

generator. SCL is produced by dividing down 12 MHz according to this equation:<br />

Rate<br />

=<br />

----------------------------------------<br />

12MHz<br />

( LIN + 1)x2 EXP<br />

EXP is the value written to the SCx_RATEEXP register and LIN is the value written to the<br />

SCx_RATELIN register. I2C clock rate programming on page 81 shows the rate settings for<br />

Standard-Mode I 2 C (100 kbps) and Fast-Mode I 2 C (400 kbps) operation.<br />

Table 46.<br />

I 2 C clock rate programming<br />

Clock rate SCx_RATELIN SCx_RATEEXP<br />

100 kbps 14 3<br />

375 kbps 15 1<br />

400 kbps 14 1<br />

Note:<br />

At 400 kbps, the Philips I 2 C Bus specification requires the minimum low period of SCL to be<br />

1.3 µs, but on the STM32W108 it is 1.25 µs. If a slave device requires strict compliance with<br />

SCL timing, the clock rate must be lowered to 375 kbps.<br />

9.5.2 Constructing frames<br />

The I 2 C master controller supports generating various frame segments by means of the<br />

SC_TWISTART, SC_TWISTOP, SC_TWISEND, and SC_TWIRECV bits in the<br />

SCx_TWICTRL1 registers. Figure 47 summarizes these frames.<br />

81/215 Doc ID 018587 Rev 2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!