主题中讨论的其他器件:TLV320AIC3254、 CC3200、 CC3200SDK、 SYSBIOS
工具/软件:TI-RTOS
您好!
我们在 CC3200上遇到 I2S 问题。 我们正在尝试播放来自 SimpleLink 文件系统的声音文件(16位、立体声、16kHz 采样)。 该文件似乎从文件系统中读出正常、但 TLV320AIC3254 DAC 没有声音、我们在完成后遇到 DMAERR 中断。 在使用 TIDriver 库进行测试之前、我们已经让它正常工作。 我知道 DAC 设置正确、因为我们使用与原始测试平台相同的寄存器配置和代码(使用 I2C_Open、I2C_transfer 等)。 我附上了以下代码
unsigned short fileBuffer[30*1024];
_u8 tBuffer[3072];
int playSound (char * filename)
{
intoffset= 0;
长 DeviceFileHandle;
长 lRetVal =-1; //负值为错误
SlfsFileInfo_t pFsFileInfo;
I2S_BufDesc bufDesc[3];
I2S_BufDesc *pDesc =空;
char fil[]="ding.wav";
Semaphore_pend (slSemaphore、BIOS_wait_forever);//等待 NWP 访问 FS
Semaphore_pend (semWaterWal Handle、BIOS_WAIT_Forever);//等待 I2S 句柄被打开
System_printf ("sound:Playing");
/DeviceName
(s_Open)、'FileName (\n'sle_unsigned
文件名);//系统文件名(\null_unsigned (1);//文件名:
返回-1;
}
//从文件中读取并丢弃 wav 头
//获取有关文件
的信息 lRetVal = sl_FsGetInfo ((unsigned char *)&fil、NULL、&pFsFileInfo);
if (lRetVal < 0)
{
CloseSoundFile (DeviceFileHandle);
//System_Handf ("sound:&ppseFileInfo);'n
、从
文件中读取%tsL 文件时失败;%tFileName = 0;//从文件中返回
if (lRetVal < 0)
{
CloseSoundFile (DeviceFileHandle);
//System_printf ("声音:无法读取文件%s\n"、文件名);
返回-1;
}
//丢弃 wav 头
//读取头
//检查文件是否为 wav 文件
,如果((tBuffer[0]!='R'
|| tBuffer[1]!='I'
|| tBuffer[2]!='F'
|| tBuffer[3]!='F')
{
System_printf ("error:not Devicefile\n"};
“SoundHandle"文件
名:%wav 文件格式:%wav 文件失败;
返回文件名
system_printf ("声音:声音是 RIFF wave\n");
偏移量+= sizeof (waveHeaderType);
_u8 * ptr = fileBuffer;
bufDesc[0]。bufPtr = ptr;
bufDesc[0]。bufSize = 3072;
ptr += 1536;
bufDesc[1];bufPtr = ptr;bufPtr = ptr =
bufDesc[1].bufSize = 3072;
ptr += 1536;
bufDesc[2].bufPtr = ptr;
bufDesc[2].bufSize = 3072;
ptr = fileBuffer;
System_printf ("ptr:%x\n"、ptr);
sl_FsRead (DeviceFileHandle、offset、tBuffer、 3072);
memcpy (bufDesc[0].bufPtr、tBuffer、3072);
sl_FsRead (DeviceFileHandle、 偏移、tBuffer、3072);
memcpy (bufDesc[1].bufPtr、tBuffer、 3072);
sl_FsRead (DeviceFileHandle、偏移量、tBuffer、3072);
memcpy (bufDesc[2]。bufPtr、tBuffer、3072);
I2S_writeIssue (i2sHandle、&bufDesc[0]);
I2S_writeIssue (i2sHandle、&bufDesc[1]);
I2S_writeIssue (i2sHandle、 &bufDesc[2]);
同步读取= 0;
内部 I = 2;
while (!donesReading){
i++;
ptr += 1536;
if (i=10){
ptr = fileBuffer;
i = 0;
}
I2S_writeReclaim (i2sHandle、&pDesc);
if (pVal ==
NULL);while (DeviceReset1)、FileReclaim (i2sHandle = NULL);if (文件缓冲区1);(文件交换)
if (lRetVal < 0)
{
CloseSoundFile (DeviceFileHandle);
System_printf ("声音:无法读取文件%s\n"、文件名);
}
否则(lRetVal < 3072)
{
Reading = 1;
}
//System_printf ("ptr:%x\n"、ptr);
cpy、memBuffer (ptr) lSoundVal);
pDESC->bufPtr = ptr;
pDESC->bufSize = lRetVal<3072?lRetVal:3072;
I2S_writeIssue (i2sHandle、pDesc);
offset+=lRetVal;
}
System_printf ("声音:完成播放。\n");
CloseFileHandle
返回