Waveshare WM8960 User manual

WM8960 Audio Board
WM8960 Audio Board
User Manual
OVERVIEW
The is WM8960 Audio board uses WM8690 which is a Low consumption, Stereo
encoder/decoder. Can be used for portable digital audio applications, like recoding or
drive speaker to play.
FEATURES
⚫High quantity MEMS silicon MIC, for recording without earphone.
⚫3.5mm 4 segment headphone mic, allows external headphone for recording or
playing.
⚫Dual-channel Speaker interface, for external speaker
⚫Supports audio sample rate: 8/11.025/22.05/44.1/48KHz
⚫Supports Stereo and 3D Surround Sound and so on.
⚫Come with User Manual and examples (Play and record examples for STM32F429
and STM32F746 can be downloaded from Wiki).
SPECIFICATION
➢Audio Encoder/Decoder: WM8960

WM8960 Audio Board
➢Operating voltage: 3.3V
➢Control Interface: I2C
➢Audio Interface: I2S
➢Audio Format: WAV
➢DAC signal-noise ratio: 98dB
➢ADC signal-noise ratio: 94dB
➢Headphone controller: 16Ω40mW
➢Speaker controller: 8Ω1W
PINS
PIN
Descriptions
VCC
3.3V
GND
Ground
SDA
I2C Data input
SCL
I2C Clock input
CLK
I2S Bit clock input
WS
I2S Frame clock input
TXSDA
I2S Data output
RXSDA
I2S Data input
TXMCLK
I2S System Clock(Sending)
RXMCLK
I2SSystem Clock(Receive)

WM8960 Audio Board
HARDWARE
HARDWARE CONNECTION
This WM8960 use I2C for controlling, I2S and SAI for Audio communicating.
There are 3P pins for choosing MCLK signal, left one is MCLK signal transmitted,
and the right one is MCLK signal received.
You can connect 3 segment headphone or 4 segment headphone mic to
EARPHONE port. Right one is the speaker interface for 8Ωspeaker, recommend you
to purchase one more 8Ω 5W Speaker from us.

WM8960 Audio Board
WORKING PROTOCOL
This module use WM8960 for audio encode/decode. WM8960 use I2C bus to
control signal and configures internal registers, I2S bus used to transmit/receive audio
signals.
I2C BUS
In I2C Bus, master device will first send an address frame for searching slave
device and setting communication mode. High 7 bits are address, followed a control
bit and finally the response signal. If slave device receives the response signal, it will
return a response to master device. Then master device could begin to send data to
slave device, which is 8 bits and the high 7 bits are address and the lowest one is
response signal. MSB first.
According to Datasheet, registers of WM8960 are 9-bit. Thus, when we send data
to it, should split data to two bytes and add the ID of register to recognized before
transmitting. The ID of register flagged by 7-bit.
For more details about I2C, please refer to Page 15 and Page 63 of WM8960_v4.2.

WM8960 Audio Board
I2S BUS
I2S has four signal lines, they are: SCLK, LRCK, SDATA and MCLK. And the first
three are most important. For better synchronize with system clock, you can mater
device clock, or external clock circuit.
Serial clock SCLK is also called as bit clock BCLK, which related to every bit of
digital audio. SCLK Frequency = 2 x Sample rate x Sample bits.
Frame clock LRCK (WS) is used to switch data of LEFT and RIGHT channels. If LRCK
is “1”, it means that data of RIGHT channel are being transmitted, and LEFT channel
is active if LRCK is “0”. The rate of LRCK is same as sample rate.
Serial data SDATA are audio data, they are binary complement.
Main clock (MCLK) is also called as System clock (Sys Clock), its frequency is 256
times or 384 times of sample rate. In order to support more function, we reserved the
MCLK interface of this module for more audio.

WM8960 Audio Board
HOW TO USE
We provide examples for this module, which are based on our Open429I-C and
Open746I-C. For every board, there are three examples: play internal audio data, play
WAV file from SD card, record WAV audio file to SD card.
EXAMPLES FOR OPEN429I-C
Example 1: Play audio data internal
1. Hardware connection
Board: Open429I-C
Module required: WM8960 Audio Board
You should connect WM8960 module to I2S interface of the Open board
PIN
Open429I-C
VCC
3.3V
GND
GND
SDA
I2C1_SDA (PB9)
SCL
I2C1_SCL (PB8)
CLK
I2S2CLK (PB13)
WS
I2S2WS (PB12)
TXSDA
I2S2SDA (PB15)
TXMCLK
I2S2_MCLK (PC6)
Note: Pins which doesn’t listed on table are not connected

WM8960 Audio Board
2. Description of files
Examples are compiled on MDK-ARM V4, generated by STM32CubeMX
../Src:
WM8960.c: Bottom driver of WM8960, mainly provide functions that sending data
to chip, initializes chip and Use I2S to play internal audio data
../Inc:
wave_data.h: file used to store audio data (the internal audio)
3. Expected result:
Shorted MCLK and TX on board with jumper, connect WM8960 audio board to
Open429 as table above. Connect an earphone or speaker to audio board, then
download the example to development board. Audio will be outputted to
earphone/speaker.
Example 2: Play WAV audio from SD card
1. Hardware connection
Board: Open429I-C
Modules required: Micro SD Storage Board, SD card, WM8960 Audio Board
You should insert SD card to Micro SD Storage Board, then connect the SD board
to SDIO interface of Open429. Finally insert Audio board to SAI interface of
Open429.
PIN
Open429I-C
VCC
3.3V

WM8960 Audio Board
GND
GND
SDA
I2C1_SDA (PB9)
SCL
I2C1_SCL (PB8)
CLK
SAI1_SCK_B (PF8)
WS
SAI1_FS_B (PF9)
TXSDA
SAI1_SD_B (PF6)
TXMCLK
SAI1_MCLK_B (PF7)
Note: Pins which doesn’t listed on table are not connected
2. Description of files
Examples are compiled on MDK-ARM V4, generated by STM32CubeMX
../Src:
WM8960.c: Bottom driver of WM8960, mainly provide functions that sending data
to chip, initializes chip
Play_WAV.c: Provide function that play WAV file from SD card, include read list of
WAV files, read audio information of files, play WAV files, handle keys events and
so on.
3. Expected result
After connecting all module to Open429I-C, insert an earphone or speaker to
Audio board, connect USART1 interface of Open429I to PC , and then open serial
assistance software on PC.
Download example to Open429 board, module will begin to play audio file

WM8960 Audio Board
automatically, and print WAV files list and the information of current WAV file to
USART port at the same time.
You can use Joystick to control the play: Press to pause/play, left (C) to previous
and right (B) to next.
Example 3: Record WAV files to SD card
1. Hardware connection
Board: Open429I-C
Modules required: Micro SD Storage Board, SD card, WM8960 Audio Board
You should insert SD card to Micro SD Storage Board, then connect the SD board
to SDIO interface of Open429. Finally insert Audio board to SAI interface of
Open429.
PIN
Open429I-C
VCC
3.3V
GND
GND
SDA
I2C1_SDA (PB9)
SCL
I2C1_SCL (PB8)
CLK
SAI1_SCK_A (PE5)
WS
SAI1_FS_A (PE4)
RXSDA
SAI1_SD_A (PE6)
RXMCLK
SAI1_MCLK_A (PE2)
Note: Pins which doesn’t listed on table are not connected

WM8960 Audio Board
2. Description of files
Examples are compiled on MDK-ARM V4, generated by STM32CubeMX
../Src:
WM8960.c: Bottom driver of WM8960, mainly provide functions that sending data
to chip, initializes chip. In the top of this file, macros are used to choose record
devices (On board mic or earphone mic), in the function of WM8960 initialization,
you can uncomment codes to enable functions of bypass output
Record_WAV.c: Provide function that record audio and stores to SD card, include
create WAV files, record audio, handle keys events and so on.
3. Expected result
Connecting all the modules to Open429I-C, then inset an earphone or speaker to
Audio board. Connect UASRT1 interface of Open429I-C to PC and open the serial
assistance software.
Download example to Open429I-C, MCU will prints the recording file name via
UASRT1, and prompt that press Joystick to begin recording.
After pressing joystick, you can speak to mic, and you can see your voice are
bypass outputted from speaker or earphone, You can press Joystick to
pause/restore during recording. Long press Joystick for 1~2s to stop recording.
After recording, power off Open429I-C, inset the SD card to PC, you can find the
WAV files recorded and play; You can also use the play example to play the audio
you record.

WM8960 Audio Board
EXAMPLES FOR OPEN746I-C
Example 1: Play audio data internal
4. Hardware connection
Board: Open746I-C
Module required: WM8960 Audio Board
You should connect WM8960 module to I2S interface of the Open board
PIN
Open746I-C
VCC
3.3V
GND
GND
SDA
I2C1_SDA (PB9)
SCL
I2C1_SCL (PB8)
CLK
I2S2_CLK (PB13)
WS
I2S2_WS (PB12)
TXSDA
I2S2_SDA (PB13)
TXMCLK
I2S2_MCLK (PC6)
Note: Pins which doesn’t listed on table are not connected
5. Description of files
Examples are compiled on MDK-ARM V4, generated by STM32CubeMX
../Src:
WM8960.c: Bottom driver of WM8960, mainly provide functions that sending data

WM8960 Audio Board
to chip, initializes chip and Use I2S to play internal audio data
../Inc:
wave_data.h: file used to store audio data (the internal audio)
6. Expected result:
Shorted MCLK and TX on board with jumper, connect WM8960 audio board to
Open746I-C as table above. Connect an earphone or speaker to audio board, then
download the example to development board. Audio will be outputted to
earphone/speaker.
Example 2: Play WAV audio from SD card
1. Hardware connection
Board: Open746I-C
Modules required: Micro SD Storage Board, SD card, WM8960 Audio Board
You should insert SD card to Micro SD Storage Board, then connect the SD board
to SDMMC interface of Open429. Finally insert Audio board to SAI interface of
Open429.
PIN
Open429I-C
VCC
3.3V
GND
GND
SDA
I2C1_SDA (PB9)
SCL
I2C1_SCL (PB8)

WM8960 Audio Board
CLK
SAI1_SCK_B (PF8)
WS
SAI1_FS_B (PF9)
TXSDA
SAI1_SD_B (PF6)
TXMCLK
SAI1_MCLK_B (PF7)
Note: Pins which doesn’t listed on table are not connected
2. Description of files
Examples are compiled on MDK-ARM V4, generated by STM32CubeMX
../Src:
WM8960.c: Bottom driver of WM8960, mainly provide functions that sending data
to chip, initializes chip
Play_WAV.c: Provide function that play WAV file from SD card, include read list of
WAV files, read audio information of files, play WAV files, handle keys events and
so on.
3. Expected result
After connecting all module to Open746I-C, insert an earphone or speaker to
Audio board, connect USART1 interface of Open746I-C to PC , and then open
serial assistance software on PC.
Download example to Open746I-C board, module will begin to play audio file
automatically, and print WAV files list and the information of current WAV file to
USART port at the same time.

WM8960 Audio Board
You can use Joystick to control the play: Press to pause/play, left (C) to previous
and right (B) to next.
Example 3: Record WAV files to SD card
1. Hardware connection
Board: Open746I-C
Modules required: Micro SD Storage Board, SD card, WM8960 Audio Board
You should insert SD card to Micro SD Storage Board, then connect the SD board
to SDIO interface of Open746I-C. Finally insert Audio board to SAI interface of
Open429.
PIN
Open746I-C
VCC
3.3V
GND
GND
SDA
I2C1_SDA (PB9)
SCL
I2C1_SCL (PB8)
CLK
SAI1_SCK_A (PE5)
WS
SAI1_FS_A (PE4)
RXSDA
SAI1_SD_A (PE6)
RXMCLK
SAI1_MCLK_A (PE2)
Note: Pins which doesn’t listed on table are not connected

WM8960 Audio Board
2. Description of files
Examples are compiled on MDK-ARM V4, generated by STM32CubeMX
../Src:
WM8960.c: Bottom driver of WM8960, mainly provide functions that sending data
to chip, initializes chip. In the top of this file, macros are used to choose record
devices (On board mic or earphone mic), in the function of WM8960 initialization,
you can uncomment codes to enable functions of bypass output
Record_WAV.c: Provide function that record audio and stores to SD card, include
create WAV files, record audio, handle keys events and so on.
3. Expected result
Connecting all the modules to Open746I-C, then inset an earphone or speaker to
Audio board. Connect UASRT1 interface of Open746I-C to PC and open the serial
assistance software.
Download example to Open746I-C, MCU will prints the recording file name via
UASRT1, and prompt that press Joystick to begin recording.
After pressing joystick, you can speak to mic, and you can see your voice are
bypass outputted from speaker or earphone, You can press Joystick to
pause/restore during recording. Long press Joystick for 1~2s to stop recording.
After recording, power off Open746I-C, inset the SD card to PC, you can find the
WAV files recorded and play; You can also use the play example to play the audio
you record.
Table of contents
Other Waveshare Computer Hardware manuals

Waveshare
Waveshare DVK512 User manual

Waveshare
Waveshare Music Shield User manual

Waveshare
Waveshare XNUCLEO-F030R8 User manual

Waveshare
Waveshare Pico-BLE User manual

Waveshare
Waveshare DVK512 User manual

Waveshare
Waveshare E9 User manual

Waveshare
Waveshare High-Precision AD/DA Board User manual

Waveshare
Waveshare XNUCLEO-F030R8 User manual

Waveshare
Waveshare SIM7600 Series User manual

Waveshare
Waveshare Accessory Shield User manual