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.

TM4C1231D5PZ: Using ADCClockConfigSet without ADC_CLOCK_RATE_*

Part Number: TM4C1231D5PZ

All,

This is more a question related to the Tiva peripheral library, when using ADCClockConfigSet, is it actually mandatory to provide any ADC_CLOCK_RATE_* argument?

Currently we call this function as "ADCClockConfigSet(ADC0_BASE, ADC_CLOCK_SRC_PIOSC, 1);"

We then set up our actual sampling rate by using the adc trigger timers to sample at 1KHz, so is it actually needed to provide this second argument along with the clock source? What will be the effect of writing a 0 to the ADC sample rate in the ADC peripheral configuration register that this function seems to do when lacking this argument?

Thank you in advance,

Jesse

  • Hi,

    Currently we call this function as "ADCClockConfigSet(ADC0_BASE, ADC_CLOCK_SRC_PIOSC, 1);"

    Your above statement will use PIOSC divided by one (16Mhz) as the clock source for the ADC and sample at full sample rate. Your above statement as the effect as what is already the default. In another word, if you don't call ADCClockConfigSet(ADC0_BASE, ADC_CLOCK_SRC_PIOSC, 1), you will get the same result. 

    so is it actually needed to provide this second argument along with the clock source?

    If you don't set the conversion rate (e.g. ADC_CLOCK_RATE_FULL) then it is default to full conversion rate. 

  • Hello Charles,

    My issue is that it seems this register will always be written according to the function code

    So it seems to me that instead of 0x7 this register becomes 0x0, would that be an issue?

    This also seems to be the case when I call ADCClockConfigGet(), I get 0x1 meaning the PIOSC is selected as clock but I would expect to get 0x71 indicating PIOSC source and the default 1Msps, if I call this without the function call I get 0x70

    Regards,

    Jesse

  • Hi Jesse,

      I see what you are saying. I just tried it without specifying ADC_CLOCK_RATE_FULL. The ADCPC register becomes 0. '0' is supposed to be a reserved value. I believe it has no effect on the internal ADC operation and fallback to the behavior as if full conversion is configured. I try it on a LaunchPad by shorting AIN0 pin to either GND or 3.3V and I see the conversion value as either 0000 or 4095. In any case, if you are going to call ADCClockConfigSet then please specify the conversion rate. As I said, in your case, you could have just left out ADCClockConfigSet entirely which will default to ADCClockConfigSet(ADC0_BASE, ADC_CLOCK_SRC_PIOSC | ADC_CLOCK_RATE_FULL, 1).

  • Hi Jesse,

      Sorry,  I mistakenly thought you were using TM4C129 MCU but you are using TM4C123 instead. What I explained above is only true for TM4C129. If you are using TM4C123 and if you want to use PIOSC as the clock source then you must call  ADCClockConfigSet(ADC0_BASE, ADC_CLOCK_SRC_PIOSC | ADC_CLOCK_RATE_FULL, 1) because for TM4C123, PIOSC is not the default clock source for ADC.