Replies: 6 comments
-
The more I dive into this the more I suspect there might be a bug somewhere. I have now found another gap in the quantization which is located at 1024. analogRead() is also missing datapoints 1024 and 1025. See the horizontal gap on the chart. Strangely enough these gaps happen exactly at the 10th and 11th power of 2 levels I tested my arduino sketch using If someone has a DB series handy with Dxcore and would be willing to reproduce the same problem that would be great. Do I have any alternative function to analogRead() to fix this as a work around? |
Beta Was this translation helpful? Give feedback.
-
10 bitsJust for the heck of it I tested this with 10 bits resolution. The result is the same. In this case the 512 adc data point is missing. Whatever the signal you send analogRead in 10 bits will never never never give you a 512. How strange. The top chart below is an histogram of the signal. Showing the 512 never happening. 13bitsUsing help ! |
Beta Was this translation helpful? Give feedback.
-
I downloaded arduino ide version 1.8.13 as instructed here. I compiled and the problem remains. I made my minimal testing code even more minimal. void setup() {
Serial.begin(38400);
Serial.println(F("# analog serial 001"));
analogReference(EXTERNAL);
analogReadResolution(10);
}
void loop() {
Serial.println(analogRead(AIN17));
delay(250);
} If you run this on a DB series and you manage to get it to output a 512 value please let me know. I am interested. |
Beta Was this translation helpful? Give feedback.
-
Some kind of progress. I feel alone here. Could someone say something? |
Beta Was this translation helpful? Give feedback.
-
Hi! |
Beta Was this translation helpful? Give feedback.
-
Thank you for the good pointer. I had to reduce the ADC clock speed to 800 from 1200 to make it work. I think DXcore should change the default clock speed when using EXTERNAL reference. Having defaults altering so much the signal |
Beta Was this translation helpful? Give feedback.
-
I am having a strange problem and I hope someone here can help.
Using an avr32db32 setup as 12bit all my analog readings have a gap between 2048 and 2051. i.e. the analogRead() function never returns anything from 2048,2049,2050,2051. It seems to replace them with 2047 instead.
See below and example where I am reading a waveform.
See the gap in the middle with the four values being stuck to 2047. The waveform I am sending here has a proper waveform shape. See the same signal shown on our oscilloscope below. So the arte fact on my chart is not real as the scope shows a proper waveform.
To rule out my electronic circuitry from the AC signal I took a DC signal this time and got the same results.

Again we can see this gap between 2048 and 2051. No matter what we do the mcu never gives anything from 2048 to 2051.
I made a bare minimum Arduino code collecting data that are shown on my above charts. There is not much to it really. Plain analogRead and print almost.
This is my schematic below. There is a 24Mhz crystal. AVDD has its decoupling cap right next to it. My analog reference is a 3V MCP1501.
I tested other analog pins. Same things. I also tested with avr32db28. Same thing. My Dxcore version is 1.5.11.
I have now spent several hours on this problems and if someone has an idea to help me solving this I am a taker.
Beta Was this translation helpful? Give feedback.
All reactions