大家好,我想和大家分享一下最近发生在我身上的这个问题。我已经设置了ADC7(共享的一个)来完成4个通道的扫描转换。所有的都工作得很好。BTW:这个ADC与EC芯片家族相比非常好!但是,我时常遇到ODD异常。即使在调试模式下,我也无法在我的代码中找到原因。而且故障点总是变化的,这使我发疯!发生了什么事?阅读PIC32 MZ EF电气特性数据表,我发现ADC可以接受从-Vref到+Vref变化的电压作为模拟输入。在我的例子中,Avdd和Vdd(除了一个小LC滤波器)一样,我正在用22K的电阻读取从接地连接到AVdd的LDR上的电压。对于Vref和+VREF,我已经编程AVDD和地面。所以,显然,我尊重规范。至少静态地说,我发现你不能太靠近AVDD(或+VREF),否则会发生非常奇怪的行为!因此,我已经修改了我的硬件,以限制模拟输入电压小于Avdd。在我的情况下,AVDD是3.3V,因此我有有限的模拟输入到3V max。这样的例外已经消失了!我希望与其他用户分享,以避免他们也会变成奇怪的现象疯狂!编辑:实验结果告诉我,如果你不转换任何模拟输入,那么例外不会发生!只有当转换模拟输入时,例外才会很快或更晚出现。这将有助于使你更加疯狂!-)
以上来自于百度翻译
以下为原文
Hi all, I want to share with you this problem that happened to me recently.
I have setup the ADC7 (the shared one) to do a scan conversion of 4 channels.
All was working perfectly. BTW: this ADC is very good compared to EC chip family!
However from
time to time I have experienced ODD exceptions.
Even in Debug mode I wasn't able to find the cause in my code.
Moreover the point of failure changed always and this has made me crazy!
So what was happening?
Reading the PIC32 MZ EF data sheet on electrical characteristics I see that the ADC can accept as analog input a voltage that varies from -Vref to +Vref. In my case Avdd was the same as Vdd (apart a small LC filter) and I'm reading a voltage across an LDR connected from ground to AVdd with a 22K resistor. For -Vref and +Vref I have programmed AVdd and ground.
So, apparently I'm respecting the specifications. At least statically.
What I have discovered is that you CANNOT go too near AVdd (or +Vref) or very strange behaviors will happens!
Thus I have modified my hardware in order to limit the analog input voltages to less than Avdd. In my case the AVdd is 3.3v and thus I have limited analog inputs to 3v max.
This way the exceptions have been disappeared!
I wish to share this with other users in order to avoid that they will also become crazy about strange phenomena!
EDIT: Experimental results told me that if you do not convert any analog input then the exceptions doesn't happens! Only if you convert the analog input the exceptions will arise soon or later. This will contribute to make you even more crazy! :-)