各位大侠,你们好,今天我用DMA做串口接收,DMA缓存最大只能设置128,我试着修改缓存为180或者256,都发生了硬件故障中断,难道DMA最大只能接收128的字节码?
void USARTDMA_DMA_Init(void)
{
DMA_InitTypeDef DMA_InitStructure;
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE);
DMA_DeInit(DMA1_Channel3);//USART2???DMA1?CH6
DMA_InitStructure.DMA_PeripheralBaseAddr = USART3_DR_Base;//DMA????????USART2?????????
DMA_InitStructure.DMA_MemoryBaseAddr = (u32)Uart_Rx;//DMA??????
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC;//??????
DMA_InitStructure.DMA_BufferSize = 128;//???DMA????
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;//?????????
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;//??????????
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;//???????8?
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;//???????8?
DMA_InitStructure.DMA_Mode = DMA_Mode_Normal;//???????
DMA_InitStructure.DMA_Priority = DMA_Priority_Medium;//DMA??????
DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;//??DMA????????
DMA_Init(DMA1_Channel3, &DMA_InitStructure);//???DMA1?CH6
DMA_Cmd(DMA1_Channel3, ENABLE);//??DMA1?CH6??
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>