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 />
receive frame segment is determined with the SC_TWIACK bit in the SCx_TWICTRL2<br />
register.<br />
Figure 9.<br />
I 2 C segment transitions<br />
IDLE<br />
START Segment<br />
STOP Segment<br />
TRANSMIT Segment<br />
NO<br />
received ACK ?<br />
YES<br />
RECEIVE Segment<br />
with NACK<br />
RECEIVE Segment<br />
with ACK<br />
Generation of a 7-bit address is accomplished with one transmit segment. The upper 7 bits<br />
of the transmitted character contain the 7-bit address. The remaining lower bit contains the<br />
command type ("read" or "write").<br />
Generation of a 10-bit address is accomplished with two transmit segments. The upper 5<br />
bits of the first transmit character must be set to 0x1E. The next 2 bits are for the 2 most<br />
significant bits of the 10-bit address. The remaining lower bit contains the command type<br />
("read" or "write"). The second transmit segment is for the remaining 8 bits of the 10-bit<br />
address.<br />
Transmitted and received characters are accessed through the SCx_DATA register.<br />
To initiate (re)start and stop segments, set the SC_TWISTART or SC_TWISTOP bit in the<br />
SCx_TWICTRL1 register, then wait until the bit is clear. Alternatively, the SC_TWICMDFIN<br />
bit in the SCx_TWISTAT can be used for waiting.<br />
To initiate a transmit segment, write the data to the SCx_DATA data register, then set the<br />
SC_TWISEND bit in the SCx_TWICTRL1 register, and finally wait until the bit is clear.<br />
Alternatively the SC_TWITXFIN bit in the SCx_TWISTAT register can be used for waiting.<br />
To initiate a receive segment, set the SC_TWIRECV bit in the SCx_TWICTRL1 register, wait<br />
until it is clear, and then read from the SCx_DATA register. Alternatively, the SC_TWIRXFIN<br />
bit in the SCx_TWISTAT register can be used for waiting. Now the SC_TWIRXNAK bit in the<br />
SCx_TWISTAT register indicates if a NACK or ACK was received from an I 2 C slave device.<br />
83/215 Doc ID 018587 Rev 2