PNX1300/01/02/11 Data Book
Philips Semiconductors
16-6
PRELIMINARY SPECIFICATION
during this acknowledge period. The master must always
generate the SCL transitions for the acknowledge bit
time.
Two types of data transfers are supported by the
PNX1300 I
C interface:
Data transfer from a master transmitter to a slave
receiver, also called a WRITE operation. The master
first transmits a 1-byte slave address, then the
desired number of data bytes. The slave receiver
returns an acknowledge bit after each byte. The mas-
ter terminates the transaction by a STOP after the
last byte.
Data transfer from slave transmitter to master
receiver, also called a READ operation. The first byte
(the slave address) is transmitted by the master and
acknowledged by the slave. The selected slave
transmits successive data bytes which are each
acknowledged by the master, except the last byte
desired by the master, for which the master gener-
ates a
‘
notack
’
condition. This causes the slave to
terminate byte transmission. The slave transmitter
then must release the bus so that the master may
generate a STOP condition.
The type of transaction is indicated by the LSbit of the ad-
dress byte. Data transfer from a master transmitter to a
slave receiver is called a WRITE. It is signified by a
‘
0
’
in
the LSbit of the address byte. Data transfer from a slave
transmitter to a master receiver is called a READ. It is
signified by a
‘
1
’
in the LSBit of the address byte.
Example steps for successful programming of the I
2
C in-
terface on PNX1300 are outlined as follows for both
reads and writes. Enable the I
2
C interface prior to at-
tempting any accesses to external I
2
C devices.
To enable the interface:
Set bit IIC_CR.ENABLE (0x10340c) = 1
For write addressing mode:
1. On entry, clear any possible I
2
C interrupt sources by
writing IIC_CR bits [25:22] =
‘
1111
’
. (Note that pro-
grammers must mask and enable high-level interrupt
sources through the VIC facility in the DSPCPU. See
the appropriate PNX1300 databook chapter).
2. Enable desired I
2
C interrupt sources by setting
IIC_CR[31:28] bits appropriately.
3. Simultaneously load IIC_AR[31:25] with 7-bit slave
address, IIC_AR.DIRECTION = 0 and IIC_AR[15:8]
with the appropriate bytecount for the transfer.
4. Load IIC_DR[31:0] with data for the write. Note that
writing this register triggers the transfer across the I
2
C
bus.Up to 4 bytes will be transferred after writing, de-
pendent on bytecount in IIC_AR[8:15}.Transfers of
more than 4 bytes have to be done by breaking them
down into a sequence of 4-byte transfers and a last
transfer which may be less than 4 bytes. This is done
by repeatedly reloading the register until the byte-
count is fulfilled. Transfer is done high byte first, pro-
ceeding to low byte.
5. Detect I
2
C resulting condition code in IIC_SR[31:28]
and respond - OR - Detect I
C high level interrupt and
respond. (Note that this last step is dependent upon
system software requirements).
6. If transfer count is not yet fulfilled, clear GDI and FI
bits and proceed with step iv) until all data is written.
For read addressing mode:
1. On entry, clear any possible I
2
C interrupt sources by
writing IIC_CR bits [25:22] =
‘
1111
’
. (Note that pro-
grammers must mask and enable high level interrupt
sources through the VIC facility in the DSPCPU. See
the appropriate databook chapter).
2. Enable desired I
2
C interrupt sources by setting
IIC_CR[31:28] bits appropriately.
3. Simultaneously load IIC_AR[31:25] with 7-bit slave
address, IIC_AR.DIRECTION = 1 and IIC_AR[15:8]
with the appropriate bytecount for the transfer. Note
that writing this register triggers the read across the
I
2
C bus.
4. Detect I
2
C resulting condition in IIC_SR[31:28] and
respond - OR - Detect I
2
C interrupt and respond.
(Note that this last step is dependent upon system
software requirements.)
5. Clear GDI and FI bits and read the contents of
IIC_DR. Up to 4 bytes will be available in IIC_DR, fe-
ver if the remaining bytecount was less than 4. Bytes
are stored high byte first, proceeding to low byte.
6. Proceed with step iv) until all data is read, i.e byte-
count is fulfilled.
16.6.1
Slave NAK
If a slave device does not generate an ACK where re-
quired, this is considered a NAK. Upon receipt of a NAK
after transmitting a device address or data byte, the mas-
ter takes the following actions:
the I
2
C state becomes IDLE (STATE = 000)
a STOP condition is issued on the bus
no more data is sent
SDA
SCL
S
P
START
STOP
Figure 16-4. START and STOP Conditions on I
2
C