如题,现在使用STM32F407,TIM4输入捕获,触发DMA,外设地址到存储器地址。外设地址为TIM9->CNT
DMA_DeInit(DMA1_Stream0);
DMA_InitStructure.DMA_Channel = DMA_Channel_2;
DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)(&TIM9->CNT); // (uint32_t)(&TIM4->CNT); //DMAÍâÉèµØÖ·
DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)time1;
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory;
DMA_InitStructure.DMA_BufferSize = 2;
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_PeripheralDataSize_Word;
DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;
DMA_InitStructure.DMA_Priority = DMA_Priority_High;
DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable;
DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full;
DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;
DMA_Init(DMA1_Stream0, &DMA_InitStructure);
DMA_Cmd(DMA1_Stream0, ENABLE);
TIM4_ICInitStructure.TIM_Channel = TIM_Channel_1;
TIM4_ICInitStructure.TIM_ICPolarity = TIM_ICPolarity_Rising;
TIM4_ICInitStructure.TIM_ICSelection = TIM_ICSelection_DirectTI;
TIM4_ICInitStructure.TIM_ICPrescaler = TIM_ICPSC_DIV1;
TIM4_ICInitStructure.TIM_ICFilter = 0x00;
TIM_ICInit(TIM4, &TIM4_ICInitStructure);
TIM_DMACmd(TIM4, TIM_DMA_CC1, ENABLE);
TIM_Cmd(TIM4, ENABLE);
看DMA框图,应该是可以访问到任何外设的。但是DMA_PeripheralBaseAddr是TIM4时,可以正常读入;是TIM9时不能正常读取。
求助,thk
|