I2S demo

[中文]

1、Function overview

The I2S demo supports the master sending data and the slave receiving data in different working modes.

2、Code path

demo path: \components\demos\media\audio\i2s

For the detailed description of the API interface of the I2S module, please refer to the same webpage: /api-reference/multi_media/bk_i2s.html

3、Cli command introduction

The commands supported by the demo are as follows:

Command

Description

i2s_master_test {start|stop}

Send data in I2S mode as master

i2s_slave_test {start|stop}

Receive data as a slave in I2S mode

pcm_master_test {start|stop}

Send data in PCM mode as master

pcm_slave_test {start|stop}

Receive data as a slave in PCM mode

dtm_master_test {start|stop}

Send data in DTM+PCM mode as master

dtm_slave_test {start|stop}

Receive data as a slave in DTM+PCM mode

2bd_master_test {start|stop}

Send data in 2B+D mode as master

2bd_slave_test {start|stop}

Receive data as a slave in 2B+D mode

The macro configuration that the demo runs depends on:

Name

Description

File

value

CONFIG_I2S

Configure the I2S function to enable

\middleware\soc\bk7256\bk7256.defconfig

y

CONFIG_I2S_TEST

Whether the configuration demo takes effect

\middleware\soc\bk7256\bk7256.defconfig

y

Demo runs dependent libraries and drivers:
  • GPIO GPIO driver

  • DMA DMA driver

4、Demo introduction

Taking the demo of the I2S working mode as an example, the steps performed by the demo are as follows:

1.Connect two test boards
  • Use two development boards for testing, one as master and one as slave

  • Interconnect the GPIO6 and GPIO7 pins of the two boards

  • Connect GPIO8 on the master side to GPIO9 on the slave side

  • Connect GPIO9 on the master side to GPIO8 on the slave side

2.Start the slave side test
  • The Uart on the slave side sends the AT command i2s_slave_test start to execute the I2S function test of the slave role

3.Start the master test
  • Uart sends the AT command i2s_master_test start to perform the I2S function test of the master role

4.Stop the test
  • Observe the serial port log printing. After the test is completed, the slave and master end Uart respectively send AT commands i2s_slave_test stop and i2s_master_test stop to stop executing the I2S function test

5、Detailed configuration and description

Important

Precautions:
  • 1.During I2S communication, the DIN and DOUT pins of the master and the slave should be connected correctly, the DIN of the master should be connected to the DOUT of the slave, and the DOUT of the master should be connected to the DIN of the slave;

  • 2.The working mode of master and slave should be consistent;