32的dma中断可以进 但是判断不了中断标志 然后就卡住了
下面是dma的配置 和中断服务函数
- /* DMA2 Stream0 channel2 configuration **************************************/
- DMA_InitStructure.DMA_Channel = DMA_Channel_2;
- DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)ADC3_DR_ADDRESS;
- DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)ADC3Value;
- DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory;
- DMA_InitStructure.DMA_BufferSize = 1000;
- DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
- DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
- DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Word;
- DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Word;
- DMA_InitStructure.DMA_Mode =DMA_Mode_Normal;
- DMA_InitStructure.DMA_Priority = DMA_Priority_High;
- DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable;
- DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_HalfFull;
- DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
- DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;
- DMA_Init(DMA2_Stream0, &DMA_InitStructure);
-
- DMA_ITConfig(DMA2_Stream0, DMA_IT_TC ,ENABLE);
- DMA_Cmd(DMA2_Stream0, ENABLE);
-
-
- NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
- NVIC_InitStructure.NVIC_IRQChannel = DMA2_Stream0_IRQn;
- NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;
- NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;
- NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
- NVIC_Init(&NVIC_InitStructure);
复制代码- void DMA2_Stream0_IRQHandler()
- {
-
- if (DMA_GetITStatus(DMA2_Stream0,DMA_FLAG_TCIF0))
- {
- if (dma_flag == 0)
- {
-
- dma_flag = 1;
- arm_copy_q31(ADC3Value,ADC3Voltage,1000);
- }
- DMA_ClearITPendingBit(DMA2_Stream0,DMA_FLAG_TCIF0);
- }
-
- }
复制代码
求大神帮忙啊~
|