Kopīgot, izmantojot


Using ADCs in real-time capable applications

Azure Sphere supports analog to digital conversion. An ADC converts an analog input to a corresponding digital value. The number of input channels and the resolution (as number of ADC output bits) are device dependent.

This topic describes how to use analog-to-digital converters (ADCs) in a real-time capable application (RTApp). For information about using ADCs in high-level applications, see Using ADCs on Azure Sphere.

Note

The Azure Sphere OS does not reset peripherals on start-up. Your applications should ensure that peripherals are in a known-good state on startup and after restart.

MT3620 support for ADCs on the real-time cores

The MT3620 contains a 12-bit ADC with 8 input channels. The ADC compares an input voltage to a reference voltage and produces a value between 0 and 4095 as its output. The ADC input channels and the GPIO pins GPIO41 through GPIO48 map to the same pins on the MT3260. However, if your application uses the ADC then all 8 pins are allocated for use as ADC inputs. None of them can be used for GPIO.

For register base addresses, interrupt numbers, clock rate, sampling frequency, and other details about the MT3620, see the MT3620 Datasheet and the MT3620 M4 User Manual; if questions remain, you can request details from Avnet by emailing Azure.Sphere@avnet.com.

ADC requirements

Your application code needs a way to identify the ADC, its control registers, and its channels. You can find the register base address in the manufacturer's hardware documentation.

For details about the MT3620, see MT3620 support for ADCs on the real-time cores.

Application manifest settings

To use an ADC, an RTApp must list it in the Capabilities section of the application manifest. For an RTApp that runs on the MT3620 chip, identify the ADC by using the "AppManifestValue" that is defined for it in the mt3620.json file:

"Capabilities": {
 "Adc": [ "ADC-CONTROLLER-0" ]  }

The ADC sample applications

The two ADC samples demonstrate how to use an analog-to-digital converter in an RTApp. The README files provide details and instructions.