16. USART 2
A96G140/A96G148/A96A148 User’s manual
204
When UCPHA=0, the slave begins to drive its MISO2 output with the first data bit value when SS goes
to active low. The first XCK edge causes both the master and the slave to sample the data bit value on
their MISO2 and MOSI inputs, respectively.
At the second XCK edge, the USART2 shifts the second data bit value out to the MOSI and MISO2
outputs of the master and slave, respectively. Unlike the case of UCPHA=1, when UCPHA=0, the
slave’s SS input must go to its inactive high level between transfers. This is
because the slave can
prepare the first data bit when it detects falling edge of SS input.
Figure 109. SPI Clock Formats when UCPHA = 1
When UCPHA=1, the slave begins to drive its MISO2 output when SS2 goes active low, but the data is
not defined until the first XCK edge. The first XCK edge shifts the first bit of data from the shifter onto
the MOSI2 output of the master and the MISO2 output of the slave.
The next XCK edge causes both the master and the slave to sample the data bit value on their MISO2
and MOSI2 inputs, respectively.
At the third XCK edge, the USART2 shifts the second data bit value out to the MOSI2 and MISO2 output
of the master and slave respectively. When UCPHA=1, the slave’s SS input is not required to go to its
inactive high level between transfers.
Because an SPI logic reuses the USART2 resources, SPI mode of operation is similar to that of
synchronous or asynchronous operation. An SPI transfer is initiated by checking for USART2 Data
Register Empty flag (UDRE=1) and then by writing a byte of data to the UDATA Register.
XCK
(UCPOL=1)
MISO2
MOSI2
XCK
(UCPOL=0)
/SS2 OUT
(MASTER)
BIT7
BIT0
/SS2 IN
(SLAVE)
BIT6
BIT1
…
…
BIT2
BIT5
BIT0
BIT7
BIT1
BIT6
SAMPLE
MSB First
LSB First