Archive for the ‘XMEGA’ Category

atxmega128a1 DAC is nonlinear and inaccurate when reference is above 2.4V or Vcc – 0.6V

Thursday, March 12th, 2009

I started experimenting with the new ATMEL atxmega128a1 chip, when I noticed a strange noise in the signal generated by the DAC example (atmel application note AVR1301: Using the XMEGA DAC). I captured the signal with a Rigol VS5042 Digital Storage Oscilloscope:

XMEGA DAC problem

You can clearly see the noise at the bottom of the sawtooth signal.

The setup:

  • STK600 (Target Voltage 3.6V)
  • TQFP100 Package
  • ATMEGA128A1
  • AVR Studio 4.15
  • WINAVR 20080610
  • Rigol VS5042 Digital Storage Oscilloscope
  • AVR1301 example in C

I thought there was a mistake in the example program, and was about to review it, when I found the following note in the Errata section of the atmega128a1 preliminary datasheet:

“DAC is nonlinear and inaccurate when reference is above 2.4V or Vcc – 0.6V”

So I went back to AVR Studio and set the target voltage of the STK500 (and the target device) to 2.0V, and the problem does not appear:

DAC solved

I assume the VREF used by the example program is internal, so lowering the voltage of the target device is the setup that fixes the problem. I will change the example program to use external VREF and see if it is possible to power the target with 3.3V and lower VREF to 2.0V and see if the problem can be fixed as well. The ATMEL documentation says that there is no workaround to this problem, and they recommend using VREF below 2.4V or Vcc – 0.6V

The XMEGA is a very advanced and interesting device. The only disadvantage is that it is very difficult to get good documentation, user experiences, etc. So I will be preparing different settings and publishing the results.

Update: I checked the source code and VREF was set to AVCC, and AVCC = Target Voltage. That is why the only way to change VREF to 2.0V was to lower the complete target board (STK600) voltage to 2.0V. I modified the source code to use external VREF for DAC channel A, and the result is that I can set the target board voltage to 3.5V and VREF to 2.0V and now the example works ok, without noise in the SAWTOOTH signal.

DAC external AREF

DSO channel 1 (yellow) is the sawtooth signal output, with Vmax = 2.0V and channel 2 (blue) is VTarget, with Vmax = 3.5V.