问答

汇集网友智慧,解决技术难题

woai32lala

TA的家园币:89  

  • F460 DMA串口发送 软件AOS触发问题

    #defineUSART_DMA_UNIT(M4_DMA1)#defineRX_DMA_CH(DmaCh0)#defineRX_DMA_TRG_SEL(EVT_USART1_RI)#defineTX_DMA_CH(DmaCh1)#defineTX_DMA_TRG_SEL(EVT_USART1_TI)/*DMAblocktransfercompleteinterrupt*/#defineRX_DMA_BTC_INT_NUM(INT_DMA1_TC0)#defineRX_DMA_BTC_INT_IRQn(Int006_IRQn)#defineTX_DMA_BTC_INT_NUM(INT_DMA1_TC1)#defineTX_DMA_BTC_INT_IRQn(Int005_IRQn)voiddma_tx_init(void){stc_dma_config_tstcDmaInit;stc_irq_regi_conf_tstcIrqRegiCfg;/*Enableperipheralclock*/PWC_Fcg0PeriphClockCmd(PWC_FCG0_PERIPH_DMA1|PWC_FCG0_PERIPH_DMA2,Enable);/*EnableDMA.*/DMA_Cmd(USART_DMA_UNIT,Enable);/*InitializeDMA.*/MEM_ZERO_STRUCT(stcDmaInit);stcDmaInit.u16BlockSize=10u;/*1block*/stcDmaInit.u32SrcAddr=((uint32_t)(send_buff));/*Setsourceaddress.*/stcDmaInit.u32DesAddr=(uint32_t)(&USART_CH->DR);/*Setdestinationaddress.TDR*/stcDmaInit.stcDmaChCfg.enLlpEn=Disable;/*Disablelinkedlisttransfer.*/stcDmaInit.stcDmaChCfg.enSrcInc=AddressIncrease;/*Setsourceaddressmode.*/stcDmaInit.stcDmaChCfg.enDesInc=AddressFix;/*Setdestinationaddressmode.*/stcDmaInit.stcDmaChCfg.enIntEn=Enable;/*Enableinterrupt.*/stcDmaInit.stcDmaChCfg.enTrnWidth=Dma8Bit;/*Setdatawidth8bit.*/stcDmaInit.u16TransferCnt=1;DMA_InitChannel(USART_DMA_UNIT,TX_DMA_CH,&stcDmaInit);/*EnablethespecifiedDMAchannel.*/DMA_ChannelCmd(USART_DMA_UNIT,TX_DMA_CH,Enable);/*ClearDMAflag.*/DMA_ClearIrqFlag(USART_DMA_UNIT,TX_DMA_CH,TrnCpltIrq);/*Enableperipheralcircuittriggerfunction.*/PWC_Fcg0PeriphClockCmd(PWC_FCG0_PERIPH_PTDIS,Enable);/*SetDMAtriggersource.*/DMA_SetTriggerSrc(USART_DMA_UNIT,TX_DMA_CH,EVT_AOS_STRG);/*SetDMAblocktransfercompleteIRQ*/stcIrqRegiCfg.enIRQn=TX

  • F460 DMA串口发送 软件AOS触发问题

    F460的DMA串口发送软件AOS触发不了#defineUSART_DMA_UNIT(M4_DMA1)#defineRX_DMA_CH(DmaCh0)#defineRX_DMA_TRG_SEL(EVT_USART1_RI)#defineTX_DMA_CH(DmaCh1)#defineTX_DMA_TRG_SEL(EVT_USART1_TI)/*DMAblocktransfercompleteinterrupt*/#defineRX_DMA_BTC_INT_NUM(INT_DMA1_TC0)#defineRX_DMA_BTC_INT_IRQn(Int006_IRQn)#defineTX_DMA_BTC_INT_NUM(INT_DMA1_TC1)#defineTX_DMA_BTC_INT_IRQn(Int005_IRQn)voiddma_tx_init(void){stc_dma_config_tstcDmaInit;stc_irq_regi_conf_tstcIrqRegiCfg;/*Enableperipheralclock*/PWC_Fcg0PeriphClockCmd(PWC_FCG0_PERIPH_DMA1|PWC_FCG0_PERIPH_DMA2,Enable);/*EnableDMA.*/DMA_Cmd(USART_DMA_UNIT,Enable);/*InitializeDMA.*/MEM_ZERO_STRUCT(stcDmaInit);stcDmaInit.u16BlockSize=10u;/*1block*/stcDmaInit.u32SrcAddr=((uint32_t)(send_buff));/*Setsourceaddress.*/stcDmaInit.u32DesAddr=(uint32_t)(&USART_CH->DR);/*Setdestinationaddress.TDR*/stcDmaInit.stcDmaChCfg.enLlpEn=Disable;/*Disablelinkedlisttransfer.*/stcDmaInit.stcDmaChCfg.enSrcInc=AddressIncrease;/*Setsourceaddressmode.*/stcDmaInit.stcDmaChCfg.enDesInc=AddressFix;/*Setdestinationaddressmode.*/stcDmaInit.stcDmaChCfg.enIntEn=Enable;/*Enableinterrupt.*/stcDmaInit.stcDmaChCfg.enTrnWidth=Dma8Bit;/*Setdatawidth8bit.*/stcDmaInit.u16TransferCnt=1;DMA_InitChannel(USART_DMA_UNIT,TX_DMA_CH,&stcDmaInit);/*EnablethespecifiedDMAchannel.*/DMA_ChannelCmd(USART_DMA_UNIT,TX_DMA_CH,Enable);/*ClearDMAflag.*/DMA_ClearIrqFlag(USART_DMA_UNIT,TX_DMA_CH,TrnCpltIrq);/*Enableperipheralcircuittriggerfunction.*/PWC_Fcg0PeriphClockCmd(PWC_FCG0_PERIPH_PTDIS,Enable);/*SetDMAtriggersource.*/DMA_SetTriggerSrc(USART_DMA_UNIT,TX_DMA_CH,EVT_AOS_STRG);/*SetDMAblocktransfercomp

  • 请问华大MCUF460JETA怎么设置DMA为软件触发

    请问现在只能通过串口发送,用发送完成中断触发DMA发送,请问怎么用软件触发DMA发送跟32一样使能通道重置发送数。还有请问stcIrqRegiCfg.enIRQn是代表中断优先级么这个是代表什么stcIrqRegiCfg.enIntSrc我看到最后都是说中断的枚举号,请大佬指点一下DMA_ChannelCmd(USART_DMA_UNIT,TX_DMA_CH,Disable);[/td]DMA_ClearIrqFlag(USART_DMA_UNIT,TX_DMA_CH,TrnCpltIrq);[/td]/*SetDMAblocktransfercompleteIRQ*/stcIrqRegiCfg.enIRQn=TX_DMA_BTC_INT_IRQn;stcIrqRegiCfg.pfnCallback=&Dma_TX_IrqCallback;stcIrqRegiCfg.enIntSrc=TX_DMA_BTC_INT_NUM;enIrqRegistration(&stcIrqRegiCfg);