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.

ADC Clock



Hello,

I just want to read sometimes an anlaog value on a Pin of my TM4C129EXL board (Port E, Pin 4), served by some peripheral.

Here is my init:

void init_ADC(void)
 {
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
	GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_4 );
	ADCSequenceConfigure(ADC0_BASE, 3, ADC_TRIGGER_PROCESSOR, 0);
        ADCSequenceStepConfigure(ADC0_BASE, 3, 0, ADC_CTL_D | ADC_CTL_CH0 | ADC_CTL_IE | ADC_CTL_END);
        ADCSequenceEnable(ADC0_BASE, 3);
 }

I just want to read the value once at some points in my code.

Therefore I dont want to change the system-clock which is 120MHz and initialised as following:

    ui32SysClockFreq = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
                                           SYSCTL_OSC_MAIN |
                                           SYSCTL_USE_PLL |
                                           SYSCTL_CFG_VCO_480), 120000000);

My questions:

1. Is it enough to use the ADCSequenceDataGet funktion in my code to read the ADC value?

2. what do I have to do to run the programm with my normal clock?

Please tell me in an easy way, Im  new to this.

regards

  • Hello Martin

    On the TM4C1294, the default clock for ADC is the 16MHz PIOSC which shall yield 1MSPS rate of sampling. So from a clock perspective there is nothing that needs to be configured.

    For getting the data, you would need to trigger the ADC conversion. I would suggest looking under examples/peripherals/adc for sample code in TivaWare.

    Regards
    Amit