完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
您好,就像提到的主题名称一样,当DMA将ADC转换成RAM时,ADC的结果缓冲区(ADC1BUF2)与RAM内的值不相等。这是我对DMA的初始化:DMA触发器是ADC中断,当转换完成时,我添加了一些图片来显示问题。尼昂已经面临这种行为?
以上来自于百度翻译 以下为原文 Hello, Like as the topic name mentioned, the result buffer (ADC1BUF2) of ADC are not equal with the values inside the ram, when DMA moves the ADC conversion into ram. This is my initialisation of DMA: DMA Trigger is ADC Interrupt, when conversion is done. I added some pictures to show the problem. void DMA_Enable(void) { /* DMACON */ /*****************************************/ /* Enable DMA Modul */ DMACONbits.DMAEN = 1; /* Channel Priority Scheme is Fixed */ DMACONbits.PRSSEL = 0; } void DMA_ADC_Init(uint16_t* destination) { /* Disable DMACH0 */ DMACH0bits.CHEN = 0; /* DMACH0 */ /*****************************************/ /* No dummy write */ DMACH0bits.NULLW = 0; /* Address and Count Reloaded for next operation */ DMACH0bits.RELOAD = 1; /* No software request */ DMACH0bits.CHREQ = 0; /* DMA Source is Peripheral Indirect Addressing and remains unchanged */ DMACH0bits.SAMODE = 3; /* DMA Destination remains unchanged after a transfer completion */ DMACH0bits.DAMODE = 0; /* Transfermode is repeated one shot mode */ DMACH0bits.TRMODE = 1; /* Data size is 16-bit */ DMACH0bits.SIZE = 0; /* DMA Source, Destination and Count */ DMASRC0 = &ADC1BUF2; // ADC1BUF2 DMADST0 = destination; DMACNT0 = 1; /* Enable DMACH0 */ DMACH0bits.CHEN = 1; /* DMAINT0 */ /*************************************************/ /* Channel Trigger is A/D Interrupt */ DMAINT0bits.CHSEL = 0b1010001; } Did anyone already faced with this behavior? Attached Image(s) |
|
相关推荐
2个回答
|
|
我假设“目的地”是图像中的“ADCY-TEMP”。了解您使用的确切MCU也是有用的。对于一个设备,可能存在与此相关的错误,而不是另一个。我怀疑您所看到的是ADC FIFO缓冲器的副作用。DMA会将一个值转移到目标缓冲区,随后的ADCXBUF读取将读取下一个值。硬件无法区分程序开始读取的差异,并开始使用与调试程序交互的“调试内核”代码读取。你必须相信硬件做正确的事情,特别是当你不能真正看到它正在使用的精确值时。(用勘误表验证这一点可以帮助。)苏珊
以上来自于百度翻译 以下为原文 I assume that 'destination' is what is shown as 'adc_temp' in the images. Also it is useful to know the exact MCU you are using - there may be errata related to this for one device but not another. I suspect that what you are seeing is a side-effect of the ADC FIFO buffer. The DMA will transfer a value out to your destination buffer and a subsequent read of the ADCxBUF will read the next value along. The hardware cannot tell the difference between begin read by your program and begin read by the 'debug kernel' code that is used to interact with the debugger. Sometimes you have to trust the hardware to be doing the right thing, especially when you can't actually see the exact values it is using. (Verifying this with the errata can help though.) Susan |
|
|
|
正如苏珊所说的,很多人认为监视窗口有一个秘密的后门,让它读取SFR寄存器,没有副作用。它没有,它以与你的代码完全相同的方式读取寄存器。读取FIFO缓冲器将从FIFO中删除数据。
以上来自于百度翻译 以下为原文 As Susan stated. Many people assume the Watch Window has a secret back door that lets it read SFR registers with no side effects. It does not, it reads the registers in exactly the same way your code does. Reading FIFO buffers will remove data from the FIFO. |
|
|
|
只有小组成员才能发言,加入小组>>
5170 浏览 9 评论
2001 浏览 8 评论
1931 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3176 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2228 浏览 5 评论
737浏览 1评论
622浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
509浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
635浏览 0评论
531浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-25 19:34 , Processed in 1.204960 second(s), Total 80, Slave 64 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号