4.1. ADC¶
4.1.1. About This Document¶
Document Title |
User Guide of MCAL ADC Driver |
Document Version |
Version 2.2 |
Company |
Texas Instruments |
Document Name |
ADC User Guide |
4.1.2. Document Revision History¶
Version |
Date |
Revision History |
Status |
---|---|---|---|
Version 0.1 |
27 Mar 2018 |
Initial Draft |
Approved |
Version 0.2 |
28 Mar 2018 |
Added ADC group state diagram |
Approved |
Version 0.3 |
28 Mar 2018 |
Added dependency on DEM module, usage of CRC hook function |
Approved |
Version 0.4 |
29 Mar 2018 |
Added detailed description of DET errors reported |
Approved |
Version 0.5 |
29 Mar 2018 |
Added description of DEM error reported |
Approved |
Version 1.0 |
30 Mar 2018 |
Incorporated the review comments |
Approved |
Version 1.1 |
7 Mar 2019 |
Added support for AWR18xx device |
Approved |
Version 1.2 |
21 Jan 2020 |
Minor updates based on review |
Approved |
Version 1.3 |
19 Feb 2022 |
Added support for TPR12 MSS GPADC and removed not relevant info |
Approved |
Version 1.4 |
08 Jul 2022 |
Added support for reading TPR12 MSS GPADC temperature sensors |
Approved |
Version 1.5 |
26 Jul 2022 |
Added support for configurable polling mode and interrupt mode via initialization |
Approved |
Version 2.1 |
30 Sep 2022 |
MCAL 2.x specific changes |
Approved |
Version 2.1 |
05 Aug 2023 |
MCAL 9.0.0 Rearchitecture changes updated |
Approved |
4.1.3. Table of contents¶
4.1.4. Acronyms and Definitions¶
Acronyms and Definitions used are presented in below table.
Acronyms |
Descriptions |
---|---|
BSW |
Basic Software |
DET |
Default Error Tracer |
ADC |
Analogue Digital Converter |
MCU |
Micro Controller Unit |
OS |
Operating System |
API |
Application Programming Interface |
HW |
Hardware |
SW |
Software |
ISR |
Interrupt Service Routine |
SPS |
Samples Per Second |
SOC |
Start of Conversion |
EOC |
End of Conversion |
INT |
Interrupt |
4.1.5. Functional Overview¶
4.1.5.1. Brief Overview¶
This document describes MCAL ADC Driver functionality, its application interfaces and configuration details as per AUTOSAR version 4.3.1 .
Supported AUTOSAR Release |
4.3.1 |
Supported Configuration Variants |
Pre-Compile, Post-build |
Vendor ID |
ADC_VENDOR_ID (44) |
Module ID |
ADC_MODULE_ID (123) |
Supported Platform |
AM273x |
The ADC module initiates analog to digital conversion requests and provides the conversion results for external analog monitoring channels and internally connected digital temperature sensors. It provides services to start, stop and read conversion results for configurable ADC groups consisting of one or more external analog monitoring channels.
AM273x supports 1 General Purpose Analog to Digital Converter (GPADC).
GPADC has 9 channels. (Refer below table for Channel Information)
GPADC supports sampling rate up to 625 ksps.
Prescale is not configurable in ADC module.
ADC Physical Channel |
Channel Name |
Channel ID |
---|---|---|
ADC1 |
Channel 1 |
0x0 |
ADC2 |
Channel 2 |
0x1 |
ADC3 |
Channel 3 |
0x2 |
ADC4 |
Channel 4 |
0x3 |
ADC5 |
Channel 5 |
0x4 |
ADC6 |
Channel 6 |
0x5 |
ADC7 |
Channel 7 |
0x6 |
ADC8 |
Channel 8 |
0x7 |
ADC9 |
Channel 9 |
0x8 |
4.1.5.1.1. ADC Driver Architecture¶
The following figure shows where the ADC is located in the AUTOSAR architecture

Figure 1: ADC in AUTOSAR architecture.

Figure 2: System Overview.
4.1.5.1.2. Initialization¶
Adc_Init() has to be called to initialize the ADC driver before initiating any group conversion. This will also set all the groups to ADC_IDLE state.If temperature read is enabled, and intended to be used, then one of the 4 available groups must have only temperature sensors configuration together during initialization.
4.1.6. States¶
There are 4 states in which each ADC group for one shot single access mode can be:
ADC_IDLE: This is the state before starting a group, no conversion request for the group has been initiated or after the conversion result of a stream completed group is read.
ADC_BUSY: This is the state after a group is started but hasn’t finished i.e. conversion result for the group is not yet available.
ADC_COMPLETED: This is the state after a group has finished first or more samples of ADC analog input.
ADC_STREAM_COMPLETED: This is the state after a group has finished i.e., conversion result for the group is available.

