Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ADC unit tests on Xplain using DAC Documentation

Introduction

This is the unit test for the XMEGA ADC driver using the chip DAC as an analog input voltage. The test requires the following external connection on the board that runs the tests:

  • (PA1, PA3, PA5, PA7) connected together (J2 on XMEGA-A1 Xplained board)
  • (PA0, PA2, PA4, PA6) connected together (J2 on XMEGA-A1 Xplained board)

The DAC outputs are available on PA2 and PA3, leaving two groups of four ADC pins connected to the two DAC output pins.

As there will be variations in the value output on the DAC output and the ADC input, all test measurements will have a range of acceptable values that lie above and below the expected value. The size of this range can be configured in the conf_test.h header file and have separate ranges for 8-bit and 12-bit results.

Single ended tests (12-bit mode):

  1. DACA0 successively set to minimum, half of maximum and maximum
    • Measure ADC0, ADC2, ADC4 and ADC6
  2. DACA1 successively set to minimum, half of maximum and maximum
    • Measure ADC1, ADC3, ADC5 and ADC7

Single ended tests (8-bit mode):

  • Same as 12-bit mode, but range is modified to fit 8-bit range.

Differential test (12-bit mode):

  1. DACA0 and DACA1 set to half of maximum in order to get a differential zero
    • Measure differential pairs ADC0/ADC1, ADC2/ADC3, ADC4/ADC5 and ADC6/ADC7
  2. DACA0 set to maximum, DACA1 set to minimum to get maximum positive value
    • Measure differential pairs ADC0/ADC1, ADC2/ADC3, ADC4/ADC5 and ADC6/ADC7
  3. DACA0 set to minimum, DACA1 set to maximum to get maximum negative value
    • Measure differential pairs ADC0/ADC1, ADC2/ADC3, ADC4/ADC5 and ADC6/ADC7

Differential with gain test (12-bit mode):

  1. Set DACA0 and DACA1 to gain adjusted value that should give a ADC input value of half maximum positive value
    • Measure differential pairs ADC4/ADC5 and ADC6/ADC7

Main Files

Device Info

This example has been tested with the following setup(s):

  • XMEGA-A1 Xplained - should also work on the XMEGA-A3BU Xplained with the same external connections

Description of the unit tests

See the documentation for the individual unit test functions here for detailed descriptions of the tests.

Dependencies

This example depends directly on the following modules:

Compilation info

This software was written for the GNU GCC and IAR for AVR. Other compilers may or may not work.

Contact Information

For further information, visit Microchip.