很奇怪,配置DMA1很正常。看datasheet也指明051有两路DMA。
在f0.h头文件找到的DMA2_Channel3,程序调用DMA_DeInit(DMA2_Channel3);就立马跳到HardFault_Handler
个人初步认为是寄存器地址的问题,不知道有没有碰到相同问题的,在.s里面好像也没找到DMA2的中断入口。
目前DMA1通道3在使用,求指导。附上代码
void MYDMA2_Init(void)
{
DMA_InitTypeDef DMA_InitStructure;
/* Enable the DMA peripheral */
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA2, ENABLE);
DMA_DeInit(DMA2_Channel3);
// DMA1 channels initial
/* DMA Configuration -------------------------------------------------------*/
DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)SPI1_DR_ADDRESS;
DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)&SendBuff[0];
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralDST;
DMA_InitStructure.DMA_BufferSize = SEND_SIZE;
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
DMA_InitStructure.DMA_Mode = DMA_Mode_Normal;
DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;
DMA_InitStructure.DMA_Priority = DMA_Priority_Medium;//优先级别为中级
DMA_Init(SPI1_TX_DMA2_CHANNEL, &DMA_InitStructure);
}
|