This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VM: J721E

Part Number: TDA4VM


How to configure ADC in continuous Read mode for voltage monitoring..?

I did the following method for configuration

#define ADC1_CHANNEL_NO 6

static int8_t AdcConfiguration()
{

adcStepConfig_t adcConfig;
uint32_t configStatus;
uint32_t baseAddress = CSL_MCU_ADC1_BASE;

BoardDiag_initADC(baseAddress);

ADCEnableIntr(baseAddress,(ADC_IRQENABLE_SET_END_OF_SEQUENCE_MASK|
ADC_IRQENABLE_SET_FIFO0_THR_MASK |
ADC_IRQENABLE_SET_FIFO0_OVERRUN_MASK |
ADC_IRQENABLE_SET_FIFO0_UNDERFLOW_MASK |
ADC_IRQENABLE_SET_OUT_OF_RANGE_MASK));

/* Initialize ADC configuration params */
adcConfig.mode = ADC_OPERATION_MODE_CONTINUOUS;
adcConfig.openDelay = 0x1U;
adcConfig.sampleDelay = 0x1U;
adcConfig.rangeCheckEnable = 0U;
adcConfig.averaging = ADC_STEPCONFIG_AVERAGING_16_SAMPLESAV;
adcConfig.fifoNum = ADC_FIFO_NUM_0;

configStatus = ADCSetStepParams(baseAddress, ADC1_CHANNEL_NO, &adcConfig);
if (configStatus != 0)
{    
     return -1;
}

ADCStepIdTagEnable(baseAddress, TRUE);

configStatus = ADCSetCPUFIFOThresholdLevel(baseAddress,
ADC_FIFO_NUM_0, 40U);
if (configStatus != 0)
{     
      return -1;
}

return 0;

}

static void BoardDiag_initADC(uint32_t baseAddress)
{
        uint8_t delay;

        /* Clear All interrupt status */
        ADCClearIntrStatus(baseAddress, ADC_INTR_STATUS_ALL);

/* Power up AFE */
ADCPowerUp(baseAddress, TRUE);

/* Wait for 4us at least */
for(delay = 0; delay<4; delay++);

/* Do the internal calibration */
ADCInit(baseAddress, FALSE, 0U, 0U);

}

  • It looks like the functions come from the RTOS, so I think you will likely want to look at: example/adc/adc_singleshot_test_app/adc_app.c as an example.

    The example has (at least) two more function calls that are pertinent to getting the ADC to run:

    ADCStepEnable

    AppADCStart

    Kevin