70074E I2c Can
70074E I2c Can
HIGHLIGHTS
This section of the manual contains the following topics:
37
Appendix A: I2C™ Overview................................................................................................. 37-2
Appendix B: CAN Overview................................................................................................ 37-12
Appendix
Appendix C: CODEC Protocol overview ............................................................................. 37-25
Appendix
SCL S P
MSb LSb
S R/W ACK
S Start Condition
R/W Read/Write pulse
ACK Acknowledge
Sent By Slave
= 0 for write
S - Start Condition
R/W - Read/Write Pulse
ACK - Acknowledge
Data
Output by
Transmitter
Data not acknowledge
37
Output by
Receiver
SCL from acknowledge
Master
Appendix
1 2 8 9
S
Start Clock Pulse for
Condition Acknowledgment
If the master is receiving the data (master-receiver), it generates an Acknowledge signal for
each received byte of data, except for the last byte. To signal the end of data to the
slave-transmitter, the master does not generate an acknowledge (not acknowledge). The slave
then releases the SDA line so the master can generate the Stop condition. The master can also
generate the Stop condition during the Acknowledge pulse for valid termination of data transfer.
If the slave needs to delay the transmission of the next byte, holding the SCL line low forces the
master into a wait state. Data transfer continues when the slave releases the SCL line. This
allows the slave to move the received data or fetch the data it needs to transfer before allowing
the clock to start. This wait state technique can also be implemented at the bit level (refer to
Figure A-5).
SDA
MSb Acknowledgment Acknowledgment
Signal from Receiver Byte Complete Signal from Receiver
Interrupt with Receiver
Figure A-6 and Figure A-7 illustrate master-transmitter and master-receiver data transfer
sequences.
When a master does not wish to relinquish the bus (which occurs by generating a Stop
condition), a repeated Start condition (Sr) must be generated. This condition is identical to the
Start condition (SDA goes high-to-low, while SCL is high), but occurs after a data transfer
Acknowledge pulse (not the bus-free state). This allows a master to send “commands” to the
slave and then receive the requested information or to address a different slave device, as
Figure A-8 illustrates.
(read or write)
(n bytes + acknowledge)
37
S Slave Address R/W A Data A/A Sr Slave Address R/W A Data A/A P
Appendix
Transfer direction of data and acknowledgment bits depends on R/W bits.
Combined format:
Sr Slave Address R/W A Slave Address A Data A Data A/A Sr Slave Address R/W A Data A Data A P
(Code + A9:A8) (A7:A0) (Code + A9:A8)
(write) (read)
Combined format - A master addresses a slave with a 10-bit address, then transmits
data to this slave and reads data from this slave.
A.4 Multi-master
The I2C protocol allows a system to have more than one master. This is called a multi-master
system. When two or more masters try to transfer data at the same time, arbitration and
synchronization occur.
A.4.1 Arbitration
Arbitration takes place on the SDA line, while the SCL line is high. The master which transmits a
high when the other master transmits a low, loses arbitration (refer to Figure A-9) and turns off
its data output stage. A master which lost arbitration can generate clock pulses until the end of
the data byte where it lost arbitration. When the master devices are addressing the same
device, arbitration continues into the data.
DATA 2
SDA
SCL
Masters that also incorporate the slave function, and have lost arbitration must immediately
switch over to Slave-receiver mode. This is because the winning master-transmitter may be
addressing it.
Arbitration is not allowed between:
• A repeated Start condition
• A Stop condition and a data bit
• A repeated Start condition and a Stop condition
Care needs to be taken to ensure that these conditions do not occur.
Clock synchronization occurs after the devices have started arbitration. This is performed using
a wired-AND connection to the SCL line. A high-to-low transition on the SCL line causes the
concerned devices to start counting off their low period. Once a device clock has gone low, it
holds the SCL line low until its SCL high state is reached. The low-to-high transition of this clock
may not change the state of the SCL line if another device clock is still within its low period. The
SCL line is held low by the device with the longest low period. Devices with shorter low periods
enter a high wait-state until the SCL line comes high. When the SCL line comes high, all
devices start counting off their high periods. The first device to complete its high period will pull
the SCL line low. The SCL line high time is determined by the device with the shortest high
period (refer to Figure A-10).
37
Figure A-10: Clock Synchronization
Appendix
State High Period
CLK 1
Counter
CLK 2 Reset
SCL
Table A-2 and Table A-3 show the specifications of a compliant I2C bus. The column titled,
Parameter No., is provided to ease the user’s correlation to the corresponding parameter in the
device data sheet. Figure A-11 and Figure A-12 show these times on the appropriate
waveforms.
SCL
91 93
90 92
SDA
Start Stop
Condition Condition
SDA MSb
Out
Appendix
90 TSU:STA Start condition setup 100 kHz mode 4.7 — μs Only relevant for repeated
time 400 kHz mode 0.6 — μs Start condition
91 THD:STA Start condition hold 100 kHz mode 4.0 — μs After this period the first
time 400 kHz mode 0.6 — μs clock pulse is generated
106 THD:DAT Data input hold time 100 kHz mode 0 — ns
400 kHz mode 0 0.9 μs
107 TSU:DAT Data input setup time 100 kHz mode 250 — ns Note 2
400 kHz mode 100 — ns
92 TSU:STO Stop condition setup 100 kHz mode 4.7 — μs
time 400 kHz mode 0.6 — μs
109 TAA Output valid from 100 kHz mode — 3500 ns Note 1
clock 400 kHz mode — 1000 ns
110 TBUF Bus free time 100 kHz mode 4.7 — μs Time the bus must be free
400 kHz mode 1.3 — μs before a new transmission
can start
D102 Cb Bus capacitive loading — 400 pF
Note 1: As a transmitter, the device must provide this internal minimum delay time to bridge the undefined region
(min. 300 ns) of the falling edge of SCL to avoid unintended generation of Start or Stop conditions.
2: A Fast mode I2C-bus device can be used in a Standard mode I2C-bus system, but the requirement
TSU;DAT ≥ 250 ns must then be met. This automatically is the case if the device does not stretch the LOW
period of the SCL signal. If such a device does stretch the LOW period of the SCL signal, it must output the
next data bit to the SDA line,
TR max.+TSU; DAT = 1000 + 250 = 1250 ns (according to the Standard mode I2C bus specification) before
the SCL line is released.
For bus arbitration, CSMA/CD with NDA is used (Carrier Sense Multiple Access/Collision
Detection with Non-Destructive Arbitration). If bus node A wants to transmit a message across
the network, it first checks that the bus is in the Idle state (“Carrier Sense“) (i.e., no node is
currently transmitting). If this is the case (and no other node wishes to start a transmission at the
same moment), node A becomes the bus master and sends its message. All other nodes switch
to Receive mode during the first transmitted bit (Start-Of-Frame bit). After correct reception of
the message (which is acknowledged by each node), each bus node checks the message
identifier and stores the message, if required. Otherwise, the message is discarded.
If two or more bus nodes start their transmission at the same time (“Multiple Access”), collision
of the messages is avoided by bitwise arbitration (“Collision Detection/Non-Destructive
Arbitration” together with the “Wired-AND” mechanism, “dominant” bits override “recessive”
bits). Each node sends the bits of its message identifier (MSB first) and monitors the bus level. 37
A node that sends a recessive identifier bit but reads back a dominant one loses bus arbitration
and switches to Receive mode. This condition occurs when the message identifier of a
competing node has a lower binary value (dominant state = logic 0) and therefore, the
Appendix
competing node is sending a message with a higher priority. In this way, the bus node with the
highest priority message wins arbitration without losing time by having to repeat the message.
All other nodes automatically try to repeat their transmission once the bus returns to the Idle
state. It is not permitted for different nodes to send messages with the same identifier as
arbitration could fail leading to collisions and errors.
The original CAN specifications (versions 1.0, 1.2 and 2.0A) defined the message identifier as
having a length of 11 bits giving a possible 2048 message identifiers. The specification has
since been updated (to version 2.0B) to remove this possible limitation. CAN specification,
version 2.0B, allows message identifier lengths of 11 and/or 29 bits to be used (an identifier
length of 29 bits allows over 536 Million message identifiers). Version 2.0B CAN is also referred
to as “Extended CAN”, and versions 1.0, 1.2 and 2.0A are referred to as “Standard CAN”.
Those data frames and remote frames, which only contain the 11-bit identifier, are called
standard frames according to CAN specification V2.0A. With these frames, 2048 different
messages can be identified (identifiers 0-2047). However, the 16 messages with the lowest
priority (2032-2047) are reserved. Extended frames, according to CAN specification V2.0B,
have a 29-bit identifier. As already mentioned, this 29-bit identifier is made up of the 11-bit
identifier (“Base lD”) and the 18-bit Extended identifier (“ID Extension”).
CAN modules specified by CAN V2.0A are only able to transmit and receive standard frames
according to the Standard CAN protocol. Messages using the 29-bit identifier cause errors. If a
device is specified by CAN V2.0B, there is one more distinction. Modules named “Part B
Passive” can only transmit and receive standard frames, but tolerate extended frames without
generating error frames. “Part B Active” devices are able to transmit and receive both standard
and extended frames.
Full CAN devices do the whole bus protocol in hardware, including the acceptance filtering and
the message management. They contain several so called message objects which handle the
identifier, the data, the direction (receive or transmit) and the information Standard
CAN/Extended CAN. During the initialization of the device, the host CPU defines which
messages are to be sent and which are received. The host CPU is informed by interrupt if the
identifier of a received message matches with one of the programmed (receive-) message
objects. In this way, the CPU load is reduced. Using Full CAN devices, high baud rates and high
bus loads with many messages can be handled. These chips are more expensive than the
Basic CAN devices, though.
Many Full CAN chips provide a “Basic-CAN Feature”. One of their messages objects can be
programmed in a way that every message is stored there that does not match with one of the
other message objects. This can be very helpful in a number of applications.
Session
Transport
Network 37
Data Link Layer
Supervisor
Appendix
LLC (Logical Link Control)
Acceptance Filtering
Overload Notification
Recovery Management
Physical Layer
Appendix
are limited by delay times, and/or electrical loads on the bus line.
17. Single Channel – The bus consists of a single channel that carries bits. From this data
resynchronization, information can be derived. The way in which this channel is
implemented is not fixed in this specification (i.e., single wire (plus ground), two differential
wires, optical fires, etc.).
18. Bus values – The bus can have one of two complementary logical values; ‘dominant’ or
‘recessive’. During simultaneous transmission of ‘dominant’ and ‘recessive’ bits, the
resulting bus value is ‘dominant’. For example, in case of a wired-AND implementation of
the bus, the ‘dominant’ level would is represented by a logical ‘0’ and the ‘recessive’ level
by a logical ‘1’. Physical states (e.g., electrical voltage, light) that represent the logical
levels are not given in the specification.
19. Acknowledgment – All receivers check the consistency of the message being received
and will acknowledge a consistent message and flag an inconsistent message.
20. Sleep Mode; Wake-up – To reduce the system's power consumption, a CAN device may
be set into Sleep mode without any internal activity and with disconnected bus drivers.
The Sleep mode is finished with a wake-up by any bus activity or by internal conditions of
the system. On wake-up, the internal activity is restarted, although the MAC sub-layer will
be waiting for the system's oscillator to stabilize and it will then wait until it has
synchronized itself to the bus activity (by checking for eleven consecutive ‘recessive’ bits),
before the bus drivers are set to “on-bus” again.
A data frame is generated by a node when the node wishes to transmit data. The Standard CAN
Data Frame is shown in Figure B-2. In common with all other frames, the frame begins with a
Start-Of-Frame bit (SOF – dominant state) for hard synchronization of all nodes.
The SOF is followed by the Arbitration field consisting of 12 bits, the 11-bit ldentifier (reflecting
the contents and priority of the message) and the RTR bit (Remote Transmission Request bit).
The RTR bit is used to distinguish a data frame (RTR – dominant) from a remote frame.
The next field is the Control field, consisting of 6 bits. The first bit of this field is called the lDE bit
(Identifier Extension) and is at dominant state to specify that the frame is a standard frame. The
following bit is reserved, RB0, and defined as a dominant bit. The remaining 4 bits of the Control
field are the Data Length Code (DLC) and specify the number of bytes of data contained in the
message.
The data being sent follows in the Data field, which is of the length defined by the DLC above
(1-8 bytes).
The Cyclic Redundancy field (CRC) follows and detects possible transmission errors. The CRC
field consists of a 15-bit CRC sequence, completed by the recessive CRC Delimiter bit.
The final field is the Acknowledge field. During the ACK Slot bit, the transmitting node sends out
a recessive bit. Any node that has received an error free frame acknowledges the correct
reception of the frame by sending back a dominant bit (regardless of whether the node is
configured to accept that specific message or not). From this, it can be seen that CAN belongs
to the “in-bit-response” group of protocols. The recessive Acknowledge Delimiter completes the
Acknowledge slot and may not be overwritten by a dominant bit.
Appendix
error frame consists of 2 fields, an error flag field followed by an error delimiter field. The error
delimiter that consists of 8 recessive bits and allows the bus nodes to restart bus
communications cleanly after an error. There are two forms of error flag fields. The form of the
error flag field depends an the error status of the node that detects the error.
If an error-active node detects a bus error then the node interrupts transmission of the current
message by generating an active error flag. The active error flag is composed of six consecutive
dominant bits. This bit sequence actively violates the bit stuffing rule. All other stations
recognize the resulting bit stuffing error and generates error frames themselves, called error
echo flags. The error flag field therefore consists of between six and twelve consecutive
dominant bits (generated by one or more nodes). The error delimiter field completes the error
frame. After completion of the error frame, bus activity returns to normal and the interrupted
node attempts to resend the aborted message.
If an error passive node detects a bus error, then the node transmits an error passive flag
followed again by the error delimiter field. The error passive flag consists of six consecutive
recessive bits, and therefore the error frame for an error passive node consists of 14 recessive
bits. From this, it follows that, unless the bus error is detected by the bus master node that is
actually transmitting, the transmission of an error frame by an error passive node will not affect
any other node on the network. If the bus master node generates an error passive flag, then this
may cause other nodes to generate error frames due to the resulting bit stuffing violation. After
transmission of an error frame, an error passive node must wait for 6 consecutive recessive bits
on the bus before attempting to rejoin bus communications.
90 90
90 90
90 90
3
90 90
INT
90 90
90 90
90 90
90 90
90 90
8
90 90
Transmit
Suspend
90 90
90 90
90 90
90 90
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
90 90
Inter-Frame Space
90 90
90 90
90 90
bus Idle
90 90
90 90
90 90
0
1 1 1 0
90 90 Start-Of-Frame Start-Of-Frame
90 90 ID 10
90 90
90 90
90 90
90 90
Filtering
Message
11
90 90
12
90 90
Data Frame or
Remote Frame
Identifier
90 90 ID3
90 90
Arbitration Field
Stored in Buffers
90 90
90 90 ID0
90 90 RTR
90 90 IDE
Reserved Bits
0 0 0
90 90 RB0
90 90 DLC3
6
Field
90 90
4
Data
Control
Code
90 90
Length
90 90 DLC0
90 90
90 90
90 90
90 90
8
90 90
90 90
90 90
90 90
90 90
90 90
90 90
Bit Stuffing
90 90
Data Field
90 90
8N (≤ N ≤ 8)
90 90
90 90
Stored in Transmit/Receive Buffers
90 90
90 90
8
90 90
90 90
90 90
Data Frame (number of bits = 44 + 8N)
0 0 0 0 0 0 0 0
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
15
90 90
CRC
16
90 90
90 90
CRC Field
90 90
90 90
90 90
90 90
90 90
1
90 90 CRC Del
90 90 Acknowledgment
90 90 ACK Del
90 90
90 90
90 90
7
90 90
Frame
90 90
End-Of-
Any Frame
90 90
1 1 1 1 1 1 1 1
90 90
90 90
3
90 90
INT
90 90
90 90
90 90
90 90
90 90
8
90 90
Transmit
Suspend
90 90
90 90
90 90
90 90
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
90 90
90 90
Inter-Frame Space
90 90
90 90
bus Idle
90 90
90 90
90 90
1 1 1 0
90 90 Start-Of-Frame
90 90
90 90
90 90
90 90
90 90
90 90
90 90
Data Frame or
Remote Frame
90 90
90 90
90 90
Standard Data Frame Figure B-2:
dsPIC30F Family Reference Manual
70074E.fm Page 20 Wednesday, April 25, 2007 9:50 AM
DS70074E-page 37-21 © 2007 Microchip Technology Inc.
90 90
90 90
90 90
90 90
1 1
90 90
90 90
90 90
90 90
bus Idle
90 90
90 90
90 90
0
1 1 1 0
90 90 Start-Of-Frame Start-Of-Frame
90 90 ID10
90 90
90 90
90 90
90 90
90 90
11
90 90
Filtering
Data Frame or
Identifier
Remote Frame
Message
90 90 ID3
90 90
90 90
90 90 ID0
90 90 SRR
0 1
90 90 IDE
90 90 EID17
90 90
32
90 90
90 90
90 90
Stored in Buffers
Arbitration Field
90 90
90 90
90 90
90 90
18
90 90
90 90
90 90
90 90
Extended Identifier
90 90
90 90
90 90
90 90
90 90 EID0
90 90 RTR
90 90 RB1
Reserved bits
0 0 0
90 90 RB0
90 90 DLC3
6
Bit Stuffing
Field
90 90
4
Data
Control
90 90
Code
Length
90 90 DLC0
90 90
90 90
90 90
90 90
8
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
Data Field
90 90
8N (≤ N ≤ 8)
90 90
Stored in Transmit/Receive Buffers
90 90
Data Frame (number of bits = 64 + 8N)
90 90
90 90
8
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
15
90 90
16
CRC
90 90
CRC Field
90 90
90 90
90 90
90 90
90 90
90 90 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 CRC Del
90 90 Acknowledgment
90 90 ACK Del
90 90
90 90
90 90
7
90 90
90 90
Frame
Any Frame
End-Of-
90 90
Appendix
1 1 1 1 1 1 1 1
90 90
90 90
90 90
INT
90 90
90 90
90 90
90 90
90 90
8
90 90
Transmit
Suspend
37
90 90
90 90
90 90
90 90
90 90
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
90 90
Inter-Frame Space
90 90
90 90
bus Idle
90 90
90 90
90 90
1 1 1 0
90 90 Start-Of-Frame
90 90
90 90
90 90
90 90
90 90
90 90
90 90
Data Frame or
Remote Frame
90 90
90 90
90 90
Extended Data Format Figure B-3:
Section 37. Appendix
70074E.fm Page 21 Wednesday, April 25, 2007 9:50 AM
© 2007 Microchip Technology Inc. DS70074E-page 37-22
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
Any Frame
90 90
90 90
90 90
90 90
3
INT
90 90
90 90
90 90
90 90
90 90
8
90 90
Transmit
Suspend
90 90
90 90
90 90
90 90
90 90
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
90 90
Inter-Frame Space
90 90
90 90
bus Idle
90 90
90 90
90 90
90 90
0
1 1 1 0
Start-Of-Frame Start-Of-Frame
90 90 ID 10
90 90
90 90
90 90
90 90
Filtering
Message
11
90 90
12
90 90
Data Frame or
Remote Frame
90 90
Identifier
90 90
Arbitration Field
Stored in Buffers
90 90
90 90 ID0
90 90 RTR
90 90 IDE
90 90 Reserved Bits
1 0 0
RB0
90 90 DLC3
6
Field
90 90
4
Data
Control
90 90
Code
Length
90 90 DLC0
Bit Stuffing
90 90
90 90
90 90
90 90
90 90
90 90
90 90
15
90 90
CRC
16
90 90
90 90
CRC Field
90 90
90 90
Remote Frame (number of bits = 44)
90 90
90 90
90 90
90 90
1
CRC Del
90 90 Acknowledgment
90 90 ACK Del
90 90
90 90
90 90
7
90 90
90 90
Frame
End-Of-
Any Frame
90 90
90 90
1 1 1 1 1 1 1 1
90 90
90 90
3
INT
90 90
90 90
90 90
90 90
90 90
8
90 90
Transmit
Suspend
90 90
90 90
90 90
90 90
90 90
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
90 90
Inter-Frame Space
90 90
90 90
bus Idle
90 90
90 90
90 90
90 90
1 1 1 0
Start-Of-Frame
90 90
90 90
90 90
90 90
90 90
90 90
90 90
Data Frame or
Remote Frame
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
Remote Data Frame Figure B-4:
dsPIC30F Family Reference Manual
70074E.fm Page 22 Wednesday, April 25, 2007 9:50 AM
DS70074E-page 37-23 © 2007 Microchip Technology Inc.
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
Any Frame
90 90
90 90
90 90
90 90
3
INT
90 90
90 90
90 90
90 90
90 90
8
90 90
Transmit
Suspend
90 90
90 90
90 90
90 90
90 90
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
90 90
Inter-Frame Space
90 90
90 90
bus Idle
90 90
90 90
90 90
90 90
0
1 1 1 0
Start-Of-Frame Start-Of-Frame
90 90
90 90 ID 10
90 90
90 90
90 90
90 90
11
12
90 90
Data Frame or
Remote Frame
90 90
Filtering
Identifier
Message
90 90 ID3
Arbitration Field
90 90
90 90 ID0
90 90
RTR
90 90
90 90 Reserved Bits IDE
0 0 0
RB0
90 90
DLC3
6
90 90
Field
4
Data
90 90
Control
Code
Length
90 90 DLC0
90 90
90 90
Bit Stuffing
90 90
90 90
8
90 90
90 90
Interrupted Data Frame
90 90
90 90
90 90
90 90
90 90
90 90
Data Field
90 90
8N (≤ N ≤ 8)
90 90
90 90
90 90
Data Frame or
Remote Frame
90 90
8
90 90
90 90
90 90
90 90
6
90 90
Flag
Error
90 90
90 90
90 90
0 0 0 0 0 0 0
90 90
90 90 ≤6
Flag
90 90
Error
Echo
90 90
90 90
90 90
90 90
Error Frame
90 90
90 90
8
Error
90 90
90 90
Delimiter
Any Frame
90 90
90 90
90 90
0 0 1 1 1 1 1 1 1 1 0
90 90
INT
90 90
90 90
Appendix
90 90
90 90
90 90
8
90 90
Transmit
Suspend
90 90
Inter-Frame Space
90 90
90 90
90 90
90 90
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
37
90 90
Inter-Frame Space
90 90
90 90
bus Idle
90 90
90 90
90 90
90 90
1 1 1 0
Start-Of-Frame
90 90
90 90
90 90
90 90
90 90
90 90
90 90
Data Frame or
Remote Frame
90 90
90 90
90 90
90 90
90 90
90 90
90 90
90 90
Error Frame Figure B-5:
Section 37. Appendix
70074E.fm Page 23 Wednesday, April 25, 2007 9:50 AM
70074E.fm Page 24 Wednesday, April 25, 2007 9:50 AM
Appendix
• Digital input/output interfaces
This Appendix information is intended to supplement the I2S Protocol Specification®, which is
published by Philips, Inc.
The I2S bus is a time division multiplexed and transfers two channels of data. These two data
channels are typically the left and right channels of a digital audio stream.
The I2S bus has the following connection pins:
• SCK: The I2S serial clock line
• SDx: The I2S serial data line (input or output)
• WS: The I2S word select line
Figure C-2A is a timing diagram for a data transfer. Serial data is transmitted on the I2S bus in
two’s complement format with the MSb transmitted first. The MSb must be transferred first
because the protocol allows different transmitter and receiver data word lengths. If a receiver is
sent more bits than it can accept for a data word, the LSbits are ignored. If a receiver is sent
fewer bits than its native word length, it must set the remaining LSbits to zero internally.
The WS line indicates the data channel transmitted. The following standard is used:
• WS = 0: Channel 1 or left audio channel
• WS = 1: Channel 2 or right audio channel
The WS line is sampled by the receiver on the rising edge of SCK and the MSb of the next data
word is transmitted one SCK period after WS changes. The one period delay after WS changes
provides the receiver time to store the previously transmitted word and prepare for the next
word. Serial data sent by the transmitter is placed on the bus on the falling edge of SCK and is
latched by the receiver on the rising edge of SCK.
Any device may act as the system master in an I2S system. The system master generates the
SCK and WS signals. Typically, the transmitter is the system master, but the receiver or a third
device may perform this function. Figure C-1 shows possible I2S bus configurations. Although it
is not indicated in Figure C-1, the two connected devices may have both a data transmit and a
data receive connection.
SCK
WS
I2S Transmitter I2S Receiver Transmitter master
SD
SCK
WS
I2S Transmitter I2S Receiver Receiver master
SD
I2S Controller
SCK
2 WS
I S Transmitter I2S Receiver Separate controller as master
SD
SCK
WS
Note: A 5 bit transfer is shown here for illustration purposes. The I2S protocol does
not specify word length – this is system dependent.
A 12.288 MHz BIT_CLK signal is provided by the master AC ’97 codec in a system. The
BIT_CLK signal is an input to the AC ’97 controller and up to three slave AC ’97 codec devices
in the system. All data on the AC-Link transitions on the rising edge of BIT_CLK and is sampled
by the receiving device on the falling edge of BIT_CLK.
SDO is a time division multiplexed data stream sent to the AC ’97 codec.
SDI is the time division multiplexed data stream from the AC ’97 codec. 37
C.3.4 SYNC
SYNC is a 48 kHz fixed rate sample synchronization signal that is supplied from the AC ’97
Appendix
controller to the AC ’97 codec. The SYNC signal is derived by dividing the BIT_CLK signal by
256. The SYNC signal is high for 16 BIT_CLK periods and is low for 240 BIT_CLK periods. The
SYNC signal only changes on the rising edge of BIT_CLK and its period defines the boundaries
of one audio data frame.
C.3.5 Reset
The RESET signal is an input to each AC ’97 codec in the system and resets the codec
hardware.
The AC-Link serial data stream uses a time division multiplexed (TDM) scheme with a 256-bit
data frame. Each data frame is subdivided into 13 time slots, numbered Slot #0 – Slot #12. Slot
#0 is a special time slot that contains 16 bits. The remaining 12 slots are 20-bits wide.
Figure C-4 is an example of an AC-Link frame. The frame begins with a rising edge of the
SYNC signal which is coincident with the rising edge of BIT_CLK. The AC ’97 codec samples
the assertion of SYNC on the falling edge of BIT_CLK that immediately follows. This falling
edge marks the time when both the codec and controller are aware of the start of a new frame.
On the next rising edge of BIT_CLK, the codec asserts the MSb of SDATA_IN and the codec
asserts the first edge of SDATA_OUT. This sequence ensures that data transitions and
subsequent sample points for both incoming and outgoing data streams are time aligned.
Slot #0, Slot #1 and Slot #2 have special use for status and control in the AC-Link protocol. The
remaining time slots are assigned to certain types of digital audio data. The data assignment for
Slot #3 – Slot #12 is dependent on the AC ’97 codec that is selected, so the slot usage is
summarized briefly here. For more details on slot usage, refer to the AC ’97 Component
Specification.
Slot #0 is commonly called the ‘tag frame’. The tag frame has a bit location for each data time
slot in the AC-Link protocol. These bits specify which time slots in a frame are valid for use by
the controller. A “1” in a given bit position of Slot #0 indicates that the corresponding time slot
within the current audio frame has been assigned to a data stream, and contains valid data. If a
slot is “tagged” invalid, it is the responsibility of the source of the data, (AC ’97 codec for the
input stream, AC ’97 controller for the output stream), to stuff all bit positions with 0s during the
slot’s active time.
There are also special bits in the tag frame. The MSb of the tag frame for SDATA_OUT is a
‘Frame Valid’ Status bit. The Frame Valid bit serves as a global indicator to the codec that at
least one time slot in the frame has valid data. If the entire frame is tagged invalid, the codec
can ignore all subsequent slots in the frame. This feature implements sample rates other than
48 kHz.
The two LSbs of the SDATA_OUT tag frame indicate the codec address. Up to four AC ’97
codecs may be connected in a system. If only one codec is used in a system, these bits remain
0’s.
The MSb of the SDATA_IN is used as a ‘Codec Ready’ Status bit. If this bit location is a ‘0’, then
the codec is powered down and/or not ready for normal operation. If the ‘Codec Ready’ bit is
set, it is the responsibility of the controller to query the status registers in the codec to see which
subsections are operable.
Slot #1 and Slot #2 also have special uses in the AC-Link protocol. These time slots are used
for address and data values when reading or writing the AC ’97 codec control registers. These
time slots must be tagged as valid in Slot #0 in order to read and write the control registers. The
AC ’97 Component Specification allows for sixty-four (64) 16-bit control registers in the codec.
Seven address bits are provided in the AC-Link protocol, but only even-numbered addresses
are used. The odd numbered address values are reserved.
Slot #1 and Slot #2 for the SDATA_OUT line are called the Command Address and Command
Data, respectively. The Command Address slot on the SDATA_OUT line is used to specify the
codec register address and to specify whether the register access will be a read or a write. The
Command Data slot on SDATA_OUT contains the 16-bit value that written to one of the codec
control registers. If a read of the codec registers is being performed, the Command Data bits are
set to ‘0’s.
Slot #1 and Slot #2 for the SDATA_IN line are called the Status Address and Status Data slots,
respectively. The Status Address time slot echoes the register address previously sent to the
codec. If this value is ‘0’, an invalid address was previously sent to the codec.
The Status Address time slot also has ten Slot Request bits. The Slot Request bits can be
manipulated by the codec for applications with variable sample rates.
The Status Data time slot returns 16-bit data read from the codec control/status registers.
Slot #3 in the SDATA_OUT signal is used for the composite digital audio left playback stream.
For sound card applications, this is typically the combined .WAV audio and MIDI synthesizer
output.
Slot #3 in the SDATA_IN signal is the left channel record data taken from the AC ’97 codec input
mixer.
Slot #4 in the SDATA_OUT signal is used for the composite digital audio right playback stream.
For sound card applications, this is typically the combined .WAV audio and MIDI synthesizer
output.
Slot #4 in the SDATA_IN signal is the right channel record data taken from the AC ’97 codec
input mixer.
Slot #5 in the SDATA_OUT signal is used for modem DAC data. The default resolution for
modem compatible AC ’97 codecs is 16 bits. As in all time slots, the unused bits in the slot are
set to ‘0’.
Slot #5 in the SDATA_IN signal is used for the modem ADC data.
C.4.7 Slot #6
Slot #6 in the SDATA_OUT signal is used for PCM Center Channel DAC data in 4 or 6-channel
sound configurations.
Slot #6 in the SDATA_IN signal is used for dedicated microphone record data. The data in this
slot allows echo cancellation algorithms to be used for speakerphone applications. 37
C.4.8 Slot #7
Appendix
Slot #7 in the SDATA_OUT signal is used for PCM Left Channel DAC data in 4 or 6-channel
sound configurations.
Slot #7 in the SDATA_IN signal is reserved for future use in the AC ’97 Component
Specification.
C.4.9 Slot #8
Slot #8 in the SDATA_OUT signal is used for PCM Right Channel DAC data in 4 or 6-channel
sound configurations.
Slot #8 in the SDATA_IN signal is reserved for future use in the AC ’97 Component
Specification.
C.4.10 Slot #9
Slot #9 in the SDATA_OUT signal is used for PCM LFE DAC data in 6-channel sound
configurations.
Slot #9 in the SDATA_IN signal is reserved for future use in the AC ’97 Component
Specification.
Slot #10 is used for the modem line 2 ADC and DAC data in modem compatible devices.
Slot #11 is used for the modem handset ADC and DAC data in modem compatible devices.
The bits in Slot #12 are used for reading and writing GPIO pins in the AC ’97 codec. The GPIO
pins are provided for modem control functions on modem compatible devices.
BIT_CLK
24.576
SYNC MHz
SDATA_OUT
AC ’97 AC ’97
Controller SDATA_IN
Codec
/RESET
256
16 20 20 20 20 20 20 20
SYNC
Codec Slot 1 Slot 2 Slot 3 Slot 4 Slot 5 Slot 6 Slot 7 Slot 8 Slot 9 Slot 10 Slot 11 Slot 12 ___ ___ ___
Ready Valid Valid Valid Valid Valid Valid Valid Valid Valid Valid Valid Valid
bits 11-2: On demand data request flags – 0 = send data, 1 = do NOT send data
Valid Slot 1 Slot 2 Slot 3 Slot 4 Slot 5 Slot 6 Slot 7 Slot 8 Slot 9 Slot 10 Slot 11 Slot 12 ___ Codec Codec
Frame Valid Valid Valid Valid Valid Valid Valid Valid Valid Valid Valid Valid ID ID
R/W Reserved
37
bit Control Register Index (set to 0)
Appendix
SLOT#2: Command Data
bit 19 bit 4 bit 0
NOTES: