完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
以前用STM32F1的时候串口DMA接收方式解决断帧的问题需要修改一个地方 但是用HC32F460没有这两个函数不知道怎么弄了 问题解决了,改了3个地方 |
|
相关推荐
4个回答
|
|
用DMA链表 头尾相接
2个buffer进行乒乓 stc_dma_llp_descriptor_t AudioDmaLLP[2] = { { .SARx = (uint32_t)(&Sin1K32767[0]), .DARx = (uint32_t)(&I2S_CH->TXBUF), .DTCTLx_f.CNT = 960, .DTCTLx_f.BLKSIZE = 1, .LLPx = (uint32_t)(&AudioDmaLLP[1]), .CHxCTL_f.SINC = AddressIncrease, .CHxCTL_f.DINC = AddressFix, .CHxCTL_f.HSIZE = Dma16Bit, .CHxCTL_f.LLPEN = Enable, .CHxCTL_f.LLPRUN = LlpWaitNextReq, .CHxCTL_f.IE = Enable, }, { .SARx = (uint32_t)(&Sin1K32767[0]), .DARx = (uint32_t)(&I2S_CH->TXBUF), .DTCTLx_f.CNT = 960, .DTCTLx_f.BLKSIZE = 1, .LLPx = (uint32_t)(&AudioDmaLLP[0]), .CHxCTL_f.SINC = AddressIncrease, .CHxCTL_f.DINC = AddressFix, .CHxCTL_f.HSIZE = Dma16Bit, .CHxCTL_f.LLPEN = Enable, .CHxCTL_f.LLPRUN = LlpWaitNextReq, .CHxCTL_f.IE = Enable, }}; static void I2S2_DMATxCplt(void) { rt_interrupt_enter(); /* enter interrupt */ DMA_ClearIrqFlag(DMA_UNIT, DMA_CH, TrnCpltIrq); if (BufferEndCallBack && BufferEndParam) { uint32_t index; if (DMA_UNIT->LLP2 == (uint32_t)&AudioDmaLLP[0]) { index = 1; } else { index = 0; } BufferEndCallBack(BufferEndParam, index); } rt_interrupt_leave(); /* leave interrupt */ } static void FirstDMAConfig(stc_dma_llp_descriptor_t *first) { stc_dma_config_t stcDmaCfg; MEM_ZERO_STRUCT(stcDmaCfg); /* Disable DMA1. */ // DMA_Cmd(DMA_UNIT, Disable); DMA_ClearIrqFlag(DMA_UNIT, DMA_CH, BlkTrnCpltIrq); DMA_ClearIrqFlag(DMA_UNIT, DMA_CH, TrnCpltIrq); stcDmaCfg.u16BlockSize = 1u; // uint16 stcDmaCfg.u16TransferCnt = first->DTCTLx_f.CNT; stcDmaCfg.u32SrcAddr = first->SARx; stcDmaCfg.u32DesAddr = (uint32_t)(&I2S_CH->TXBUF); stcDmaCfg.stcDmaChCfg.enLlpEn = Enable; stcDmaCfg.stcDmaChCfg.enLlpMd = LlpWaitNextReq; stcDmaCfg.u32DmaLlp = first->LLPx; stcDmaCfg.stcDmaChCfg.enSrcRptEn = Disable; stcDmaCfg.stcDmaChCfg.enDesRptEn = Disable; stcDmaCfg.stcDmaChCfg.enSrcInc = AddressIncrease; stcDmaCfg.stcDmaChCfg.enDesInc = AddressFix; stcDmaCfg.stcDmaChCfg.enIntEn = Enable; stcDmaCfg.stcDmaChCfg.enTrnWidth = Dma16Bit; PWC_Fcg0PeriphClockCmd(PWC_FCG0_PERIPH_DMA1, Enable); DMA_Cmd(DMA_UNIT, Enable); DMA_InitChannel(DMA_UNIT, DMA_CH, &stcDmaCfg); DMA_ChannelCmd(DMA_UNIT, DMA_CH, Enable); PWC_Fcg0PeriphClockCmd(PWC_FCG0_PERIPH_AOS, Enable); DMA_SetTriggerSrc(DMA_UNIT, DMA_CH, EVT_I2S2_TXIRQOUT); stc_irq_regi_conf_t stcIrqRegiCfg; MEM_ZERO_STRUCT(stcIrqRegiCfg); stcIrqRegiCfg.enIRQn = I2S2_DMA_TXC_INT_IRQn; stcIrqRegiCfg.pfnCallback = I2S2_DMATxCplt; stcIrqRegiCfg.enIntSrc = I2S2_DMA_TXC_INT_NUM; enIrqRegistration(&stcIrqRegiCfg); NVIC_SetPriority(stcIrqRegiCfg.enIRQn, DDL_IRQ_PRIORITY_DEFAULT); NVIC_ClearPendingIRQ(stcIrqRegiCfg.enIRQn); NVIC_EnableIRQ(stcIrqRegiCfg.enIRQn); } |
|
|
|
|
|
你这是裸机程序,我用的是rt-thread的dma驱动,裸机都好处理,rt-thread驱动不知道修改
|
|
|
|
我看你的截图以为你要实现像stm32的半完成中断 和完成中断的样子
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
504 浏览 0 评论
1594 浏览 0 评论
如何使用python调起UDE STK5.2进行下载自动化下载呢?
2139 浏览 0 评论
开启全新AI时代 智能嵌入式系统快速发展——“第六届国产嵌入式操作系统技术与产业发展论坛”圆满结束
2659 浏览 0 评论
获奖公布!2024 RT-Thread全球巡回线下培训火热来袭!报名提问有奖!
28908 浏览 11 评论
72104 浏览 21 评论
浏览过的版块 |
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-8 12:24 , Processed in 0.654350 second(s), Total 75, Slave 58 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号