uint16 DMABuff[65534];
#define I2C1_DR_Address ((u32)0x40005400+0x4c)
/*******************************************************************************
* Function Name : FSMC_DMA_Init
* 功能:初始化FSMC的DMA
* 参数:PeripheralBaseAddr外设地址,即图片存储地址
BufferSize为DMA传输数据量
*******************************************************************************/
void FSMC_DMA_Init(uint32 PeripheralBaseAddr,uint32 BufferSize)
{
DMA_InitTypeDef DMA_InitStructure;
/* DMA channel6 configuration */
DMA_DeInit(DMA1_Channel6);
DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32)(I2C1_DR_Address);
DMA_InitStructure.DMA_MemoryBaseAddr = (uint32)DMABuff;
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC;
DMA_InitStructure.DMA_BufferSize = 0xfffe;
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Enable;
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;
DMA_InitStructure.DMA_Mode = DMA_Mode_Normal;
DMA_InitStructure.DMA_Priority = DMA_Priority_High;
DMA_InitStructure.DMA_M2M = DMA_M2M_Enable;
DMA_Init(DMA1_Channel6, &DMA_InitStructure);
//允许发送完成中断
// DMA_NVICConfig();
DMA_Cmd(DMA1_Channel6, ENABLE);
}
然后发送部分就不会了 |