I 2 S Master Mode - ST STM32G0 1 Series Reference Manual

Table of Contents

Advertisement

RM0444
1. This table gives only example values for different clock configurations. Other configurations allowing
optimum clock precision are possible.
2
35.7.5
I
S master mode
The I2S can be configured in master mode. This means that the serial clock is generated on
the CK pin as well as the Word Select signal WS. Master clock (MCK) may be output or not,
controlled by the MCKOE bit in the SPIx_I2SPR register.
Procedure
1.
Select the I2SDIV[7:0] bits in the SPIx_I2SPR register to define the serial clock baud
rate to reach the proper audio sample frequency. The ODD bit in the SPIx_I2SPR
register also has to be defined.
2.
Select the CKPOL bit to define the steady level for the communication clock. Set the
MCKOE bit in the SPIx_I2SPR register if the master clock MCK needs to be provided
to the external DAC/ADC audio component (the I2SDIV and ODD values should be
computed depending on the state of the MCK output, for more details refer to
Section 35.7.4: Clock
3.
Set the I2SMOD bit in the SPIx_I2SCFGR register to activate the I2S functions and
choose the I
through the DATLEN[1:0] bits and the number of bits per channel by configuring the
CHLEN bit. Select also the I
through the I2SCFG[1:0] bits in the SPIx_I2SCFGR register.
4.
If needed, select all the potential interrupt sources and the DMA capabilities by writing
the SPIx_CR2 register.
5.
The I2SE bit in SPIx_I2SCFGR register must be set.
WS and CK are configured in output mode. MCK is also an output, if the MCKOE bit in
SPIx_I2SPR is set.
Transmission sequence
The transmission sequence begins when a half-word is written into the Tx buffer.
Lets assume the first data written into the Tx buffer corresponds to the left channel data.
When data are transferred from the Tx buffer to the shift register, TXE is set and data
corresponding to the right channel have to be written into the Tx buffer. The CHSIDE flag
indicates which channel is to be transmitted. It has a meaning when the TXE flag is set
because the CHSIDE flag is updated when TXE goes high.
A full frame has to be considered as a left channel data transmission followed by a right
channel data transmission. It is not possible to have a partial frame where only the left
channel is sent.
The data half-word is parallel loaded into the 16-bit shift register during the first bit
transmission, and then shifted out, serially, to the MOSI/SD pin, MSB first. The TXE flag is
set after each transfer from the Tx buffer to the shift register and an interrupt is generated if
the TXEIE bit in the SPIx_CR2 register is set.
For more details about the write operations depending on the I
refer to
Section 35.7.2: Supported audio
To ensure a continuous audio data transmission, it is mandatory to write the SPIx_DR
register with the next data to transmit before the end of the current transmission.
Serial peripheral interface / integrated interchip sound (SPI/I2S)
generator).
2
S standard through the I2SSTD[1:0] and PCMSYNC bits, the data length
2
S master mode and direction (Transmitter or Receiver)
RM0444 Rev 5
protocols).
2
S standard mode selected,
1179/1390
1195

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32G0 1 Series and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Table of Contents

Save PDF