请问华大的F460怎么DMA串口发送怎么设置为软件触发,像32那样 重新赋值发送的输出,使能通道就能发送
华大的MCU没找怎么设置使能通道就能发送 ,请问怎么设置呀
void dma_tx_init(void)
{
stc_dma_config_t stcDmaInit;
stc_irq_regi_conf_t stcIrqRegiCfg;
/* Enable peripheral clock */
PWC_Fcg0PeriphClockCmd(PWC_FCG0_PERIPH_DMA1 | PWC_FCG0_PERIPH_DMA2,Enable);
/* Enable DMA. */
DMA_Cmd(USART_DMA_UNIT,Enable);
/* Initialize DMA. */
MEM_ZERO_STRUCT(stcDmaInit);
stcDmaInit.u16BlockSize = 1u; /* 1 block */
stcDmaInit.u32SrcAddr = ((uint32_t)(send_buff)); /* Set source address. */
stcDmaInit.u32DesAddr = (uint32_t)(&USART_CH->DR); /* Set destination address. TDR*/
stcDmaInit.stcDmaChCfg.enSrcInc = AddressIncrease; /* Set source address mode. */
stcDmaInit.stcDmaChCfg.enDesInc = AddressFix; /* Set destination address mode. */
stcDmaInit.stcDmaChCfg.enIntEn = Enable; /* Enable interrupt. */
stcDmaInit.stcDmaChCfg.enTrnWidth = Dma8Bit; /* Set data width 8bit. */
stcDmaInit.u16TransferCnt = 64;
DMA_InitChannel(USART_DMA_UNIT, TX_DMA_CH, &stcDmaInit);
/* Enable the specified DMA channel. */
DMA_ChannelCmd(USART_DMA_UNIT, TX_DMA_CH, Disable);
/* Clear DMA flag. */
DMA_ClearIrqFlag(USART_DMA_UNIT, TX_DMA_CH, TrnCpltIrq);
/* Enable peripheral circuit trigger function. */
PWC_Fcg0PeriphClockCmd(PWC_FCG0_PERIPH_PTDIS,Enable);
/* Set DMA trigger source. */
DMA_SetTriggerSrc(USART_DMA_UNIT, TX_DMA_CH, TX_DMA_TRG_SEL);
/* Set DMA block transfer complete IRQ */
stcIrqRegiCfg.enIRQn = TX_DMA_BTC_INT_IRQn;
stcIrqRegiCfg.pfnCallback = &Dma_TX_IrqCallback;
stcIrqRegiCfg.enIntSrc = TX_DMA_BTC_INT_NUM;
enIrqRegistration(&stcIrqRegiCfg);
NVIC_SetPriority(stcIrqRegiCfg.enIRQn, DDL_IRQ_PRIORITY_DEFAULT);
NVIC_ClearPendingIRQ(stcIrqRegiCfg.enIRQn);
NVIC_EnableIRQ(stcIrqRegiCfg.enIRQn);
} |