[mw_shl_code=c,true] hdma_uart7_rx.Instance = DMA1_Stream3;
hdma_uart7_rx.Init.Channel = DMA_CHANNEL_5;
hdma_uart7_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
hdma_uart7_rx.Init.PeriphInc = DMA_PINC_DISABLE;
hdma_uart7_rx.Init.MemInc = DMA_MINC_DISABLE;
hdma_uart7_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
hdma_uart7_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
hdma_uart7_rx.Init.Mode = DMA_NORMAL;
hdma_uart7_rx.Init.Priority = DMA_PRIORITY_VERY_HIGH;
hdma_uart7_rx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
hdma_uart7_rx.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
hdma_uart7_rx.Init.MemBurst = DMA_MBURST_SINGLE;
hdma_uart7_rx.Init.PeriphBurst = DMA_PBURST_SINGLE;
HAL_DMA_Init(&hdma_uart7_rx);[/mw_shl_code]
上面没有一个是设置目的地址和源地址的,只有下面这句
[mw_shl_code=c,true] __HAL_LINKDMA(huart,hdmarx,hdma_uart7_rx);[/mw_shl_code]
具体的宏是
[mw_shl_code=c,true]#define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__)
do{
(__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__);
(__DMA_HANDLE__).Parent = (__HANDLE__);
} while(0)[/mw_shl_code]
不是很理解,我换成
hdma_uart7_rx.Instance->
AR=(uint32_t)&UART7->RDR;
然后用printf打印出来是0
[mw_shl_code=c,true]buff11[2]=(uint32_t)hdma_uart7_rx.Instance->
AR;//->
AR;
printf("
%x",buff11[2]);[/mw_shl_code]
还望原子哥指点迷津,F7的HAL好难搞啊
STM32F4的是:
DMA2_Stream1->CR|=0<<6; //外设到存储器模式
CR寄存器的第六位.
你自己找吧.
---------------------------------
目的地址没有设置
一周热门 更多>