TI中文支持网
TI专业的中文技术问题搜集分享网站

CC1312 I2S 如何配置

大家好,

我需要用CC1312将音频数据通过I2S输出给一颗codec,CC1312配置如下

/* Forward Declarations */
static void i2sCallbackFxn(I2SCC26XX_Handle handle,
I2SCC26XX_StreamNotification *notification);

/* I2S Variables */
/*
* The I2S driver is setup to sample both right and left channel from the codec
* however the DMA is only configured to save the samples from the left channel.
* On playback the samples from the left channel will be mirrored to the left
* and right channels.
*
* In summary the sampling is stereo, but the processing and playback is mono.
*/
#define NUM_CHAN 2
#define FRAME_SIZE 160

#define I2S_TOTAL_QUEUE_MEM_SZ (I2S_BLOCK_OVERHEAD_IN_BYTES * \
I2SCC26XX_QUEUE_SIZE * \
NUM_CHAN)

#define I2S_SAMPLE_MEMORY_SZ (FRAME_SIZE * \
I2SCC26XX_QUEUE_SIZE * \
NUM_CHAN)
static I2SCC26XX_Handle i2sHandle = NULL;
static I2SCC26XX_StreamNotification i2sStream;
static uint8_t i2sQueueMemory[I2S_TOTAL_QUEUE_MEM_SZ];
static uint16_t i2sSampleBuffer[I2S_SAMPLE_MEMORY_SZ];

static I2SCC26XX_Params i2sParams =
{
.requestMode = I2SCC26XX_CALLBACK_MODE,
.ui32requestTimeout = BIOS_WAIT_FOREVER,
.callbackFxn = i2sCallbackFxn,
.blockSize = FRAME_SIZE,
.pvContBuffer = (void *)i2sSampleBuffer,
.ui32conBufTotalSize = (sizeof(int16_t) * I2S_SAMPLE_MEMORY_SZ),
.pvContMgtBuffer = (void *)i2sQueueMemory,
.ui32conMgtBufTotalSize = I2S_TOTAL_QUEUE_MEM_SZ,
.currentStream = &i2sStream
};

/* Initialize I2S driver */
i2sHandle = (I2SCC26XX_Handle)&(I2SCC26XX_config);
I2SCC26XX_init(i2sHandle);
I2SCC26XX_Handle i2sHandleTmp = NULL;
i2sHandleTmp = I2SCC26XX_open(i2sHandle, &i2sParams);
if(i2sHandleTmp == NULL)
{
// Display_printf(dispHandle, 3,0,
// "Can't open I2S, check memory allocation");
}

/* Start Streaming */
I2SCC26XX_startStream(i2sHandle);

将一包音频数据写入I2S buffer时候如何操作?是这样吗?如下

/* Since we are looping back, request input and output buffer */
I2SCC26XX_BufferRelease bufferRelease;

/* Release the buffer back to the I2S driver */
bufferRelease.bufferHandleIn = NULL;
bufferRelease.bufferHandleOut = (void *)I2S_TEST_BUF;
I2SCC26XX_releaseBuffer(i2sHandle, &bufferRelease);

Viki Shi:

建议参考一下SDK中的I2S例程及相关文档

Alvin Chen:

回复 Viki Shi:

github.com/…/i2secho.c

yaming fu:

回复 Alvin Chen:

我是参考这个配置的,但是调用/* Initialize I2S driver */i2sHandle = (I2SCC26XX_Handle)&(I2SCC26XX_config);I2SCC26XX_init(i2sHandle);I2SCC26XX_Handle i2sHandleTmp = NULL;i2sHandleTmp = I2SCC26XX_open(i2sHandle, &i2sParams);if(i2sHandleTmp == NULL){
//Display_printf(dispHandle, 3,0,
//"Can't open I2S, check memory allocation");}
/* Start Streaming */I2SCC26XX_startStream(i2sHandle);
后直接产生了else if (notification->status ==\I2SCC26XX_STREAM_BUFFER_READY_BUT_NO_AVAILABLE_BUFFERS){/* I2S_FRAME_EVENT */Event_post(i2sTaskEvent, I2S_NO_MEM);}
回调,配置如上,是我的配置有问题吗?按照i2secho.c进行配置的啊

yaming fu:

回复 Alvin Chen:

现在已经2019.3.4了,2019q1的i2s demo有具体的发布日期吗

赞(0)
未经允许不得转载:TI中文支持网 » CC1312 I2S 如何配置
分享到: 更多 (0)