AM273x MCU+ SDK  08.06.00
GPADC

The GPADC driver provides API for safety monitoring of the inputs, such as the temperature sensor, voltage regulators to the device.

Features Supported

  • 10-bit ADC
  • Supports Inter Frame Monitoring Mode(IFM)
  • Software command mechanism to trigger the conversion – Storage of min, max, and sum of the samples captured per channel

SysConfig Features

Note
It is strongly recommend to use SysConfig where it is available instead of using direct SW API calls. This will help simplify the SW application and also catch common mistakes early in the development cycle.
  • Selection of Channel read mode
  • Set Channel index number to read from
  • Set Channel Bitmap
  • Option to set the conversion mode
  • Set Channel Configuration values

Features NOT Supported

Continous Time Monitoring Mode(CTM)

Example Usage

Include the below file to access the APIs

#include <drivers/gpadc.h>

GPADC Single Buffer Read

int32_t status = SystemP_SUCCESS;
uint16_t gpadc_result = 0;
uint16_t channelCount;
for(channelCount=0; channelCount<CONFIG_GPADC_CHANNEL_NUM_INSTANCES; channelCount++)
{
convRes = GPADC_startSingleChannelConversion(gCfgPtr.channelConfig[channelCount].channelID, &gpadc_result);
}

GPADC Group Buffer Read

int32_t status = SystemP_SUCCESS;
uint16_t gpadc_result[9];
uint8_t index =0;
uint32_t adcInMv;
channels.bits.b9_ChannelSelectionBitMap = (CONFIG_GPADC0_CHANNEL_BITMAP & 0x1FF);
GPADC_setupResultBuffer(&gpadc_result[0]);
convRes = GPADC_startGroupConversion(channels);
for(index=0; index < MAX_GPADC_MEAS_SOURCES; index++)
{
adcInMv = (gpadc_result[index] * (UPPER_REFERENCE -LOWER_REFERENCE))/
(1<<ADC_DEF_CHANNEL_RESOLUTION);
}

GPADC Temperature Sensor Read

int32_t convRes;
uint8_t numAverageSamples;
numAverageSamples = 5U;
convRes = GPADC_readTemperature(numAverageSamples, &tempValues);

API

APIs for GPADC

GPADC_initTempMeasurement
void GPADC_initTempMeasurement(void)
Initialize GPADC efuse temperature parameters.
GPADC_startGroupConversion
GPADC_ConvResultType GPADC_startGroupConversion(GPADC_channelsGroupSelectType channels, uint8_t numChannels)
Starts and triggers the multi channel ADC conversion.
GPADC_CONV_ERROR
@ GPADC_CONV_ERROR
GPADC conversion error.
Definition: gpadc/v0/gpadc.h:342
MAX_GPADC_MEAS_SOURCES
@ MAX_GPADC_MEAS_SOURCES
0x9 - MAX_CHANNELS
Definition: gpadc/v0/gpadc.h:333
GPADC_readTemperature
int32_t GPADC_readTemperature(uint8_t numAverages, uint8_t numChannels, GPADC_TempSensValueType *tempValuesPtr)
Read the temperature sensor value.
SystemP_SUCCESS
#define SystemP_SUCCESS
Return status when the API execution was successful.
Definition: SystemP.h:56
GPADC_setupResultBuffer
int32_t GPADC_setupResultBuffer(uint16_t *ResBufferPtr)
Initializes GPADC driver with the group specific result buffer start address where the conversion res...
gpadc.h
GPADC_ConvResultType
GPADC_ConvResultType
Enumeration which describes the error types of GPADC conversion.
Definition: gpadc/v0/gpadc.h:340
GPADC_startSingleChannelConversion
GPADC_ConvResultType GPADC_startSingleChannelConversion(GPADC_MeasExtSrcType channelID, uint16_t *gpadcValue)
Starts and triggers the single channel conversion. Pass the channelID and result address to the drive...
GPADC_channelsGroupSelectType
Available <0-8> external sources/channels could be selected by using bitmap of 9 bits in LSB....
Definition: gpadc/v0/gpadc.h:502
GPADC_channelsGroupSelectType::bits
struct GPADC_channelsGroupSelectType::@1 bits
Channel selection bitmap bits.
GPADC_TempSensValueType
The Temperature sensor values structure.
Definition: gpadc/v0/gpadc.h:620
GPADC_channelsGroupSelectType::b9_ChannelSelectionBitMap
uint16_t b9_ChannelSelectionBitMap
Channel selection bitmap for triggering group GPADC conversion and getting results for the specified ...
Definition: gpadc/v0/gpadc.h:511