17. I2S EMULATION
17.1. Overview
This example project demonstrates the functionality of using SPI to emulate an I2S master for receiving audio decoding module recording data and playing back the recorded data.
The evaluation board must be connected to an audio decoding module. This example uses the WM8978 codec.
17.2. Tips
For detailed documentation about I2S over SPI, please refer to i2s_over_spi
17.3. Notice
Due to the requirement for long data transfers in this example, it is currently supported only on the hpm5300 series.
17.4. dependent components
dma_mgr
spi
i2s_over_spi
codec(wm8978)
17.5. Board Setting
Use the onboard microphone of the audio module for recording.
Connect a 3.5mm headphone to the audio module’s output headphone jack.
The following components are required: GPTMR output and SPI pins (Please refer to Pin Description )
Pin connections:
5V <–> 5V(WM8978)
3.3V <–> 3.3V(WM8978)
GND <–> GND(WM8978)
MCLK(GPTMR) <–> MCLK(WM8978)
LRCK(GPTMR) <–> (FSA)LRC(WM8978)
BLCK(GPTMR) <–> SCLK(SPI) <–> SCK(WM8978)
MISO(SPI) <–> (DAT)DACDATA(WM8978)
MOSI(SPI) <–> (SDB)ADCDATA(WM8978)
(CS)GPIO <–> CS(SPI)
I2C_SDA <–> I2C_SDA(WM8978)
I2C_SCL <–> I2C_SCL(WM8978)
17.6. Run steps
When the project runs correctly, the serial terminal will display the following menu:
---------------------------------------------------------------
* *
* i2s_emulation demo *
* *
* 1 - start play *
* 2 - stop play *
* 3 - start record *
* 4 - stop record *
*-------------------------------------------------------------*
Enter the character ‘3’ in the terminal to start recording. The system will automatically stop and save the recording when the duration exceeds the specified limit.
record_start enter....
recording size overflow, stopping and exiting now...
Enter the character ‘1’ in the terminal to start playback.
play start enter....
play end, now exit....
Enter the character ‘4’ in the terminal to stop recording.
record stop finish....
Enter the character ‘2’ in the terminal to stop playback.
play stop finish....