Figure 3: ADC State Diagram - 1
4.1.6.1. Features Supported and Not Supported¶
ADC IP Features supported |
Autosar Features Supported |
Not Supported |
---|---|---|
10-bit resolution Single-ended signal conversions Input multiplexer with up to 9 channels Post-Processing Blocks: Flag a high or low compare limit1 8 external I/Os and internal components -temperature sensors (3), supplies, bias reference, LDO output mapped to GPADC input Single or continuous conversione modes Storage of min, max, and sum of the samples captured per channel |
Software triggered one-shot conversion where the converted group consists of exactly one channel. Software triggered one-shot conversion where the converted group consists of more than one channel. ADC Support for reading available digital temperature sensors, conversion of raw ADC data into celcius degrees |
ADC Hardware Features not supported Self-test logic support for input channel failure detection Event pin and software command mechanism to trigger the conversion Calibration logic using BGAP, for offset error correction Separate operating supply and ground pins on package Capability to have an external reference voltage for GPAD DMA trigger when conversion is completed or data RAM threshold is achieved Autosar Features not supported Hardware triggered one-shot conversion where the converted group consists of exactly one channel. Hardware triggered one-shot conversion where the converted group consists of more than one channel. Stream buffering of adc values for each channel Support for limit checking for all ADC hardware channels Support and management of HW low power states. |
4.1.6.2. Assumptions¶
None
4.1.6.3. Limitations¶
Due to the hardware conversion of each channel at a time in IFM mode, group conversion results in a wait delay based on the number of collect samples of each channel and the number of channels configured in the group.

Figure 4: IFM MODE
Note
Adc_StartGroupConversion is a reentrant function which can be called by other applications during the previous group processing time and the new request will be queued and prioritized accordingly.
4.1.6.4. Design overview(Link to the Architecture document and Design Document)¶
4.1.6.4.1. ADC Hardware Description¶
4.1.6.4.2. Autosar ADC Design¶
Will be updated in future release.
4.1.6.5. File Structure¶
Description of static files is provided below:
Static source and header files |
Description |
---|---|
Adc.h |
Contains the API’s of the ADC driver to be used by upper layers. |
Adc.c |
Contains the implementation of the API’s for ADC driver. |
Adc_Irq.c and Adc_Irq.h |
Contains ISR function definitions |
Adc_Types.h |
Contains the autosar data types and internal macro definitions. |
Adc_Priv.c and Adc_Priv.h |
Contains Internal functions definition of ADC driver. |
Adc_Platform.c and Adc_Platform.h |
Contains device specific a function definition, data types and definitions. |
Adc_Utils.c and Adc_Utils.h |
Utility functions implementation file. This file defines the helper functions like create, add and remove nodes |
Adc_Temp.c and Adc_Temp.h |
Contains the Platform specific Temperature sensors readout |
Description of generated files is provided below:
Plugin Files |
Descriptions |
---|---|
Adc_Cfg.h |
Contains the Precompile switches, Symbloic names of Group, channels and hardware units and Configured maximum number Groups and hardware units |
Adc_PBcfg.c |
Contains all channels Post-Build Configured parameters |
Adc_Cfg.c |
Contains all channels Pre-Compile Configured parameters |

