Roadrunner technical documentation Buy

Class D amplifier on RoadRunner SOM

This article illustrates how to enable the Class D amplifier integrated inside the SAMA5D27 and how to use it on Linux

The Audio Class D Amplifier (CLASSD) is a digital input, Pulse Width Modulated (PWM) output stereo Class D amplifier. It features a high-quality interpolation filter embedding a digitally-controlled gain, an equalizer and a deemphasis filter.

Embedded Characteristics

  • PWM Class D Amplifier
  • 16-bit Audio Data
  • DSP Clocks: 12.288 and 11.2896 MHz
  • Input Sampling Rates: 8, 16, 32, 48, 96, 22.05, 44.1, 88.2 kHz
  • 3-band Equalizer
  • De-emphasis Filter
  • Digital Volume Control
  • Differential or Single-ended Outputs
  • Non-overlapping Circuit to Control External MOSFETs
  • Supports DMA

Kernel setup

To enable the Class D driver laubch the kernel menuconfig (read how...) and enable these drivers:

Device Drivers > 
    Sound card support > 
        Advanced Linux Sound Architecture > 
            ALSA for SoC audio support 
                <*>   SoC Audio for the Atmel System-on-Chip
                <*>     Atmel ASoC driver for boards using CLASSD

Device tree bindings

Definition to insert inside the apb section:

classd: classd@fc048000 {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_classd_default>;
    /*atmel,pwm-type = "diff";*/
    atmel,pwm-type = "single";
    atmel,non-overlap-time = <0>;
    status = "okay";

Definition to insert inside the pinctrl@fc038000 section if you are using the MMC1 bus to wire the MicroSD. In this case it is possible to use just the right channel:

pinctrl_classd_default: classd_default {
    pinmux = <PIN_PB1__CLASSD_R0>,

Definition to insert inside the pinctrl@fc038000 section if you are using the MMC0 bus to wire the MicroSD. In this case is possible to use both channels:

pinctrl_classd_default: classd_default {
    pinmux = <PIN_PB1__CLASSD_R0>,


To know how to implements the hardware interfaces please read the Microchip Datasheet starting from page 1328:

This is the simpler solution available:

Test files


Related products

RoadRunner D2

Features Index Buy

Low-power Linux System On Module
  • CPU Microchip SAMA5D27
  • Cortex A5 @ 500 MHz
  • Low power consumption:
    Suspend to RAM mode 10mW
    Full speed: 396mW
  • Debian, Buildroot and Yocto Linux
  • Fully open source drivers

Features Index Buy

Single Board Computer based on RoadRunner Linux SOM (Included)
  • Low power consumption
  • Two USB Host 2.0 ports (one configurable as USB client on the USB-C connector)
  • One 10/100 Mbit/s Lan port
  • 2 Acme Sensor ports
  • Huge set of GPIOS, SPI, I2C and serial lines

Features Buy

Evaluation board for RoadRunner SOM
  • All the circuitries you need to test the RoadRunner SOM
  • USB host, USB device, Ethernet port, MicroSD socket
  • Test points for power consumption measurements
  • All the Roadrunner signals exposed on 2.54mm pitch pins
  • On-board supercap for RTC and backup memory circuit

Home page Roadrunner technical documentation Buy