CS43L22 Codec Documentation
CS43L22 Codec Documentation
Submitted by:
Ahmed Omrani
Hadil Guedri
11.10.2024 (V1.0)
CS43L22 Codec Documentation V1.0 11.10.2024
Contents
Contents I
1 Introduction 1
2 Overview of CS43L22 2
2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.2 Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.3 CS43L22 pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.4 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4 Conclusion 14
Bibliography 15
List of Figures 16
List of Tables 17
Acronyms 18
1 Introduction
The STM32F4 Discovery is a development board based on the STM32F407VG microcontroller
from STMicroelectronics and features an Arm® Cortex®-M4 core. Among its many other
features, the board incorporates an integrated audio codec, CS43L22, which makes it possi-
ble to process audio information for both recording and playback. The Cirrus Logic CS43L22
codec is designed to perform stereo digital-to-analog conversion and is used for portable de-
vices maximizing the quality of audio projects on this platform. The report talks about the
CS43L22 codec incorporated in the development board of STM32F4 Discovery that is built
around STM32F407VG microcontroller. Cirrus Logic’s low power, high performance stereo
DAC known as CS43L22 is designed for audio devices with headphone and class-D speaker
amplifiers, as well as DSP based tone control and beeping. Important characteristics of the
codec include 16 to 24 bit digital to analog converter, any sample rate between 8khz to 48khz
and an i2s and i2c interface which allows transmission of data and control to the STM32F4
microcontroller seamlessly. To perform such activities as audio playback, audio recording and
audio configuration control, the STM32F4 microcontroller can take advantage of these inter-
faces making it suitable for the embedded audio applications. With the addition of the CS43L22
codec, this audio module expands the capabilities of the STM32F4 Discovery board to an entire
range of audio applications from simple audio playback to complex audio effects generation,
and some codes used for the audio modules setup and configuration are provided in this report.
2 Overview of CS43L22
2.1 Introduction
This chapter explores the architecture of the CS43L22, the role of its DSP engine, and the
configuration of its analog and digital outputs. Key features, such as analog passthrough and
pin characteristics, are detailed to give a thorough understanding of how this device can be
incorporated into systems that require audio output with minimal power consumption. This
examination of the CS43L22’s general architecture sets the stage for subsequent discussions on
its communication protocols and how it interfaces with microcontrollers like the STM32F4.
2.2 Architecture
The CS43L22 is a compact, low-power audio DAC designed for portable systems that require
high-quality sound while conserving energy. This audio DAC integrates several powerful fea-
tures optimized for both performance and efficiency in portable audio applications. [1]
At its core, the CS43L22 incorporates a Digital Signal Processing (DSP) engine that
allows for advanced audio controls. These include bass and treble adjustments across various
frequencies, enabling precise audio tuning for enhanced sound quality. Volume can be smoothly
adjusted through digital controls with soft ramping transitions, and analog controls are designed
to apply changes only at zero-crossing points of the audio waveform to avoid pops and clicks.
Additional DSP capabilities include de-emphasis, a limiter that prevents audio distortion at
high volumes, and a beep generator that can produce tones over a two-octave range, useful
for alerts or notifications [1]
The CS43L22 includes a stereo headphone amplifier powered from a separate positive sup-
ply, while an integrated charge pump provides a negative supply. This configuration enables a
ground-centered output with a wide signal swing, eliminating the need for external DC-blocking
capacitors. The Class D stereo speaker amplifier adds further efficiency, delivering high-
quality output without requiring an external filter. This design not only conserves battery life
but also allows direct battery-powered operation. The device’s internal battery monitoring
and compensation system ensures steady audio levels even as battery voltage declines, a
critical feature for portable systems.[1]
The DAC operates using a multi-bit delta-sigma architecture, which oversamples audio
at 128 times the system’s primary sample rate, enhancing audio fidelity while keeping power
consumption low. The CS43L22 also supports analog passthrough, which routes analog
input directly to the headphone amplifier. This feature is valuable in applications such as FM
tuners, where audio received over the air can be directed straight to the headphones without
additional processing. [1]
Additionally, the CS43L22 provides features for battery level monitoring and temperature
management, which contribute to its reliability in portable applications. These monitoring
systems ensure consistent audio output across different conditions and add a layer of safety by
adjusting output levels as battery power fluctuates. [1]
With its combination of high-performance audio capabilities, energy efficiency, and compact
design, the CS43L22 is an excellent choice for portable audio projects that demand both quality
and flexibility.
With this general overview of the CS43L22’s architecture, we have examined its core function-
alities. Now, let’s delve into some of its components in greater detail.[1]
The CS43L22 features a fixed-function DSP (Digital Signal Processing) engine that efficiently
handles key audio processing tasks while maintaining low power consumption. This engine
primarily works with PCM (Pulse Code Modulation) serial input data and includes several
useful features:
• Independent volume control: This allows for separate volume adjustments for the left
and right audio channels.[1][1]
• Channel manipulation: The DSP engine can swap the left and right audio channels or
combine them into a mono output, giving flexibility for different audio setups.[1]
• Tone control: It offers bass and treble adjustments, allowing users to fine-tune the audio
for clearer sound quality.
• Limiter function: The DSP includes a limiter that automatically adjusts the volume
to prevent distortion, especially useful during high-volume playback.[1][1]
• Beep generator: This feature produces sounds across a two-octave range with indepen-
dent volume control, making it ideal for notifications or alerts.[1]
These functions are integrated into the DSP, as shown in the architecture diagram, which also
demonstrates how it works alongside volume control, tone adjustments, channel manipulation,
and dynamic range management via the limiter (CS43L22).[1]
volume adjustments to these input signals. This feature gives flexibility for input channel
control and enables direct analog signal management within the codec.[1]
The diagram on page 25 of the CS43L22 datasheet, labeled ”Analog Outputs,” provides a de-
tailed view of the analog output stages, including the left and right headphone outputs and
associated controls. This section connects the digital signal processing (DSP) engine to the
headphone amplifiers (HPA and HPB) and supports direct analog passthrough (PASSTHRUx)
for routing audio signals straight to the amplifiers without digital conversion. Key controls
include headphone mute (HPxMUTE) and adjustable volume (HPxVOL[7:0]) and gain (HP-
GAIN[2:0]). The analog passthrough function offers additional flexibility, allowing external
analog signals to bypass DSP and route directly to the headphone amplifier with volume ad-
justments available through the PASSxVOL[7:0] control, which offers a range from +12 dB to
-60 dB in 0.5 dB steps. These adjustable controls support clear and flexible audio output for
various applications, ensuring optimal quality across different use cases.[1]
2.4 Conclusion
To conclude, the CS43L22 audio codec is a versatile and high-performance component that
enables superior sound quality in portable systems, balancing advanced digital processing with
low power consumption. Through its integrated DSP engine, the CS43L22 offers enhanced
audio controls like volume adjustment, tone tuning, and audio channel manipulation, allowing
for precise and customized audio output. Its analog passthrough feature and efficient ampli-
fier design contribute to optimal battery conservation, making it particularly well-suited for
portable audio applications.
By understanding the general architecture, DSP functionalities, analog passthrough capabili-
ties, and the detailed I/O characteristics of the CS43L22, developers gain a comprehensive view
of how this codec can be effectively integrated into system designs. This chapter has provided
an in-depth examination of the CS43L22’s core features and functions, setting the stage for sub-
sequent chapters that will delve into its communication protocols and configuration commands
in tandem with the STM32F4 Discovery board. Through these protocols, the codec’s advanced
capabilities are harnessed, allowing it to convert digital audio data into rich, high-quality sound
tailored for specific applications.
3.1 Introduction
The STM32F4 Discovery board communicates with the CS43L22 audio codec using the I²C
and I²S protocols, with additional control through GPIO pins. This document provides an
overview of this communication process.
• WS (Word Select): Indicates the channel (left or right) of the audio data.[3]
On the STM32F4 Discovery board, the I²S interface transfers audio data from the STM32F4
to the CS43L22 codec, which then converts this digital data into an analog audio signal.[3]
• Reset Pin (RESET): A GPIO pin (often configured as PD4) is used to reset the
codec.[4]
• I²S Data: Audio data is transmitted over the I²S protocol via the STM32F4’s dedicated
I²S peripheral, which connects to the codec’s audio data input.[4]
• Output volume[4]
• Power states[4]
3.6 Conclusion
In summary, the STM32F4 Discovery board communicates with the CS43L22 codec as follows:
4 Conclusion
In conclusion, the CS43L22 audio codec is a powerful and efficient solution for portable audio
applications, offering high-quality sound output with minimal power consumption. Its inte-
grated Digital Signal Processing (DSP) engine provides versatile features such as volume and
tone control, audio channel manipulation, and a limiter to ensure distortion-free audio. The
analog passthrough capability further enhances its flexibility, making it an excellent choice for
systems that prioritize battery life while maintaining superior audio performance. By under-
standing its general architecture, DSP functionalities, and I/O characteristics, developers can
fully leverage the CS43L22 in embedded audio systems. The subsequent chapters will explore
how to configure and communicate with this codec using protocols like I²C and I²S, ensuring
seamless integration with microcontrollers such as the STM32F4, and enabling the full potential
of the CS43L22 in real-world applications.
Bibliography
[1] C. Logic, “Cs43l22 low power stereo dac with headphone and speaker amplifiers.” Available
at https://www.cirrus.com (Accessed on 2024/11/11).
[3] D.-K. Electronics, “What is the i2s communication protocol?.” Available at https://www.
digikey.com/en/maker/tutorials/2023/what-is-the-i2s-communication-protocol
(Accessed on 2024/11/11).
List of Figures
List of Tables
Acronyms
CS43L22 Audio Codec Model
FM Frequency Modulation
dB Decibels