专家
公告
财富商城
电子网
旗下网站
首页
问题库
专栏
标签库
话题
专家
NEW
门户
发布
提问题
发文章
STM32
谁用过i2s3接wm8978录音的dma中断该怎么配置
2019-07-20 01:37
发布
×
打开微信“扫一扫”,打开网页后点击屏幕右上角分享按钮
站内问答
/
STM32/STM8
1482
2
1550
友情提示:
此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
2条回答
13372533333
2019-07-20 03:29
void I2S3_TX_DMA_Init(u8* buf0,u8 *buf1,u16 num)
{
NVIC_InitTypeDef NVIC_InitStructure;
DMA_InitTypeDef DMA_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA1,ENABLE);//DMA1ê±Öóê1Äü
DMA_DeInit(DMA1_Stream5);
while (DMA_GetCmdStatus(DMA1_Stream5) != DISABLE){}//μè′yDMA1_Stream5¿éÅäÖÃ
DMA_ClearITPendingBit(DMA1_Stream5,DMA_IT_FEIF5|DMA_IT_DMEIF5|DMA_IT_TEIF5|DMA_IT_HTIF5|DMA_IT_TCIF5);//Çå¿ÕDMA1_Stream5éÏËùóDÖD¶Ï±êÖ¾
/* ÅäÖÃ DMA Stream */
DMA_InitStructure.DMA_Channel = DMA_Channel_0; //í¨μà
DMA_InitStructure.DMA_PeripheralBaseAddr = (u32)&SPI3->DR;//íaéèμØÖ·Îa
u32)&SPI2->DR
DMA_InitStructure.DMA_Memory0BaseAddr = (u32)buf0;//DMA ′æ′¢Æ÷0μØÖ·
DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral;//′æ′¢Æ÷μ½íaéèÄ£ê½
DMA_InitStructure.DMA_BufferSize = num;//êy¾Y′«êäá¿
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;//íaéè·ÇÔöá¿Ä£ê½
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;//′æ′¢Æ÷Ôöá¿Ä£ê½
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;//íaéèêy¾Y3¤¶è:16λ
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;//′æ′¢Æ÷êy¾Y3¤¶è£o16λ
DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;// ê1óÃÑ-»·Ä£ê½
DMA_InitStructure.DMA_Priority = DMA_Priority_High;//¸ßóÅÏ輶
DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable; //2»ê1óÃFIFOÄ£ê½
DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_1QuarterFull;
DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;//íaéèí»·¢μ¥′Î′«êä
DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;//′æ′¢Æ÷í»·¢μ¥′Î′«êä
DMA_Init(DMA1_Stream5, &DMA_InitStructure);//3õê¼»ˉDMA Stream
DMA_DoubleBufferModeConfig(DMA1_Stream5,(u32)buf1,DMA_Memory_0);//Ë«»o3åÄ£ê½ÅäÖÃ
DMA_DoubleBufferModeCmd(DMA1_Stream5,ENABLE);//Ë«»o3åÄ£꽿aÆô
DMA_ITConfig(DMA1_Stream5,DMA_IT_TC,ENABLE);//¿aÆô′«êäíê3éÖD¶Ï
NVIC_InitStructure.NVIC_IRQChannel = DMA1_Stream5_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x00;//ÇàÕ¼óÅÏ輶0
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x00;//×óóÅÏ輶0
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;//ê1Äüía2¿ÖD¶Ïí¨μà
NVIC_Init(&NVIC_InitStructure);//ÅäÖÃ
}
void I2S3ext_RX_DMA_Init(u8* buf0,u8 *buf1,u16 num)
{
NVIC_InitTypeDef NVIC_InitStructure;
DMA_InitTypeDef DMA_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA1,ENABLE);//DMA1ê±Öóê1Äü
DMA_DeInit(DMA1_Stream0);
while (DMA_GetCmdStatus(DMA1_Stream0) != DISABLE){}//μè′yDMA1_Stream3¿éÅäÖÃ
DMA_ClearITPendingBit(DMA1_Stream0,DMA_IT_FEIF0|DMA_IT_DMEIF0|DMA_IT_TEIF0|DMA_IT_HTIF0|DMA_IT_TCIF0);//Çå¿ÕDMA1_Stream3éÏËùóDÖD¶Ï±êÖ¾
/* ÅäÖÃ DMA Stream */
DMA_InitStructure.DMA_Channel = DMA_Channel_3; //í¨μà3 I2S2ext_RXí¨μà
DMA_InitStructure.DMA_PeripheralBaseAddr = (u32)&I2S3ext->DR;//íaéèμØÖ·Îa
u32)&I2S2ext->DR>DR
DMA_InitStructure.DMA_Memory0BaseAddr = (u32)buf0;//DMA ′æ′¢Æ÷0μØÖ·
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory;//íaéèμ½′æ′¢Æ÷Ä£ê½
DMA_InitStructure.DMA_BufferSize = num;//êy¾Y′«êäá¿
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;//íaéè·ÇÔöá¿Ä£ê½
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;//′æ′¢Æ÷Ôöá¿Ä£ê½
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;//íaéèêy¾Y3¤¶è:16λ
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;//′æ′¢Æ÷êy¾Y3¤¶è£o16λ
DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;// ê1óÃÑ-»·Ä£ê½
DMA_InitStructure.DMA_Priority = DMA_Priority_Medium;//ÖDμèóÅÏ輶
DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable; //2»ê1óÃFIFOÄ£ê½
DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_1QuarterFull;
DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;//íaéèí»·¢μ¥′Î′«êä
DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;//′æ′¢Æ÷í»·¢μ¥′Î′«êä
DMA_Init(DMA1_Stream0, &DMA_InitStructure);//3õê¼»ˉDMA Stream
DMA_DoubleBufferModeConfig(DMA1_Stream0,(u32)buf1,DMA_Memory_0);//Ë«»o3åÄ£ê½ÅäÖÃ
DMA_DoubleBufferModeCmd(DMA1_Stream0,ENABLE);//Ë«»o3åÄ£꽿aÆô
DMA_ITConfig(DMA1_Stream0,DMA_IT_TC,ENABLE);//¿aÆô′«êäíê3éÖD¶Ï
NVIC_InitStructure.NVIC_IRQChannel = DMA1_Stream0_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority =0x00;//ÇàÕ¼óÅÏ輶0
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x00;//×óóÅÏ輶1
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;//ê1Äüía2¿ÖD¶Ïí¨μà
NVIC_Init(&NVIC_InitStructure);//ÅäÖÃ
}
加载中...
查看其它2个回答
一周热门
更多
>
相关问题
STM32F4上I2C(在PROTEUS中模拟)调试不通的问题
6 个回答
芯片供应紧张,准备换个MCU,MM32L系列替换STM32L系列的怎么样?
7 个回答
STM32同时使用两个串口进行数据收发时数据丢包的问题
5 个回答
STM32F103串口通信死机问题
4 个回答
STM32WLE5CC连接SX1268在LoRa模式下能与 SX1278互通吗?
2 个回答
相关文章
ST公司第一款无线低功耗单片机模块有效提高物联网设计生产效率
0个评论
如何实现对单片机寄存器的访问
0个评论
通过USB用STM32片内自带Bootloader下载程序及注意事项
0个评论
欲练此功必先自宫之STM32汇编启动,放慢是为了更好的前行
0个评论
×
关闭
采纳回答
向帮助了您的知道网友说句感谢的话吧!
非常感谢!
确 认
×
关闭
编辑标签
最多设置5个标签!
STM32
保存
关闭
×
关闭
举报内容
检举类型
检举内容
检举用户
检举原因
广告推广
恶意灌水
回答内容与提问无关
抄袭答案
其他
检举说明(必填)
提交
关闭
×
打开微信“扫一扫”,打开网页后点击屏幕右上角分享按钮
×
付费偷看金额在0.1-10元之间
确定
×
关闭
您已邀请
0
人回答
查看邀请
擅长该话题的人
回答过该话题的人
我关注的人
{
NVIC_InitTypeDef NVIC_InitStructure;
DMA_InitTypeDef DMA_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA1,ENABLE);//DMA1ê±Öóê1Äü
DMA_DeInit(DMA1_Stream5);
while (DMA_GetCmdStatus(DMA1_Stream5) != DISABLE){}//μè′yDMA1_Stream5¿éÅäÖÃ
DMA_ClearITPendingBit(DMA1_Stream5,DMA_IT_FEIF5|DMA_IT_DMEIF5|DMA_IT_TEIF5|DMA_IT_HTIF5|DMA_IT_TCIF5);//Çå¿ÕDMA1_Stream5éÏËùóDÖD¶Ï±êÖ¾
/* ÅäÖÃ DMA Stream */
DMA_InitStructure.DMA_Channel = DMA_Channel_0; //í¨μà
DMA_InitStructure.DMA_PeripheralBaseAddr = (u32)&SPI3->DR;//íaéèμØÖ·Îau32)&SPI2->DR
DMA_InitStructure.DMA_Memory0BaseAddr = (u32)buf0;//DMA ′æ′¢Æ÷0μØÖ·
DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral;//′æ′¢Æ÷μ½íaéèÄ£ê½
DMA_InitStructure.DMA_BufferSize = num;//êy¾Y′«êäá¿
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;//íaéè·ÇÔöá¿Ä£ê½
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;//′æ′¢Æ÷Ôöá¿Ä£ê½
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;//íaéèêy¾Y3¤¶è:16λ
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;//′æ′¢Æ÷êy¾Y3¤¶è£o16λ
DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;// ê1óÃÑ-»·Ä£ê½
DMA_InitStructure.DMA_Priority = DMA_Priority_High;//¸ßóÅÏ輶
DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable; //2»ê1óÃFIFOÄ£ê½
DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_1QuarterFull;
DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;//íaéèí»·¢μ¥′Î′«êä
DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;//′æ′¢Æ÷í»·¢μ¥′Î′«êä
DMA_Init(DMA1_Stream5, &DMA_InitStructure);//3õê¼»ˉDMA Stream
DMA_DoubleBufferModeConfig(DMA1_Stream5,(u32)buf1,DMA_Memory_0);//Ë«»o3åÄ£ê½ÅäÖÃ
DMA_DoubleBufferModeCmd(DMA1_Stream5,ENABLE);//Ë«»o3åÄ£꽿aÆô
DMA_ITConfig(DMA1_Stream5,DMA_IT_TC,ENABLE);//¿aÆô′«êäíê3éÖD¶Ï
NVIC_InitStructure.NVIC_IRQChannel = DMA1_Stream5_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x00;//ÇàÕ¼óÅÏ輶0
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x00;//×óóÅÏ輶0
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;//ê1Äüía2¿ÖD¶Ïí¨μà
NVIC_Init(&NVIC_InitStructure);//ÅäÖÃ
}
void I2S3ext_RX_DMA_Init(u8* buf0,u8 *buf1,u16 num)
{
NVIC_InitTypeDef NVIC_InitStructure;
DMA_InitTypeDef DMA_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA1,ENABLE);//DMA1ê±Öóê1Äü
DMA_DeInit(DMA1_Stream0);
while (DMA_GetCmdStatus(DMA1_Stream0) != DISABLE){}//μè′yDMA1_Stream3¿éÅäÖÃ
DMA_ClearITPendingBit(DMA1_Stream0,DMA_IT_FEIF0|DMA_IT_DMEIF0|DMA_IT_TEIF0|DMA_IT_HTIF0|DMA_IT_TCIF0);//Çå¿ÕDMA1_Stream3éÏËùóDÖD¶Ï±êÖ¾
/* ÅäÖÃ DMA Stream */
DMA_InitStructure.DMA_Channel = DMA_Channel_3; //í¨μà3 I2S2ext_RXí¨μà
DMA_InitStructure.DMA_PeripheralBaseAddr = (u32)&I2S3ext->DR;//íaéèμØÖ·Îau32)&I2S2ext->DR>DR
DMA_InitStructure.DMA_Memory0BaseAddr = (u32)buf0;//DMA ′æ′¢Æ÷0μØÖ·
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory;//íaéèμ½′æ′¢Æ÷Ä£ê½
DMA_InitStructure.DMA_BufferSize = num;//êy¾Y′«êäá¿
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;//íaéè·ÇÔöá¿Ä£ê½
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;//′æ′¢Æ÷Ôöá¿Ä£ê½
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;//íaéèêy¾Y3¤¶è:16λ
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;//′æ′¢Æ÷êy¾Y3¤¶è£o16λ
DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;// ê1óÃÑ-»·Ä£ê½
DMA_InitStructure.DMA_Priority = DMA_Priority_Medium;//ÖDμèóÅÏ輶
DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable; //2»ê1óÃFIFOÄ£ê½
DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_1QuarterFull;
DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;//íaéèí»·¢μ¥′Î′«êä
DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;//′æ′¢Æ÷í»·¢μ¥′Î′«êä
DMA_Init(DMA1_Stream0, &DMA_InitStructure);//3õê¼»ˉDMA Stream
DMA_DoubleBufferModeConfig(DMA1_Stream0,(u32)buf1,DMA_Memory_0);//Ë«»o3åÄ£ê½ÅäÖÃ
DMA_DoubleBufferModeCmd(DMA1_Stream0,ENABLE);//Ë«»o3åÄ£꽿aÆô
DMA_ITConfig(DMA1_Stream0,DMA_IT_TC,ENABLE);//¿aÆô′«êäíê3éÖD¶Ï
NVIC_InitStructure.NVIC_IRQChannel = DMA1_Stream0_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority =0x00;//ÇàÕ¼óÅÏ輶0
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x00;//×óóÅÏ輶1
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;//ê1Äüía2¿ÖD¶Ïí¨μà
NVIC_Init(&NVIC_InitStructure);//ÅäÖÃ
}
一周热门 更多>