正在测试STM32F207的DMA,发现一个莫名奇妙的问题。
DMA配置如下所示,外部SRAM是16位的长度,内部DST_Buffer是uint16_t。
按如下所示的程序配置,进行外部SRAM-》DST_Buffer DMA操作,结果正确。
但是反过来进行DST_Buffer -》外部SRAM操作的话,结果就会发生错误。
DST_Buffer的数据 0x1234 0x5678 传输传到外部SRAM的结果是 0x1212 , 0x5656 。 这是什么状况?
/* Configure DMA2 Stream 0 */
DMA_InitStructure.DMA_Channel = DMA_Channel_0;
DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)0x60000000;
DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)DST_Buffer;
DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToMemory;
DMA_InitStructure.DMA_BufferSize = (uint32_t)BUFFER_SIZE_DMA;
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_PeripheralDataSize_HalfWord;
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_Full;
DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;
DMA_Init(DMA_STREAM, &DMA_InitStructure); |