
V PeRiPheRaL MoDuLes 3 (inteRFaCe): i2s inteRFaCe (i2s)
V-4-12
ePson
s1C33L17 teChniCaL ManuaL
V.4.5 Data output Control (Ch.0)
The following shows audio data output procedure:
1. Set up the I2S conditions as described in the previous section.
2. Set up the interrupt conditions as described in the previous section. Also the ITC registers must be set up (ex-
plained later).
3. Write 1 to the I2SEN0 (D8/pI2S_CONTRL_CH0 register) to turn the I2S CH.0 circuit on.
The I2S CH.0 circuit starts frequency division of the source clock.
i2sen0: I2S Ch.0 Enable Bit in the I2S CH.0 Control (pI2S_CONTRL_CH0) Register (D8/0x00301C00)
4. Set the output channel mode using CHMD[1:0] (D[1:0]/pI2S_CONTRL_CH0 register).
ChMD[1:0]: I2S CH.0 Output Channel Mode Select Bits in the I2S CH.0 Control (pI2S_CONTRL_CH0)
Register (D[1:0]/0x00301C00)
Table V.4.5.1 Selecting Output Channel Mode
ChMD[1:0]
output channel mode
L channel
R channel
0x3
Mute
0
0x2
Mono (L)
Data output
0
0x1
Mono (R)
0
Data output
0x0
Stereo
Data output
(Default: 0x0)
The output channel mode can be switched even if data is being output. In this case, the mode changes after the
current word output has finished.
5. Write the first audio data to the FIFO.
The 24-bit register pI2S_FIFO_CH0 (0x00301C20) is used to write the output data to the FIFO. Up to four ste-
reo data (24 or 16 bits
× 2 channels (L & R) × 4) can be written to the FIFO regardless of the data size. Before
starting audio data output, fill the FIFO with the first four stereo data.
With 16-bit data, use a 16-bit memory write (ld.h [%rb], %rs) or a 32-bit memory write (ld.w [%rb],
%rs) instruction to write data. Note that 8-bit memory write instructions cannot be used with 16-bit data. With
16-bit memory write instructions, the FIFO address is 0x301c20 for the Left channel (ld.h [0x20], %rs)
and 0x301c22 for the Right channel (ld.h [0x22], %rs). With 32-bit memory write instructions, one
memory access will write both Left and Right channel data, and the FIFO address is 0x301c20 (ld.w [0x20],
%rs).
With 24-bit data, use a 32-bit memory write (ld.w [%rb], %rs) instruction to write data. Note that 8-bit
and 16-bit memory write instructions cannot be used with 24-bit data.
First write L-channel data, then R-channel data. Both channel data must be written as a pair even if “mono” is
selected as the output channel mode.
When four stereo data is written to the FIFO, the FIFO becomes full and the I2SFIFOFF0 flag (D1/
pI2S_FIFO_STATUS register) is set to 1. Note that the newest data of the FIFO is overwritten if data is written
to pI2S_FIFO_CH0 in this status.
i2sFiFoFF0:I2S CH.0 FIFO Full Flag in the I2S FIFO Status (pI2S_FIFO_STATUS) Register (D1/
0x00301C14)
6. Write 1 to I2SOUTEN (D4/pI2S_CONTRL_CH0 register) to enable I2S output.
i2souten: I2S CH.0 Output Enable Bit in the I2S CH.0 Control (pI2S_CONTRL_CH0) Register (D4/
0x00301C00)
When I2SOUTEN = 0, the I2S_MCLK_O and I2S_WS_O pins are fixed at 0. The I2S_SDO pin is left un-
changed. The I2S_SCK_O pin is fixed at 0 (when BCLKPOL0 (D6/pI2S_CONTRL_CH0 register) = 0) or 1
(when BCLKPOL0 = 1).
When I2SOUTEN is set to 1, all output pins enter standby status.
BCLKPoL0: I2S CH.0 Output Bit Clock Polarity Select Bit in the I2S CH.0 Control (pI2S_CONTRL_CH0)
Register (D6/0x00301C00)