测试条件:
1、使用DMA1 Stream1
2、RAM使用D2域的SRAM1,地址0x30000000以及D3域的SRAM4,地址0x38000000速。
测试代码:
#pragma location = 0x30000000
uint32_t SRC_Buffer[1000];
#pragma location = 0x30001000
uint32_t SRC_Buffer1[1000];
DMA_HandleTypeDef DMA_Handle;
__HAL_RCC_DMA1_CLK_ENABLE();
DMA_Handle.Instance = DMA1_Stream1;
DMA_Handle.Init.Request = DMA_REQUEST_MEM2MEM;
DMA_Handle.Init.Direction = DMA_MEMORY_TO_MEMORY;
DMA_Handle.Init.PeriphInc = DMA_PINC_ENABLE;
DMA_Handle.Init.MemInc = DMA_MINC_ENABLE;
DMA_Handle.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
DMA_Handle.Init.MemDataAlignment = DMA_PDATAALIGN_WORD;
DMA_Handle.Init.Mode = DMA_NORMAL;
DMA_Handle.Init.Priority = DMA_PRIORITY_VERY_HIGH;
DMA_Handle.Init.FIFOMode = DMA_FIFOMODE_ENABLE;
DMA_Handle.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
DMA_Handle.Init.MemBurst = DMA_MBURST_SINGLE;
DMA_Handle.Init.PeriphBurst = DMA_MBURST_SINGLE;
HAL_DMA_Init(&DMA_Handle);
HAL_NVIC_SetPriority(DMA1_Stream1_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(DMA1_Stream1_IRQn);
HAL_DMA_Start_IT(&DMA_Handle, (uint32_t)SRC_Buffer, (uint32_t)SRC_Buffer1, 1000);
HC574_TogglePin(GPIO_PIN_17); 《------------------此处开启一个IO翻转
void DMA1_Stream1_IRQHandler(void)
{
if((DMA1->LISR & DMA_FLAG_TCIF1_5) != RESET)
{ HC574_TogglePin(GPIO_PIN_17); 《------------------此处开启一个IO翻转
DMA1->LIFCR = DMA_FLAG_TCIF1_5;
}
}
测试1000个数据的复制粘贴耗时90.26us,基本就是11MHz的复制粘贴速度(地址是否自增,对其没有影响,下面的测试同理)。
QQ截图20190130015750.jpg (41.74 KB, 下载次数: 0)
下载附件
2019-1-30 01:58 上传 |