ATtiny461 questions

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I write small program for ATtiny461:

__C_task void main (void) {  
  unsigned char i;
  unsigned int tmp;
  unsigned long AdcSumma=0;
  ADCSRA = BIN(10010101); // ADC 250kHz,Fosc=8MHz
  ADCSRB = BIN(10000000); // bipolar mode entered 
  DIDR0 = BIN(11111111);// digital input disabled
  DIDR1 = BIN(11110000);
  ADMUX = BIN(10010010);// 1.1V ref,(ADC4-ADC3)*20
  Delay(100*ms);// wait for ADC stable
  SETBIT(ADCSRA,ADSC);while(CHKBIT(ADCSRA,ADSC));
  tmp = ADC;
  SaveToEeprom(tmp);
  SaveToEeprom(Modul(tmp));
  while(1);
}

As a result in EEPROM: tmp=0x03C6; Modul(tmp)=0x003A=58d;
Digital voltmeter measurement on pins for ADC4-ADC3 give: -6.7mV;
Now we can calculate expected result:
ADCin=6.7mV*20=134mV;
For Vref=1100mV ADCstep=1100mV/1024=1.07mV/step;
ADCout=134mV/1.07mV=125d.
So, calculating result=125d is two times higher, then ADC. Any ideas, why?

IV

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Digital voltmeter measurement on pins for ADC4-ADC3 give: -6.7mV;

You are WAY down in the mud here with your signal amplitude. What are the results at 25% of Vref? 50% 75%

Vref of 1.1V, eh? Internal Vref? Have you looked in the datasheet on what the speced range of that is? [Hint: It could account for all your puzzlement.] Have you measured it?

And you measured it with your calibrated and certified multimeter, right? ?? Not certified and calibrated you say?!? THAT could account for your puzzlement.

Your multimeter, no matter how well calibrated, is going to show you an average value of some type. You are sure that there is ABSOLUTELY NO RIPPLE on the signal or the reference voltage or on AVcc or on Gnd? [The last time we dug into one of these here a few weeks ago it turns out that there was in fact dozens of mV of ripple on the signal.]

Once you take care of all of that, you do realize that the specs on the differential conversion aren't nearly as good as on single-ended?

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Vref of 1.1V, eh? Internal Vref? Have you looked in the datasheet on what the speced range of that is? Have you measured it?

Internal 1.1V Vref cannot be measured directly, not connected to AREF pin. Simple StepUp converter with internal comparator as err amp has been created. Once pos comp input connected to internal Vref and converter is in regulation, the negative comp input keeps Vref voltage as 1.085 volt.
Quote:

And you measured it with your calibrated and certified multimeter, right? ?? Not certified and calibrated you say?!? THAT could account for your puzzlement.

I use VICTOR VC9808+ multimeter. It's good device. But maybe not so precise to up to 10mV measurements?
To inquire into this question I measured ADC4 and ADC3 signals as single ended. What is a result??? EEPROM give me VERY STABLE ADC conversion result as 0x0006 for ADC3-ADC4!!! It's GOOD!!! 6*(1080/1024)=6.3mV, VC9808+ give 6.7mV!!!
I think, battery not produce large ripple in 1ms measurement. I think a problem in other side. For example, how GSEL bit must be properly set for ADMUX= 010010??? If GSEL=0 EEPROM=0x3A; GSEL=1 EEPROM=0x5F. Again, it is very stable results!!! 5F is more closely to expected value, isn't it? Datasheet does not give exact instructions to GSEL but it value ALWAYS affect to measurements...
ATmega164 datasheet give me the suggestion do not use diff sig measurements with AREF<2V. But in my application witn ATtiny461 diff measurements unaffected to Vref and give identical result.
See attach as my simple sch.

Attachment(s): 

IV

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Have you mesured the offset? When measuring such low voltages, you have to take it in account. The datasheet doesn´t show any numbers on this, but you can read its value by reading ADC3-ADC3 (MUX4..0 = 010001).

Felipe Maimon

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The points that I'm trying to make are that there are a lot of sources of a few LSB of error here, especially on mV signals.

In particular, are you throwing away the results of the first conversion? Do a number of conversions, throw away the results of the first, and average the rest.

Yes, there can be ripple on mV signals.

If there are not op amps on the signal, then the source impedance can be high and a further discard of a conversion result should be done when changing mux values.

As I mentioned, re-test with a higher signal for your "calibration". A number of low bit errors from ripple, differential, offset errors, etc. can add up to many LSB.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Offset measurement in bipolar ADC mode with Mux=010001 give me ADC=0x03!!! Is it correct?

IV

Last Edited: Mon. Oct 22, 2007 - 03:05 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Is it correct?

That will be something that >>you<< will need to work out for yourself. For example, 250kHz ADC clock is outside of recommended values for best operation.

The '461 is relatively new and the datasheet does not have a lot of characterization data. I pulled up the Mega164 datasheet, and typical total error at 10x is 20LSB! As mentioned, there are a lot of individual sources for error, especially in differential and amplified. Many/most can be accounted for. Once that is taken care of I expect that linearity will be quite good.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In your code you have bipolar mode enabled:

ADCSRB = BIN(10000000); // bipolar mode entered 

so your max. range is +/-50% instead 100% now.
From Attiny461 datasheet page 159:
In the bipolar mode two-sided conversions are supported and the result is represented in the two's complement form.
In the unipolar mode the resolution is 10bits and the bipolar mode the resolution is 9 bits + 1 sign bit.

Szymon