CY8C28xxx PSoC Programmable System-on-Chip TRM, Document No. 001-52594 Rev. *G
501
I
2
C
Bit 6: Lost Arb.
This bit is set when I
2
C bus contention is
detected, during a Master mode transfer. Contention will
occur when a master is writing a ‘1’ to the SDA output line
and reading back a ‘0’ on the SDA input line at the given
sampling point. When this occurs, the block immediately
releases the SDA, but continues clocking to the end of the
current byte. On the resulting byte interrupt, firmware can
determine that arbitration was lost to another master by
reading this bit.
The sequence occurs differently between Master transmitter
and Master receiver. As a transmitter, the contention will
occur on a data bit. On the subsequent Byte Complete inter-
rupt, the Lost Arbitration status is set. In Receiver mode, the
contention will occur on the ACK bit. The master that NAKed
the last reception will lose the arbitration. However, the
hardware will shift in the next byte in response to the win-
ning master’s ACK, so that a subsequent Byte Complete
interrupt occurs. At this point, the losing master can read the
Lost Arbitration status. Contention is checked only at the
eight data bit sampling points and one ACK bit sampling
point.
Bit 5: Stop Status.
Stop status is set on detection of an I
2
C
Stop condition. This bit is sticky, which means that it will
remain set until a ‘0’ is written back to it by the firmware.
This bit may only be cleared if the Byte Complete status is
set. If the Stop Interrupt Enable bit is set, an interrupt is also
generated on Stop detection. It is never automatically
cleared.
Using this bit, a slave can distinguish between a previous
Stop or Restart on a given address byte interrupt. In Master
mode, this bit may be used in conjunction with the Stop IE
bit, to generate an interrupt when the bus is free. However,
in this case, the bit must have previously been cleared prior
to the reception of the Stop to cause an interrupt.
Bit 4: ACK.
This control bit defines the acknowledge data
bit that is transmitted out in response to a received byte.
When receiving, a Byte Complete interrupt is generated
after the eighth data bit is received. On the subsequent write
to this register to continue (or terminate) the transfer, the
state of this bit will determine the next bit of data that is
transmitted. It is
. A ‘1’ will send an ACK and a
‘0’ will send a NAK.
A Master receiver normally terminates a transfer, by writing
a ‘0’ (NAK) to this bit. This releases the bus and automati-
cally generates a Stop condition. A Slave receiver may also
send a NAK, to inform the master that it cannot receive any
more bytes.
Bit 3: Address.
This bit is set when an address has been
received. This consists of a Start or Restart, and an address
byte. This bit applies to both master and slave.
In Slave mode, when this status is set, firmware will read the
received address from the data register and compare it with
its own address. If the address does not match, the firmware
will write a NAK indication to this register. No further inter-
rupts will occur, until the next address is received. If the
address does match, firmware must ACK the received byte,
then Byte Complete interrupts are generated on subsequent
bytes of the transfer.
This bit will also be set when address transmission is com-
plete in Master mode. If a lost arbitration occurs during the
transmission of a master address (indicated by the Lost Arb
bit), the block will revert to Slave mode if enabled. This bit
then signifies that the block is being addressed as a slave.
If Slave mode is not enabled, the Byte Complete interrupt
will still occur to inform the master of lost arbitration.
Bit 2: Transmit.
This bit sets the direction of the shifter for
a subsequent byte transfer. The shifter is always shifting in
data from the I
2
C bus, but a write of ‘1’ enables the output of
the shifter to drive the SDA output line. Because a write to
this register initiates the next transfer, data must be written
to the data register prior to writing this bit. In Receive mode,
the previously received data must have been read from the
data register before this write. In Slave mode, firmware
derives this direction from the RW bit in the received slave
address. In Master mode, the firmware decides on the direc-
tion and sets it accordingly.
This direction control is only valid for data transfers. The
direction of address bytes is determined by the hardware,
depending on the Master or Slave mode.
The Master transmitter terminates a transfer by writing a
zero to the transmit bit. This releases the bus and automati-
cally sends a Stop condition, or a Stop/Start or Restart,
depending on the I2C_MSCR control bits.
Bit 1: LRB (Last Received Bit).
This is the last received
bit in response to a previously transmitted byte. In Transmit
mode, the hardware will send a byte from the data register
and clock in an acknowledge bit from the receiver. On the
subsequent byte complete interrupt, firmware will check the
value of this bit. A ‘0’ is the ACK value and a ‘1’ is a NAK
value. The meaning of the LRB depends on the current
operating mode.
Master Transmitter:
‘0’: ACK.
The slave has accepted the previous byte.
The master may send another byte by first writing the
byte to the I2C_DR register and then setting the Transmit
bit in the I2C_SCR register. Optionally, the master may
clear the Transmit bit in the I2C_SCR register. This will
automatically send a Stop. If the Start or Restart bits are
set in the I2C_MSCR register, the Stop may be followed
by a Start or Restart.
‘1’: NAK.
The slave cannot accept any more bytes. A
Stop is automatically generated by the hardware on the
subsequent write to the I2C_SCR register (regardless of
the value written). However, a Stop/Start or Restart con-
dition may also be generated, depending on whether
Summary of Contents for CY8C28 series
Page 65: ...64 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G RAM Paging ...
Page 125: ...124 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G ...
Page 311: ...310 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G IDAC_CR0 1 FDh ...
Page 317: ...316 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G ...
Page 393: ...392 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G ...
Page 477: ...476 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G Digital Clocks ...
Page 561: ...560 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G ...