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.

CCS/TM4C1294NCPDT: TM4C1294 ADC sample problems

Part Number: TM4C1294NCPDT


Tool/software: Code Composer Studio

how to change the sample rate of adc to get high frequency signals

  • Hello Jagriti,

    What sample rate are you currently at? Can you share your ADC configuration code? What sample rate are you seeking to achieve?
  • SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
    GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_3);
    ADCSequenceConfigure(ADC0_BASE, 3, ADC_TRIGGER_PROCESSOR, 0);
    ADCSequenceStepConfigure(ADC0_BASE, 3, 0, ADC_CTL_CH0 |
    ADC_CTL_IE | ADC_CTL_END);
    ADCSequenceEnable(ADC0_BASE, 3);
    ADCIntClear(ADC0_BASE, 3);

    while(1)
    {

    ADCProcessorTrigger(ADC0_BASE, 3);
    while(!ADCIntStatus(ADC0_BASE, 3, false)) // ---> program stuck HERE
    {
    }
    ADCIntClear(ADC0_BASE, 3);
    ADCSequenceDataGet(ADC0_BASE, 3, pui32ADC0Value);
    analog_value=pui32ADC0Value[0];

    }
    this is the adc configuration code.
    but i can only sample signals of very low frequency around 100 mHz.
  • Hello Jagriti,

    Thank you for sharing the code and current sampling ability, can you please also explain what frequency you are wanting to sample so I can help describe what needs to be done to increase the sampling rate to meet your needs?

  • hello,

    I am trying to sample signals in Kiloherts to megahertz frequency.
  • Hello Jagriti,

    Thank you! kHz frequency sampling is no problem, MHz will be much harder unless you mean just around 1MHz. The ADC is capped at 2MSPS, so you have a limitation from that standpoint.

    In general, you want to use a timer and have the ADC sampling trigger based on the timer rather than using the ADCProcessorTrigger API.

    To get the maximum ADC sampling speed, you should refer to this post where Bob shared source code for getting 2MSPS working: e2e.ti.com/.../2544084

    Bob's code shows how to configure the Timer as well as the ADC for ADC sampling on timer interrupt, so even if you end up not going for the 2MSPS method, you can leverage his example code to add in the timer operation that will help increase your sampling frequency.
  • Hello,

    Thankyou so much, I will try to trigger the ADC using timer.