• TI thinks resolved


Expert 1945 points

Part Number: LAUNCHXL-F28377S

Tool/software: Code Composer Studio


I have a question about “2837x_rfft_adc_rt”:

I need to increase my sample rate analog to digital from 100ksps to  500 Ksps,

changing the following parameter in the "example_setup.h" is enough?

#define ADC_SAMPLING_FREQ    100000.0L

or other changes in the project is necessary.

Thank you for your help.

Best regards,


  • Hi Amin,

    I'm writing to let you know that a C2000 team member has been assigned to this post and should be answering shortly.


    Did a reply answer your question? If yes, please click the "Verify Answer" button located at the bottom of that post.
    Visit these helpful C2000 Links!

    C2000 TI Wiki Pages
    TI Forum Sitemap
    C2000 Getting Started
    CLA FAQs
    Workshop Material!
  • Amin,

    It looks like ADC_SAMPLING_FREQ only adjusts the calculations in main(). It does not affect the code that configures the ePWM in examples_setup.c to actually trigger conversions at a faster rate.

  • Expert 1945 points

    In reply to Whitney Dewey:

    Hi Whitney,

    Thank you for your reply. How do I change it to 500ksps?

    Best regards,


  • In reply to amin:

    The EPWM1_PERIOD and EPWM1_DUTY_CYCLE macros in example_setup.h control the ePWM that triggers conversions. If you divide them both by five that should do it.

  • Expert 1945 points

    In reply to Whitney Dewey:

    Dear Whitney,

    In this project(2837x_rfft_adc_rt) there is a square wave generator, I want to control the start and stop point of each pulses and sampling the analog signal in other ADC channel at the same time.

    How can I generate a certain number of square wave, for example 1 square wave? I need to have the “start” and “end” points of each square wave in the project and run ADC pin_A0 from start point to end point of each square wave.

    In other words, If we assume “A” is the start point of each pulse period, and the end point of each period is point “B”,  then: 

    start point of ADC= at the beginning of square wave(point A)

    end point of ADC= at the end point of square wave(point B)

    How do I synchronize the ADC channel and Square wave generator?

    Thank you and best regards,


  • In reply to amin:

    Hi Amin,

    The example you're using already has the PWMs configured to start their clocks at the same time. That's what's happening in FPU_startEPWM() where the TBCLKSYNC bit is being set. Then if you've configured the two PWM modules to have the same period and dividers (see the TBPRD and TBCTL registers) they should have the same end points too. Have you tried that?


  • Expert 1945 points

    In reply to Whitney Dewey:

    The frequency of ADC and the PWM is not equal.
    PWM freq. = 200Hz
    ADC sampling freq. = 500ksps
    Please show me in the project. Thank you for your help.
  • In reply to amin:

    In examples_setup.h, what values are the #defines for period and duty cycle?

    Also, make sure you have _LAUNCHXL_F28377S in your predefined symbols in your projects' compiler settings. You need to do that to make sure InitSysCtrl() is configuring the system clock to run at the expected 200MHz.

  • Expert 1945 points

    In reply to Whitney Dewey:

    In examples_setup.h :

    #define CPU_FRQ_200MHZ          1
    #define ADC_SAMPLING_FREQ       100000.0L
    #define EPWM_CLK                100000000UL // EPWM_CLK starts off SYSCLK/2
    #define EPWM_CLKDIV             1           // TBCLK = SYSCLK/(2*2)
    #define EPWM_HSPCLKDIV          4           //       = SYSCLK/(2*2*8) or EPWM_CLK/(2*8)
    // desired freq 100KHz
    #define EPWM1_PERIOD            EPWM_CLK/(2*8*100000UL)
    #define EPWM1_DUTY_CYCLE        EPWM1_PERIOD/2UL
    // desired freq 10KHz
    #define EPWM2_PERIOD            (EPWM_CLK)/(2*8*10000UL)
    #define EPWM2_DUTY_CYCLE        EPWM2_PERIOD/2UL
  • In reply to amin:

    This code looks like it's setting up the PWMs to run at 100kHz. Where are you seeing 200Hz? Is that what you see when you look at the PWM signals on an oscilloscope?