完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
你好,
我使用PSoC5LP。CYMADIP,最新版本(1.7)。PSoC创建者4.1。 我重复配置相同的DMA链来运行Delta Sigma ADC数据的单次收集。DMA是由ADC的EOC触发的,ADC的SOC是由PWM触发的。下面配置了配置DMA的代码。我确保在执行该代码之前停止PWM,PWM输出和DS EOC输出低而不脉冲。在配置完成后启用PWM。 问题是,在调用CydMaChanEnable()之后的初始运行之后,DMA看起来是活动的(通过上次调用CyDmaChStatus返回的状态)。 已设置位1,并且我看到DMA缓冲器中的第一个字发生了变化。没有其他事情发生,直到我启用PWM -在这一点上,数据开始填充从缓冲区中的第二个字开始。 现在,如果在启用PWM之前两次调用下面的序列,那么它的第二次调用导致DMA在CydMaChanEnable()之后保持空闲,并且DMA序列正确地开始感觉到第一缓冲器位置。也就是说,我有一个解决办法。但这种行为没有意义。我尝试了各种各样的东西(见评论留置权- CydMaDabeles,CyDmaClearPendingDrq)-都无济于事。我甚至尝试释放和重新初始化DMA通道本身——也没有运气。 我们将不胜感激。 —— IDMA16CONFIG(UINT16 LEN) { Uti8TD,状态; UIT32 POS; UTIT32 TXX尺寸; UIT32 IDX; 最后一次; /检查当前状态-如果不空闲,发送终止请求并完成旋转 CydMaChanState(A.D.S. DMACHAN); 如果(状态和3){ CyDmaChSetRequest(S.DydDaMaChana,Cyth-DMAiPcPuthTym链); } 做{ CydMaChanState(A.D.S. DMACHAN); //FixMe-处理超时 }(状态和3); /CydMcLaLeLeDigReDQ(γDSD); / / CydMaCabdiable( /CydMcLaLeLeDigReDQ(γDSD); /建立一个描述符链以支持完整的传输长度 POS=0; Idx=0; 而(POS & lt;ln){ 如果(Lon POS & Gt;2000){ TXZ大小=2000; 最后=0; }否则{ TXZ大小= LeN-POS; 最后=1; } CydMatdStSt设置(αDSDSMAJTD[IDX]) TXYSIZE * SIZEOF(UIT16) 最后?Cyth-DMAYDISABLYTD:{DSY-DMAYTTD[IDX+1〕, Cyth-DMAY-TdIn?CydSdAdAdR(最后)?DSY-DMAYA TdTyMutOtEnEN:0); CydMatdStAdt({DSY-DMAYTD)[IDX],Lo16((UIT32)DSAADCL DECH SAMPIPPTR),Lo16((UIT32)和GyAdcTraceBuBuf[PoS]); IDX ++; Ps+=Txx大小; } CyDmaChSetInitialTd(0); /CydMcLaLeLeDigReDQ(γDSD); CydMaunTable(1); CydMaChanState(A.D.S. DMACHAN); } 以上来自于百度翻译 以下为原文 Hi, I am using PSOC5LP. cy_dma IP, latest revision (1.7). PSOC Creator 4.1. I repeatedly configure the same DMA chain to run a single pass collecting of a Delta-Sigma ADC data. The DMA is triggered by ADC's EOC, and ADC's SOC is triggered by PWM. The code to configure the DMA is pasted below. I ensure that PWM is stopped before that code is executed and that PWM output and DS EOC output are low and not pulsing. I enable the PWM after the configuration is complete. The problem is that for every run after the initial one, right after CyDmaChanEnable() is called, the DMA appears to go active (state returned by last call to CyDmaChStatus has bit 1 set and I see that the very first word in the DMA buffer changes. Nothing else happens until I enable the PWM - at that point, data starts filling in starting from the second word in the buffer. Now, if I call the below sequence twice before enabling the PWM, then the second invocation of it results in DMA remaining idle after CyDmaChanEnable() and DMA sequence properly starting to feel at the first buffer location. I.e., I have a workaround. But the behavior does not make sense. I tried various things (see commented liens - CyDmaChDisable, CyDmaClearPendingDrq) - all to no avail. I even tried releasing and reinitializing the DMA channel itself - also without luck. Help would be much appreciated. -- int dma_config(uint16 len) { uint8 td, state; uint32 pos; uint32 tx_size; uint32 idx; uint8 last; // check the current state - if not idle, send a termination request and spin on completion CyDmaChStatus(_ds_dma_chan, &td, &state); if (state & 3) { CyDmaChSetRequest(_ds_dma_chan, CY_DMA_CPU_TERM_CHAIN); } do { CyDmaChStatus(_ds_dma_chan, &td, &state); // FIXME - handle a timeout } while (state & 3); //CyDmaClearPendingDrq(_ds_dma_chan); //CyDmaChDisable(_ds_dma_chan); //CyDmaClearPendingDrq(_ds_dma_chan); // build a chain of descriptors to support full transfer length pos = 0; idx = 0; while (pos < len) { if (len-pos > 2000) { tx_size = 2000; last = 0; } else { tx_size = len - pos; last = 1; } CyDmaTdSetConfiguration(_ds_dma_td[idx], tx_size * sizeof(uint16), last ? CY_DMA_DISABLE_TD : _ds_dma_td[idx+1], CY_DMA_TD_INC_DST_ADR | (last ? DS_DMA__TD_TERMOUT_EN : 0)); CyDmaTdSetAddress(_ds_dma_td[idx], LO16((uint32)DS_ADC_DEC_SAMP_PTR), LO16((uint32)&g_adc_trace_buf[pos])); idx++; pos += tx_size; } CyDmaChSetInitialTd(_ds_dma_chan, _ds_dma_td[0]); //CyDmaClearPendingDrq(_ds_dma_chan); CyDmaChEnable(_ds_dma_chan, 1); CyDmaChStatus(_ds_dma_chan, &td, &state); } |
|
相关推荐
3个回答
|
|
|
|
|
|
|
|
|
希玛-我该怎么做?在任何地方都看不到附加选项 以上来自于百度翻译 以下为原文 Hima - how can I do that? Don't see an attach option anywhere |
|
|
|
|
|
使用先进的编辑器,您可以附加文件与“纸夹”在右下角。您可以在这个选项中附上项目的ZIP文件。 要做到这一点,在PSoC创建者中使用Cealth-Gt;文件-gt;创建工作空间束(最小值)。 以上来自于百度翻译 以下为原文 using the advanced editor you can attach a file with the "paperclip" in the right below corner.. You can attach a zip file with your project in this option. To do so, use Creator->File->Create Workspace Bundle (minimal) in PSoC creator. |
|
|
|
|
只有小组成员才能发言,加入小组>>
788个成员聚集在这个小组
加入小组cyUSB3014一直显示2.1,不能到3.0情况,谁遇到过
7459 浏览 0 评论
2492 浏览 1 评论
2184 浏览 1 评论
4046 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
2095 浏览 6 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
7946浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
6518浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
760浏览 2评论
736浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
8370浏览 2评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-17 16:47 , Processed in 0.886480 second(s), Total 75, Slave 59 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
563