AMOS–ADC  add-on

ANSARI's Micro Operating System Analog-to-Digital Converter Add-On Module

» Posted on 16. Jun 2013

Related links:  AMOS | Overview 


 

AMOS – ADC Add-On

 

The standard ADC add-on deals with the internal ADC of the µController and follows several aims providing ADC capabilities to the user. It serves user applications with simple value sampling and monitoring with less handling. Sampling is basically initiated and controlled by user application, while most of the peripheral settings are controlled and handled by the add-on independently. Communication with the ADC add-on is based on IPC messaging technique feature of AMOS.

The ADC development was initiated by basic definitions listed below. All development decisions were made with the aim of reaching higher level implementations with fast sampling rates, while the system grows. The basic needs, which are implemented in standard mode are reading power supply voltage values, external & internal temp sensor values and any conditioned sensor values. None of these basic needs are time critical measurements. The maximum sampling rate supported in the standard mode is about 100 samples per second.

 

Basic Definitions

 
  • ADC hardware is transparent to the system
  • Supporting single or sequence-of-channels (auto scan) sampling mode
  • Sample triggering can be set to one time, Timer driven or repeated auto scan mode
  • Runtime definable functions to be called for each finished sampling
  • Channel monitoring and event trigger on sampling results

As a result of existing hardware architecture in the MSP430 µController family, the standard ADC add-on provides user applications with following features:

 
  • A simple one time channel sampling with raw or averaged data output as result
  • Simple automatic arithmetic averaging mode within the add-on
  • Automatic two second periodical monitoring mode
  • Automatic triggering on predefined sensor value changes
  • Calling registered functions when sampling is finished or result exceeds predefined limits
  • Verbose command interpreter and handler for service and debugging

  

The Internal µController ADC

The µController on which AMOS is optimized for, contains an ADC module, which can be used by applications if the AMOS – ADC add-on module is enabled in the system. Following block diagram shows how the ADC module is built up:

Internal_ADC_Module

The ADC module supports fast 12-bit analog-to-digital conversions. The module implements a 12-bit SAR core, sample select control, reference generator and a 16-word conversion-and-control buffer. The conversion-and-control buffer allows up to 16 independent analog-to-digital converter (ADC) samples to be converted and stored without any CPU intervention.

 

ADC Add-on Running modes

The ADC add-on is capable to run in different modes. All channels are limited to the capabilities given in the selected running mode of the ADC add-on.

The standard implementation of the ADC add-on is the multi-channel monitoring mode with event triggering. In this mode a conversion sequence is defined by a number of active channels to be sampled. Within a complete conversion sequence, for each activated channel, the ADC core is configured to auto scan mode and converts same channel up to the desired average number of samples. Supported averaging is a simple arithmetic calculation of up to 16 samples, each taken within 10µSec. More complex averaging algorithms must be handled by caller application itself. 

Other featured modes like fast streaming with DMA control are not implemented in the firmware yet, but supported by the hardware.

 

Communication with the ADC add-on

The link between an application and the ADC add-on is based on IPC packets. The caller of ADC add-on needs to create an IPC packet and fill it with all data needed by ADC add-on for conversion. The caller may need some data for the IPC packet, which can be asked from ADC directly using getADCInfo() function.

The add-on always responds with raw data results. Any conversion and interpretation of data has to be done by the caller application itself. The ADC add-on calls the function provided by the caller at the end of a conversion. Since the registered caller function is executed within an ISR it should be very short. The basic aim of this routine should be to call the main caller application correctly. Any data processing on the conversion result has to be done by the main application later. The caller function is provided with following data as a result of requested conversion:

Conversion result error code
Average value (raw data)
ADC highest value (raw data)
ADC lowest value (raw data)
Number of samples used in building the average
Temperature stamp

IPC packets from callers are typecasted into rcADC data structures in ADC add-on. Same packet is used for simple conversion and monitoring request, distinguished by the command string number:

Typecasted_ADC_IPC_packet

 

The Implementation

A/D conversion is an asynchronous task from caller point of view. Whenever a channel conversion is needed, the caller generates an IPC packet for ADC add-on and may continue its process or wait for the result.

The conversion request is queued in a chain and the ADC add-on picks up the request one by one and handles the requests. The result of a conversion will be posted by the ADC add-on on the same way back to the requester by APPcall in AMOS.

The sate machine below shows generally the process of AD conversion. Tree type of configurations are distinguished:

Add-on related: First initialization and later control
Channel based configuration
Sequencer configuration 

ADC_statemachine_overview

The sequencer runs a periodical AMOS timer, which triggers the ADC add-on once every defined time-period and initiates a conversion sequence for all active channels. The results of each single channel will trigger registered functions if defined limits are exceeded.

 

Submit a Comment