|
下面是我的设置,发不出
u8 test[2]={6,9}; //-------------------DMA设置--------- DMA_Cmd(DMA_Channel4,DISABLE); DMA_DeInit(DMA_Channel4); DMA_InitStructure.DMA_PeripheralBaseAddr=USART1_BASE+USART_Mode_Tx; DMA_InitStructure.DMA_MemoryBaseAddr=(u32)test; DMA_InitStructure.DMA_DIR = eripheralDST; DMA_InitStructure.DMA_BufferSize = 2; DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; 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_Circular; DMA_InitStructure.DMA_M2M = DMA_M2M_Disable; DMA_Init(DMA_Channel4,&DMA_InitStructure); DMA_Cmd(DMA_Channel4,ENABLE); while(!DMA_GetFlagStatus(DMA_FLAG_TC4)); //--------------------------串口------------------------------- USART_InitStructure.USART_BaudRate = 115200;//250000; USART_InitStructure.USART_WordLength = USART_WordLength_8b; USART_InitStructure.USART_StopBits = USART_StopBits_1; USART_InitStructure.USART_Parity = USART_Parity_No; USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None; USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; USART_InitStructure.USART_Clock = USART_Clock_Disable; USART_InitStructure.USART_CPOL = USART_CPOL_Low; USART_InitStructure.USART_CPHA = USART_CPHA_2Edge; USART_InitStructure.USART_LastBit = USART_LastBit_Disable; USART_Init(USART1, &USART_InitStructure); USART_ITConfig(USART1, USART_IT_RXNE, ENABLE); USART_DMACmd(USART1,USART_DMAReq_Tx, ENABLE); USART_Cmd(USART1, ENABLE); //---------------------开DMA时钟--------------------------- RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA,ENABLE); 发不出去不用DMA就可以 |
|