29.01.2015 Views

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Inter-integrated circuit (I 2 C) interface<br />

RM0008<br />

Closing the communication<br />

Note:<br />

After writing the last byte to the DR register, the STOP bit is set by software to generate a<br />

Stop condition (see Figure 235 Transfer sequencing EV8_2). The interface goes<br />

automatically back to slave mode (M/SL bit cleared).<br />

Stop condition should be programmed during EV8_2 event, when either TxE or BTF is set.<br />

Figure 235. Transfer sequence diagram for master transmitter<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Master receiver<br />

Following the address transmission <strong>and</strong> after clearing ADDR, the I 2 C interface enters<br />

Master Receiver mode. In this mode the interface receives bytes from the SDA line into the<br />

DR register via the internal shift register. After each byte the interface generates in<br />

sequence:<br />

● An acknowledge pulse if the ACK bit is set<br />

● The RxNE bit is set <strong>and</strong> an interrupt is generated if the ITEVFEN <strong>and</strong> ITBUFEN bits are<br />

set (see Figure 236 Transfer sequencing EV7).<br />

If the RxNE bit is set <strong>and</strong> the data in the DR register is not read before the end of the last<br />

data reception, the BTF bit is set by hardware <strong>and</strong> the interface waits until BTF is cleared by<br />

a read in the SR1 register followed by a read in the DR register, stretching SCL low.<br />

632/995 Doc ID 13902 Rev 9

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

Saved successfully!

Ooh no, something went wrong!