问答

汇集网友智慧,解决技术难题

azmao

TA的家园币:55  

  • F460的I2S的问题?连接ES8388.

    学习了例程i2s_record_and_play。有几个地方没看懂。voidBSP_WM8731_TransCompleteCallBack(void){if(0U!=u8TransCompleteFlag){BSP_WM8731_Play(&u32TransBuf[1][0],BSP_WM8731_DMA_BLK_LEN);u8TransCompleteFlag=0U;}else{BSP_WM8731_Play(&u32TransBuf[0][0],BSP_WM8731_DMA_BLK_LEN);u8TransCompleteFlag=1U;}DMA_ClearTransCompleteStatus(BSP_WM8731_DMA_SDIN_UNIT,BSP_WM8731_DMA_SD_INT_CH);}发送完成的DMA中断为什么要清楚接收DMA的传送完成标志。同样接收完成的DMA中断中也清除了发送DMA的传送完成标志。我的程序是这样的。/*INT_SRC_DMA1_TC0Callback.sendtoI2S*/staticvoidINT_SRC_DMA1_TC0_IrqCallback(void){//addyourcodeshereif(0U!=u8TransCompleteFlag){BSP_ES8388_Play(&u32TransBuf[0][0],DMACount);u8TransCompleteFlag=0U;}else{BSP_ES8388_Play(&u32TransBuf[1][0],DMACount);u8TransCompleteFlag=1U;}//DMA_ClearTransCompleteStatus(CM_DMA1,DMA_INT_TC_CH0);}/*INT_SRC_DMA2_TC0Callback.*/staticvoidINT_SRC_DMA2_TC0_IrqCallback(void){//addyourcodeshereif(0U!=u8ReceiveCompleteFlag){BSP_ES8388_Record(&u32ReceiveBuf[0][0],DMACount);//(void)memcpy((uint8_t*)&u32TransBuf[1][0],(uint8_t*)&u32ReceiveBuf[1][0],(BSP_WM8731_DMA_BLK_LEN*4U));u8ReceiveCompleteFlag=0U;}else{BSP_ES8388_Record(&u32ReceiveBuf[1][0],DMACount);//(void)memcpy((uint8_t*)&u32TransBuf[0][0],(uint8_t*)&u32ReceiveBuf[0][0],(BSP_WM8731_DMA_BLK_LEN*4U));u8ReceiveCompleteFlag=1U;}//DMA_ClearTransCompleteStatus(CM_DMA2,DMA_INT_TC_CH0);}DMACount设成了1024,倒是可以采样上了数据。给左右通道输入了正弦波,可以正常采集。但是有一些问题。今天断开了left通道,只给right通道正弦波,发现了一个奇怪的现象,left和right通道采集的数据交替出现正弦波,是哪里发生错位了呢?

    F460 I2S 左右错位

    2023-10-08 8