The Cirrus EP9302 features a 5 channel, 12-bit Analog to Digital Converter with an analog multiplexer, having an input range of 0 to 3.3 V. The Cirrus A/D converter can do a maximum of 925 samples per second, and requires a settling time of 2 milliseconds between channel switches. The DIO Port pins 4 and 6 are connected to two of the EP9302 12-bit A/D converter inputs (ADC0 and ADC4, respectively). The A/D lines on the DIO1 header can be used to measure analog signals in the range of 0 to 3.3V.
To maintain 12-bit accuracy, the analog signal being measured must have a low source impedance (less than 10 ohms). Otherwise, an operational amplifier may need to be added to buffer the A/D input. For detailed information, please see the Cirrus EP9301 User's Guide, page 518.
The following steps outline the software execution to use the Cirrus A/D converter:
- Unlock the software lock before setting the TSEN bit in the ADCClk register by writing 0xAA to the ADCSWLock register (0x8090_00C0). “OR” in the TSEN bit (bit 31) to the ADCClkDiv register (0x8093_0090)
- Unlock the software lock (again) before OR'ing in the ADCEN (ADC clock enable, bit 31) to 0x8093_0080
- Clear bit 2, the ADCPD (ADC Power Down) bit, at 0x8093_0080. This bit MUST be set to 0 (see page 91 of the EP9301 User's Guide)
- After unlocking the software lock, write the channel's magic value (see Cirrus EP9301 User's Guide, table 20-2) to the ADCSwitch register (0x8090_0018) to select that channel for the next data acquisition
- Poll the ADCResult register (0x8090_0008) until bit 31 is not set
- Using a 32 bit read operation, read the result from 0x8090_0008, masking off the upper 16 bits
Interpreting Cirrus A/D Converter
The Cirrus on-chip A/D converter is a successive approximation A/D converter. Each A/D channel is calibrated on the EP9302 and these 16-bit values are stored in non-volatile EEPROM. These calibration values minimize the offset errors and gain errors in the EP9302 A/D. It is important for the user program to use these values as per our sample code, which can be found either on our website or in the CD included in the Developer's Kit. Two reference points, 0 and 2.5 Volts, with the corresponding reference values stored in EEPROM. Bytes 0x07EB through 0x07FE of the EEPROM hold a two dimensional array:
[channel number][0V ref. point, 2.5V ref. Point]
The reference points are stored as a 16 bit value, and should be used to correlate the values returned by the Cirrus A/D converter to voltage.
We have an example of using the EP9302 ADC here.