浏览代码

set DMA_Configuration.DMA_BufferSize to 1

DMA_Init asserts DMA_BufferSize >=1.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1822 bbd45198-f89e-11dd-88c7-29a3b14d5316
chaos.proton@gmail.com 13 年之前
父节点
当前提交
fe3b233de4
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      bsp/stm32f10x/usart.c

+ 5 - 1
bsp/stm32f10x/usart.c

@@ -239,8 +239,12 @@ static void DMA_Configuration(void)
 	DMA_DeInit(UART3_TX_DMA);
 	DMA_InitStructure.DMA_PeripheralBaseAddr = USART3_DR_Base;
 	DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralDST;
+	/* As we will set them before DMA actually enabled, the DMA_MemoryBaseAddr
+	 * and DMA_BufferSize are meaningless. So just set them to proper values
+	 * which could make DMA_Init happy.
+	 */
 	DMA_InitStructure.DMA_MemoryBaseAddr = (u32)0;
-	DMA_InitStructure.DMA_BufferSize = 0;
+	DMA_InitStructure.DMA_BufferSize = 1;
 	DMA_Init(UART3_TX_DMA, &DMA_InitStructure);
 	DMA_ITConfig(UART3_TX_DMA, DMA_IT_TC | DMA_IT_TE, ENABLE);
 	DMA_ClearFlag(DMA1_FLAG_TC2);