Figure 4: ADC header file include structure
4.1.7. Deviations to requirements(Requirement Traceability)¶
4.1.7.1. Module Requirements¶
Will be updated in future release
4.1.7.2. Deviation of requirements against AUTOSAR specification requirements¶
Will be updated in future release
4.1.8. Integration Details¶
4.1.8.1. Dependency on Other Software Modules¶
4.1.8.1.1. The ADC Driver dependent modules¶
4.1.8.1.1.1. MCU¶
The Microcontroller Unit Driver (MCU Driver) for initializing and controlling the chip’s internal clock sources and clock pre-scalers. The clock frequency may affect the Trigger frequency, Conversion time and Sampling time.
4.1.8.1.2. Error Handling module¶
4.1.8.1.2.1. DET¶
The module ADC depends on the DET (by default) in order to report development errors.
Detection and reporting of development errors can be enabled or disabled by the parameter AdcDevErrorDetect (The macro ADC_DEV_ERROR_DETECT = STD_ON generated in file Adc_Cfg.h).
The DET can be replaced optionally by an equivalent component which is responsible to recognize development errors, if no DET component is available.
The DET error is reported with Module ID.
The reported service IDs identify the services which are described earlier.
The following table represents the service IDs:
Service ID |
Service |
---|---|
ADC_SID_INIT = 0x00 |
Adc_Init |
ADC_SID_DEINIT = 0x01 |
Adc_DeInit |
ADC_SID_START_GROUP_CONVERSION = 0x02 |
Adc_StartGroupConversion |
ADC_SID_STOP_GROUP_CONVERSION = 0x03 |
Adc_StopGroupConversion |
ADC_SID_READ_GROUP = 0x04 |
Adc_EnableHardwareTrigger |
ADC_SID_ENABLE_GROUP_NOTIFICATION = 0x07 |
Adc_EnableGroupNotification |
ADC_SID_DISABLE_GROUP_NOTIFICATION = 0x08 |
Adc_DisableGroupNotification |
ADC_SID_GET_GROUP_STATUS = 0x09 |
Adc_GetGroupStatus |
ADC_SID_GET_VERSION_INFO = 0x0A |
Adc_GetVersionInfo |
ADC_SID_GET_STREAM_LAST_POINTER = 0x0B |
Adc_GetStreamLastPointer |
ADC_SID_SETUP_RESULT_BUFFER = 0x0C |
Adc_SetupResultBuffer |
ADC_SID_SET_POWER_STATE = 0x10 |
Adc_SetPowerState |
ADC_SID_GET_CURRENT_POWER_STATE = 0x11 |
Adc_GetCurrentPowerState |
ADC_SID_GET_TARGET_POWER_STATE = 0x12 |
Adc_GetTargetPowerState |
ADC_SID_PREPARE_POWER_STATE = 0x13 |
Adc_PreparePowerState |
ADC_SID_MAIN_POWER_TRANSITION_MANAGER = 0x14 |
Adc_Main_PowerTransitionManager |
ADC_SID_IOHWAB_NOTIFICATION = 0x20 |
IoHwAb_AdcNotification |
ADC_SID_IOHWAB_NOTIFY_READY_FOR_POWER_STATE = 0x70 |
IoHwAb_Adc_NotifyReadyForPowerState |
The errors reported to DET module are described in the following table:
Error Code |
Error Macro |
Description |
---|---|---|
[0x0A] |
ADC_E_UNINIT |
API service used without module initialization |
[0x0B] |
ADC_E_BUSY |
API service called during ongoing process |
[0x0C] |
ADC_E_IDLE |
API service called while no conversion is ongoing |
[0x0D] |
ADC_E_ALREADY_INITIALIZED |
API service called ADC is already initialized. |
[0x0E] |
ADC_E_PARAM_CONFIG |
API service called with incorrect configuration parameter |
[0x14] |
ADC_E_PARAM_POINTER |
API service called with invalid data buffer |
[0x15] |
ADC_E_PARAM_GROUP |
API service called with invalid group ID |
[0x16] |
ADC_E_WRONG_CONV_MODE |
API servcie called on a group with conversion mode configured as continuous |
[0x17] |
ADC_E_WRONG_TRIGG_SRC |
API service called for group with wrong trigger source |
[0x18] |
ADC_E_NOTIF_CAPABILITY |
Enable/disable notification function for a group whose configuration set has no notification available |
[0x19] |
ADC_E_BUFFER_UNINIT |
Conversion started and result buffer pointer is not initialized |
[0x16] |
ADC_E_WRONG_CONV_MODE |
API servcie called on a group with conversion mode configured as continuous and HW Trigger |
[0x17] |
ADC_E_WRONG_TRIGG_SRC |
API service called for group with wrong trigger source |
[0x18] |
ADC_E_NOTIF_CAPABILITY |
Enable/disable notification function for a group whose configuration set has no notification available |
[0x19] |
ADC_E_BUFFER_UNINIT |
Conversion started and result buffer pointer is not initialized |
[0x1A] |
ADC_E_NOT_DISENGAGED |
One or more ADC group/channel not in IDLE state |
[0x1B] |
ADC_E_POWER_STATE_NOT_SUPPORTED |
Unsupported power state request |
[0x1C] |
ADC_E_TRANSITION_NOT_POSSIBLE |
Requested power state cannot be reached directly |
[0x1D] |
ADC_E_PERIPHERAL_NOT_PREPARED |
ADC not prepared for target power state |
The run time errors reported to DET module are described in the following table:
Error Code |
Error Macro |
Description |
---|---|---|
[0x0B] |
ADC_E_BUSY |
API service called during ongoing process |
[0x0C] |
ADC_E_IDLE |
API service called while no conversion is ongoing |
AUTOSAR requires that API functions check the validity of their parameters. The checks are described in spec and are done as internal parameter checks of the API functions. These checks are for development error reporting and can be en/dis-abled separately. Refer to the configuration chapter where the en/dis-abling of the checks is described. En/dis-abling of single checks is an addition to the AUTOSAR standard which requires to en/dis-able the complete parameter checking via the parameter ADC_DEV_ERROR_DETECT. The following table shows which parameter checks are performed on which services:
Check Services |
ADC_E_UNINIT |
ADC_E_BUSY |
ADC_E_IDLE |
ADC_E_ALREADY_INITIALIZED |
ADC_E_PARAM_CONFIG |
ADC_E_PARAM_POINTER |
ADC_E_PARAM_GROUP |
ADC_E_WRONG_TRIGG_SRC |
ADC_E_NOTIF_CAPABILITY |
ADC_E_BUFFER_UNINIT |
---|---|---|---|---|---|---|---|---|---|---|
Adc_Init |
x |
x |
||||||||
Adc_DeInit |
x |
|||||||||
Adc_StartGroupConversion |
x |
x |
x |
x |
||||||
Adc_StopGroupConversion |
x |
x |
x |
x |
||||||
Adc_ReadGroup |
x |
x |
x |
x |
||||||
Adc_EnableGroupNotification |
x |
x |
x |
x |
||||||
Adc_DisableGroupNotification |
x |
x |
x |
|||||||
Adc_GetGroupStatus |
x |
x |
||||||||
Adc_GetVersionInfo |
x |
|||||||||
Adc_SetupResultBuffer |
x |
x |
x |
x |
||||||
Adc_EnableHardwareTrigger |
x |
x |
x |
x |
||||||
Adc_DisEnableHardwareTrigger |
x |
x |
x |
x |
||||||
Adc_Get_StreamLastPointer |
4.1.8.1.2.2. DEM¶
The ADC module depends on the DEM module for reporting errors.
By default, production code related errors are reported to the DEM using the service DEM_ReportErrorStatus(). The errors reported to DEM are described in the following table:
Error Code |
Description |
|
---|---|---|
Assigned by DEM |
ADC_E_HARDWARE_ERROR |
This error is raised when GPADC is not functioning properly. This can happen due to: GPADC conversion is not triggered successfully or GPADC conversion timeout This error is triggered after timeout check for more than 1 millisecond |
4.1.8.1.2.3. Callback Functions¶
The ADC driver does not provide any call back functions.
4.1.8.1.2.4. Callback Notification¶
Notifications:
As it is a configurable interface, the ADC defines notifications that can be mapped to callback functions provided by other modules. The mapping is not statically defined by the ADC but can be performed at configuration time. The function prototypes that can be used for the configuration have to match the appropriate function prototype signatures, which are described in the following.
Adc_GroupEndNotifyType:
This is of type Adc_GroupEndNotifyType which is defined in Adc_Types.h file. This is called to notify the group about the completion of the requested conversion and availability of the conversion results.
4.1.8.2. Hardware - Software - ISR API name mapping¶
For interrupt notification, ISR is provided in ADC driver. The following interrupt is generated by ADC. The supported ISR is a part of the Adc_Irq.h file.
Following is ADC module ISR for the hardware unit:
ADC HW UNIT |
HW Interrupt |
SW ISR for ADC module |
---|---|---|
ADC HW UNIT 1 |
MSS_GPADC_IFM_DONE |
Adc_IFMDoneISR |
4.1.8.3. Scheduling Strategy¶
4.1.8.3.1. SchM (Optional)¶
Beside the OS the BSW Scheduler provides functions that module ADC calls at begin and end of critical sections.
4.1.8.3.2. Critical Sections¶
There is only one kind of critical sections in this driver. Within these sections all read /modify / write accesses to internal ADC driver data structures must be protected. Therefore switching to tasks that also access ADC has to be avoided and all ADC interrupts have to be suspended. This is handled internally by ADC Driver.
4.1.9. API Description¶
4.1.9.1. Description of the API’s(Can be referred to Api Guide spec)¶
Refer the AUTOSAR SWS for API documentation and Type definition.
4.1.9.2. API’s with Service ID¶
The following table presents the service IDs and the related services:
Service ID |
Autosar API’s Supported |
Autosar API’s not Supported |
---|---|---|
0x00 |
Adc_Init |
|
0x01 |
Adc_DeInit |
|
0x02 |
Adc_StartGroupConversion |
|
0x03 |
Adc_StopGroupConversion |
|
0x04 |
Adc_ReadGroup |
|
0x05 |
Adc_EnableHardwareTrigger |
|
0x06 |
Adc_DisableHardwareTrigger |
|
0x07 |
Adc_EnableGroupNotification |
|
0x08 |
Adc_DisableGroupNotification |
|
0x09 |
Adc_GetGroupStatus |
|
0x0A |
Adc_GetVersionInfo |
|
0x0B |
Adc_GetStreamLastPointer |
|
0x0C |
Adc_SetupResultBuffer |
|
0x20 |
IoHwAb_AdcNotification |
|
0x10 |
Adc_SetPowerState |
|
0x11 |
Adc_GetCurrentPowerState |
|
0x12 |
Adc_GetTargetPowerState |
|
0x13 |
Adc_PreparePowerState |
|
0x14 |
Adc_Main_PowerTransitionManager |
|
0x70 |
IoHwAb_Adc_NotifyReadyForPowerState |
Refer Autosar SWS for API description mentioned in above table.
4.1.9.3. Description on Non Standard API’s¶
Adc_InitTemperatureRead
This API is used to initialize the Efuse params associated with temperature calculation. This API shall be used as part of system initialization and is independent of ADC init status.
Adc_ReadTemperature
This API is used to read the temperature value of the available three digital sensors after sampling and averaging.
One of the available groups must be configured only with temperature sensors as a separate group so that the sampling and raw adc value conversion to temperature happens appropriately.
Also, Adc_ReadGroup API is called inside the API for each group conversion sampling and hence Adc_ReadGroup shouldn’t be called for this group after calling Adc_ReadTemperature API.
Adc_ReadTemperatureResult
This API Returns the temperature sensor values for three digital temperature sensors.
The following table presents the ADC channels connected to respective Subsytem temperature sensor:
ADC Channel |
Temperature Sensor |
---|---|
CHANNEL 10 |
DSP Temp Sensor |
CHANNEL 11 |
HWA Temp Sensor |
CHANNEL 12 |
R5F Temp Sensor |
4.1.10. Configuration Description¶
4.1.10.1. Configuration Variants¶
The ADC can be configured as Post-Build or Pre-Compile variant, using EB tresos tool.
Variants |
Generated Files |
---|---|
PostBuild |
Adc_PBcfg.c , Adc_Cfg.h |
Pre-Compile |
Adc_Cfg.c , Adc_Cfg.h |
4.1.10.2. Parameter Description¶
Standard Parameters |
Description |
Default Value |
Range |
Unit/Datatype |
---|---|---|---|---|
AdcHwUnitId |
Numeric ID of the HW Unit. This symbolic name allows accessing Hw Unit data. Enumeration literals are defined vendor specific. |
ADC_UNIT_1 |
ADC_UNIT_1 |
ENUMERATION |
AdcChannelId |
This parameter defines the assignment of the channel to the physical ADC hardware channel. |
0 |
0..1024 |
INTEGER |
AdcGroupAccessMode |
Type of access mode to group conversion results. |
ADC_ACCESS_MODE_SINGLE |
ADC_ACCESS_MODE_SINGLE ADC_ACCESS_MODE_STREAMING |
ENUMERATION |
AdcGroupConversionMode |
Type of conversion mode supported by the driver. |
ADC_CONV_MODE_ONESHOT |
ADC_CONV_MODE_CONTINUOUS ADC_CONV_MODE_ONESHOT |
ENUMERATION |
AdcGroupId |
Numeric ID of the group. This parameter is the symbolic name to be used on the API. This symbolic name allows accessing Channel Group data. This value will be assigned to the symbolic name derived of the AdcGroup container shortName. |
0 |
0..1023 |
INTEGER |
AdcGroupPriority |
Priority level of the AdcGroup. |
0 |
0..255 |
INTEGER |
AdcGroupReplacement |
Replacement mechanism, which is used on ADC group level, if a group conversion is interrupted by a group which has a higher priority. |
ADC_GROUP_REPL_SUSPEND_RESUME |
ADC_GROUP_REPL_ABORT_RESTART ADC_GROUP_REPL_SUSPEND_RESUME |
ENUMERATION |
AdcGroupTriggSrc |
Type of source event that starts a group conversion. |
ADC_TRIGG_SRC_SW |
ADC_TRIGG_SRC_HW ADC_TRIGG_SRC_SW |
ENUMERATION |
AdcNotification |
Callback function for each group |
AdcApp_Group0EndNotification |
NA |
FUNCTION-NAME |
AdcGroupDefinition |
Assignment of AdcChannels to a AdcGroups. |
NA |
NA |
REFERENCE |
AdcDeInitApi |
Adds / removes the service Adc_DeInit() from the code. |
TRUE |
TRUE /FALSE |
BOOLEAN |
AdcDevErrorDetect |
Switches the Development Error Detection and Notification ON or OFF |
TRUE |
TRUE /FALSE |
BOOLEAN |
AdcEnableQueuing |
Determines, if the queuing mechanism is active in case of priority mechanism disabled.Note: If priority mechanism is enabled, queuing mechanism is always active and the parameter ADC_ENABLE_QUEUING is not evaluated. true: Enabled. false: Disabled. |
TRUE |
TRUE /FALSE |
BOOLEAN |
AdcEnableStartStopGroupApi |
Adds / removes the services Adc_StartGroupConversion() and Adc_StopGroupConversion() from the code. |
TRUE |
TRUE /FALSE |
BOOLEAN |
AdcGrpNotifCapability |
Determines, if the group notification mechanism (the functions to enable and disable the notifications) is available at runtime. |
TRUE |
TRUE /FALSE |
BOOLEAN |
AdcHwTriggerApi |
Adds / removes the services Adc_EnableHardwareTrigger() and Adc_DisableHardwareTrigger() from the code. |
FALSE |
TRUE /FALSE |
BOOLEAN |
AdcEnableRegisterReadbackApi |
Enable API to readback ADC critical registers |
FALSE |
TRUE /FALSE |
BOOLEAN |
AdcLowPowerStatesSupport |
Adds / removes all power state management related APIs (ADC_SetPowerState, ADC_GetCurrentPowerState, ADC_GetTargetPowerState, ADC_PreparePowerState, ADC_Main_PowerTransitionManager), indicating if the HW offers low power state management. |
FALSE |
TRUE /FALSE |
BOOLEAN |
AdcPowerStateAsynchTransitionMode |
Enables / disables support of the ADCDriver to the asynchronous power state transition. |
FALSE |
TRUE /FALSE |
BOOLEAN |
AdcPriorityImplementation |
Determines whether a priority mechanism is available for prioritization of the conversion requests and if available, the type of prioritization mechanism. The selection applies for groups with trigger source software and trigger source hardware. Two types of prioritization mechanism can be selected. The hardware prioritization mechanism (AdcPriorityHw) uses the ADC hardware features for prioritization of the software conversion requests and hardware trigger signals for groups with trigger source hardware. The mixed hardware and software prioritization mechanism (AdcPriorityHwSw) uses the ADC hardware features for prioritization of ADC hardware trigger for groups with trigger source hardware and a software implemented prioritization mechanism for groups with trigger source software. The group priorities for software triggered groups are typically configured with lower priority levels than the group priorities for hardware triggered groups. |
ADC_PRIORITY_HW_SW |
ADC_PRIORITY_HW_SW ADC_PRIORITY_NONE |
ENUMERATION |
AdcReadGroupApi |
Adds / removes the service Adc_ReadGroup() and from the code. |
TRUE |
TRUE /FALSE |
BOOLEAN |
AdcResultAlignment |
Alignment of ADC raw results in ADC result buffer (left/right alignment). |
ADC_ALIGN_RIGHT |
ADC_ALIGN_RIGHT |
ENUMERATION |
AdcVersionInfoApi |
Adds / removes the service Adc_GetVersionInfo() from the code. |
TRUE |
TRUE /FALSE |
BOOLEAN |
AdcChannelValueSigned |
Information whether the result value of the ADC driver has sign information (true) or not (false). If the result shall be interpreted as signed value it shall apply to C-language rules. |
FALSE |
TRUE /FALSE |
BOOLEAN_LABEL |
AdcGroupFirstChannelFixed |
Information whether the first channel of an ADC Channel group can be configured (false) or is fixed (true) to a value determined by the ADC HW Unit. |
FALSE |
TRUE /FALSE |
BOOLEAN_LABEL |
AdcMaxChannelResolution |
Maximum Channel resolution in bits (does not specify accuracy). |
0 |
1..63 |
INTEGER_LABEL |
Texas Instruments Parameters |
Description |
Default Value |
Range |
Unit |
---|---|---|---|---|
AdcHwUnitMonitorMode |
This is the Interrupt Mode or Polling Mode for monitoring ADC conversion done status. |
ADC_INTERRUPT_MODE |
ADC_INTERRUPT_MODE ADC_POLLING_MODE |
ENUMERATION |
AdcBufferedModeSelect |
To select buffered on or off |
TRUE |
TRUE FALSE |
BOOLEAN |
AdcChannelSettlingTime |
ADC Channel settling time |
0 |
0..15 |
INTEGER |
AdcChannelIsConfigured |
Check if the ADC channel is configured. |
FALSE |
TRUE FALSE |
BOOLEAN |
AdcChannelSkipSamples |
Number of ADC samples to skip in the ADC channel. |
0 |
0..127 |
INTEGER |
AdcChannelSamplestoCollect |
Number of ADC samples to collect per channel. |
0 |
0..255 |
INTEGER |
AdcChannelUseLookupTable |
Settings to allow the use of Look up table for the ADC channel. |
FALSE |
TRUE FALSE |
BOOLEAN |
AdcMaxGroupCount |
Maximum group across all hwunit |
4 |
1..1024 |
INTEGER |
AdcMaxHwUnitCount |
Max HW unit - This should match the sum for the units ISR |
1 |
1 |
INTEGER |
AdcHwUnitActive |
Enables Disable HW UNIT |
TRUE |
TRUE FALSE |
BOOLEAN |
AdcReadTemperatureApi |
Adds or removes the service AdcReadTemperatureApi() from the code. |
TRUE |
TRUE FALSE |
BOOLEAN |
AdcTypeofInterruptFunction |
Type of ISR function |
ADC_ISR_CAT1 |
ADC_ISR_VOID ADC_ISR_CAT1 ADC_ISR_CAT2 |
ENUMERATION |
AdcOsCounterRef |
This parameter contains a reference to the OsCounter which is used by the ADC driver. |
ASPathDataOfSchema:/AUTOSAR/EcucDefs/Os/OsCounter |
ASPathDataOfSchema:/AUTOSAR/EcucDefs/Os/OsCounter |
REFERENCE |
AdcDefaultOSCounterId |
Default Os Counter Id if node reference to OsCounter ref AdcOsCounterRef is not set |
0 |
0..16 |
INTEGER |
GetCounterValueHookFunction |
Function pointer to callback function for getting counter value. |
GetCounterValue |
NA |
FUNCTION-NAME |
GetElapsedValueHookFunction |
Function pointer to callback function for getting elapsed value. |
GetElapsedValue |
NA |
GetElapsedValue |
AdcTimeoutDuration |
ADC timeout - used in ADC AFE busy wait and FSM busy wait.Each tick is 31.25us (for 32K Counter). Wait for 1ms is 0x20 |
32 |
1..4294967295 |
INTEGER |
AdcDemEventParameterRefs |
Container for the references to DemEventParameter elements which shall be invoked using the API Dem_ReportErrorStatus API in case the corresponding error occurs. The EventId is taken from the referenced DemEventParameter's DemEventId value. The standardized errors are provided in the container and can be extended by vendor specific error references |
ASPathDataOfSchema:/AUTOSAR/EcucDefs/Dem/DemConfigSet/DemEventParameter |
ASPathDataOfSchema:/AUTOSAR/EcucDefs/Dem/DemConfigSet/DemEventParameter |
IDENTIFIABLE |
AdcChannelConfiguredValue |
Configured Value of the ADC channel. |
0 |
0?.2 |
INTEGER |
AdcChannelParamValue |
Parameter value configured for the ADC channel. |
0 |
0?.3 |
INTEGER |
AdcEnableRegisterReadbackApi |
Enable API to readback ADC critical registers |
FALSE |
TRUE / FALSE |
BOOLEAN |
AdcAfePowerUpWaitTicks |
Software must wait minimum 4us after a AFE(Analog Front End).(Each tick 31.25us(32 K Counter), Required 4us(1/8th of 31.25us) = ~1U(apprx) |
1 |
1…4294967295 |
INTEGER |
AdcMaxRange |
Maximum value of range . |
1023 |
NA |
INTEGER |
AdcMinRange |
Minimum value of range. |
0 |
NA |
INTEGER |
AdcMaxNumChannels |
Number of MCAL channels - in terms of ADC HW, this represents the number of hardware steps.This is a fixed value as per the ADC module and can’t be changed |
12 |
NA |
INTEGER |
AdcMinHwChannelId |
Number of actual HW channels - in terms of ADC HW the actual channel input to the ADC module |
0 |
NA |
INTEGER |
4.1.10.3. Symbolic Names deviations¶
None.
4.1.10.4. Configuration rules and constraints to enable plausibility checks¶
None.
4.1.11. Memory Mapping¶
Memory Mapping Sections |
ADC_CODE |
ADC_CODE_ISR |
ADC_VAR_NO_INIT |
ADC_VAR |
ADC_CONST |
ADC_PBCFG |
---|---|---|---|---|---|---|
ADC_START_SEC_VAR_INIT_UNSPECIFIED(.bss) |
x |
|||||
ADC_STOP_SEC_VAR_INIT_UNSPECIFIED |
x |
|||||
ADC_START_SEC_CONFIG_DATA (.const) |
x |
|||||
ADC_STOP_SEC_CONFIG_DATA |
x |
|||||
ADC_START_SEC_CODE(.text) |
x |
|||||
ADC_STOP_SEC_CODE |
x |
|||||
ADC_START_SEC_VAR_INIT_32(.bss) |
x |
|||||
ADC_STOP_SEC_VAR_INIT_32 |
x |
|||||
ADC_START_SEC_VAR_NO_INIT_UNSPECIFIED(.data) |
x |
|||||
ADC_STOP_SEC_VAR_NO_INIT_UNSPECIFIED |
x |
|||||
ADC_START_SEC_ISR_CODE |
x |
|||||
ADC_STOP_SEC_ISR_CODE |
x |
4.1.12. Memory footprint¶
Please refer Memory Footprint for more details.
4.1.13. Performance¶
Not Applicable.
4.1.14. Example Usage¶
4.1.14.1. Steps to build and run example¶
ADC example application demonstrating the MCAL ADC driver features is in folder <MCAL_ROOT>/examples/Adc.
This application can be built from the root folder by giving gmake –s adc_app PLATFORM=am273.
Once the build is completed we get a binary file,which is loaded in our controller and executed.
4.1.14.2. External set up Information¶
ADC module is tested using CC board (PROC103 REV.C) and analog input is provided to ADC input channels through DC power supply (0-12V).
The ADC analog input for the AM273x ranges from 0 – 1.8V.
4.1.14.3. Configuration used to test this example¶
The ADC module example is configured with following groups on ADC Hardware Unit 1
Adc Group 0 : One Shot Conversion Software Triggered.
Adc Group 1 : One Shot Conversion Software Triggered.
Adc Group 2 : One Shot Conversion Software Triggered.
Adc Group 3 : One Shot Conversion Software Triggered.
Adc Groups are Configured with below ADC Channels:
Adc Group 0 : Channel 9 to Channel 11 (MSS_GPADC_IFM_DONE) (HW UNIT 1)
Adc Group 1 : Channel 0 to Channel 11 (MSS_GPADC_IFM_DONE) (HW UNIT 1)
Adc Group 2 : Channel 0 to Channel 1 (MSS_GPADC_IFM_DONE) (HW UNIT 1)
Adc Group 3 : Channel 0 Channel 5 Channel 7 (MSS_GPADC_IFM_DONE) (HW UNIT 1)
The ADC module example application testing procedure as follows:
HW UNIT 1 is configured
One Shot Mode Testing: (Group 0) (Group 1) (Group 2) (Group 3) (HW UNIT 1)
Group is Triggered for Conversion (Adc Group 0 ) using API Adc_StartConversion()
Wait for until the conversion is completed.
Conversion is stopped using API Adc_StopConversion().
Check the notification message, the notification counter should be incremented with ADC results available in the ADC result buffer ( Adc_AppBuffer )
4.1.14.4. Example Logs¶
ADC_APP: Sample Application - STARTS !!!
ADC_APP: GROUPs 4: HWUNIT 1: LOOP COUNT 1:!!!
--------------------------------------
Apply different voltages (between 0 - 1.8 volts) to the nine ADC channels
CHANNEL 1 => J7-pin19
CHANNEL 2 => J7-pin21
CHANNEL 3 => J7-pin23
CHANNEL 4 => J7-pin25
CHANNEL 5 => J7-pin27
CHANNEL 6 => J7-pin29
CHANNEL 7 => J7-pin31
CHANNEL 8 => J7-pin33
CHANNEL 9 => J7-pin35
CHANNEL 10 => DSP Temp Sensor
CHANNEL 11 => HWA Temp Sensor
CHANNEL 12 => HSM Temp Sensor
--------------------------------------
ADC MCAL Version Info
---------------------
Vendor ID : 44
Module ID : 123
SW Major Version : 9
SW Minor Version : 0
SW Patch Version : 0
Read Buffer Content
-------------------
ADC Group 0 Log:
----------------
Channel HW_CH ADC Value Volt
----------------------------------------------------
0 ADC_IN9 0x00000059 0156mV
1 ADC_IN10 0x00000040 0112mV
2 ADC_IN11 0x00000041 0114mV
ADC Group 1 Log:
----------------
Channel HW_CH ADC Value Volt
----------------------------------------------------
0 ADC_IN0 0x000002a9 1197mV
1 ADC_IN1 0x00000234 0991mV
2 ADC_IN2 0x000001c5 0796mV
3 ADC_IN3 0x0000005e 0165mV
4 ADC_IN4 0x0000005d 0163mV
5 ADC_IN5 0x0000005e 0165mV
6 ADC_IN6 0x00000016 0038mV
7 ADC_IN7 0x00000013 0033mV
8 ADC_IN8 0x00000040 0112mV
9 ADC_IN9 0x00000041 0114mV
10 ADC_IN10 0x00000040 0112mV
11 ADC_IN11 0x00000041 0114mV
ADC Group 2 Log:
----------------
Channel HW_CH ADC Value Volt
----------------------------------------------------
0 ADC_IN0 0x000002a9 1197mV
1 ADC_IN1 0x00000232 0987mV
ADC Group 3 Log:
----------------
Channel HW_CH ADC Value Volt
----------------------------------------------------
0 ADC_IN0 0x000002a9 1197mV
1 ADC_IN5 0x00000062 0172mV
2 ADC_IN7 0x00000011 0029mV
Read Temp Values
-------------------
Temperature Values Group 0 Log:
----------------
Sensor HW_CH Temperature
----------------------------------------------------
DSP ADC_IN09 046deg
HWA ADC_IN10 047deg
HSM ADC_IN11 046deg
All tests have passed
ADC_APP: Sample Application - DONE !!!
4.1.15. FAQ’s¶
None
4.1.16. Test Report(Link to test report)¶
Will be updated in future release
4.1.17. References¶
Autosar SWS 4.3.1 will be updated in future release.
4.1.18. TI Disclaimer¶
Texas Instruments and its subsidiaries (TI) reserve the right to make changes to their products or to discontinue any product or service without notice, and advise customers to obtain the latest version of relevant information to verify, before placing orders, that information being relied on is current and complete. All products are sold subject to the terms and conditions of sale supplied at the time of order acknowledgment, including those pertaining to warranty, patent infringement, and limitation of liability.
TI warrants performance of its products to the specifications applicable at the time of sale in accordance with TI’s standard warranty. Testing and other quality control techniques are utilized to the extent TI deems necessary to support this warranty. Specific testing of all parameters of each device is not necessarily performed, except those mandated by government requirements.
Customers are responsible for their applications using TI components. In order to minimize risks associated with the customer’s applications, adequate design and operating safeguards must be provided by the customer to minimize inherent or procedural hazards.
TI assumes no liability for applications assistance or customer product design. TI does not warrant or represent that any license, either express or implied, is granted under any patent right, copyright, mask work right, or other intellectual property right of TI covering or relating to any combination, machine, or process in which such products or services might be or are used. TI’s publication of information regarding any third party’s products or services does not constitute TI’s approval, license, warranty or endorsement thereof.
Reproduction of information in TI data books or data sheets is permissible only if reproduction is without alteration and is accompanied by all associated warranties, conditions, limitations and notices. Representation or reproduction o f this information with alteration voids all warranties provided for an associated TI product or service, is an unfair and deceptive business practice, and TI is not responsible nor liable for any such use.
Resale of TI’s products or services with statements different from or beyond the parameters stated by TI for that product or service voids all express and any implied warranties for the associated TI product or service, is an unfair and deceptive business practice, and TI is not responsible nor liable for any such use.
Also see: Standard Terms and Conditions of Sale for Semiconductor Products https://www.ti.com/sc/docs/stdterms.htm
Mailing Address: Texas Instruments Post Office Box 655303 Dallas, Texas 75265