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.

TM4C123H6PM OUTPUT 20MHZ

Other Parts Discussed in Thread: TM4C123GH6PM

The api function describes Configures and enables or disables the clock output on the DIVSCLK pin.SysCtlClockOutConfig(),but i can not find the DIVSCLK pin.my platform is tiva c series launchpad.

  • Hello Zengfu

    The SysCtlClockOutConfig function is for TM4C129 devices only

    Regards

    Amit

  • How to use TM4C123GH6PM to produce 20MHZ squarewave,the pwm wave don not have enough time to bulid.

    Regards.

  • Hello Zengfu,

    You would have to use the PWM Module to generate a waveform of 20MHz. The example code that you can use is kept in TIVAWare installation on your PC and under examples/peripheral/pwm

    Import one of the existing examples like blinky and replace the main code of the example with the same code and update the parameters for 20MHz when System Clock is 80MHz.

    Regards

    Amit

  • Hello Amit

    I  have used two ways to make it,the fisrt way is Timer Module,the second way is pwm Module. 

    SysCtlColckGet()=80M : 

    code:

    void TIME_Init()
    {
    SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    GPIOPinConfigure(GPIO_PF1_T0CCP1);
    GPIOPinTypeTimer(GPIO_PORTF_BASE, GPIO_PIN_1);
    TimerConfigure(TIMER0_BASE,TIMER_CFG_SPLIT_PAIR|TIMER_CFG_B_PWM);
    TimerLoadSet(TIMER0_BASE, TIMER_B, 3);
    TimerMatchSet(TIMER0_BASE, TIMER_B,TimerLoadGet(TIMER0_BASE, TIMER_B) / 2);
    TimerEnable(TIMER0_BASE, TIMER_B);
    }

    void PWM_Init()
    {
    SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM0);
    PWMGenConfigure(PWM0_BASE,PWM_GEN_2,PWM_GEN_MODE_DOWN|PWM_GEN_MODE_NO_SYNC);
    PWMGenPeriodSet(PWM0_BASE,PWM_GEN_2,4);
    PWMPulseWidthSet(PWM0_BASE,PWM_OUT_5,PWMGenPeriodGet(PWM0_BASE,PWM_GEN_2)/2);
    //PWMDeadBandEnable(PWM0_BASE,PWM_GEN_0,800,1600);//us T=100 us rise delay 10 us fall delay 20us
    //PWMPulseWidthSet(PWM0_BASE,PWM_OUT_1,PWMGenPeriodGet(PWM0_BASE,PWM_GEN_0)/2);
    PWMOutputState(PWM0_BASE, PWM_OUT_5_BIT, true);
    //PWMOutputState(PWM0_BASE, PWM_OUT_1_BIT, true);
    PWMGenEnable(PWM0_BASE,PWM_GEN_2);
    }

    the wave is :

  • Hello Zengfu,

    Yes. That is correct, Using the Timer in PWM Mode can also get the same result. So is the issue that you are not getting a square wave?

    Did you change the drive strength of the IO to higher drive? Also make sure that capacitive load is not very high as it may distort the waveform.,

    Regards

    Amit

  • zengfu zengfu said:
    //PWMDeadBandEnable(PWM0_BASE,PWM_GEN_0,800,1600);//us T=100 us rise delay 10 us fall delay 20us

    20MHz PWM generation AND your spec'ed DeadBand - ain't gonna happen!  Good that's commented out...

    20MHz PWM - really?   Does that leave sufficient room for adequate, "Duty Cycle" variation?  (especially so as your PWM period is just 4 PWM clocks!)  Can this even be considered "real" PWM with such limited variation/control???

    Usual, "Rule of thumb" the higher the PWM frequency the less the PWM resolution.  For years - 20KHz PWM (just above (most) human hearing Freq range) has worked well - and enabled extensive duty cycle variation/control...

    If you must run, "full blast" suggest that you try 200KHz - see how that works...  (duty cycle variation improves immensely!)

  • capactive load?how to change it?

    i just think the module do not have enough time to build the squarewave in hige frequence.

    how to get the 20Mhz squarewave.

    Regrads.

  • yeah yeah

    the deadband just a test,i have added //

    i just need 20Mhz,this module maybe not produce it ,TM4C123H6PM do not have the clk pin.

    how to make it.

  • Why do you believe that you need 20MHz PWM?

  • the ov7670 module xpclk input ,typical value is 24Mhz.

  • Might that input require at/near 24MHz as its clock input?

    Your description of PWM masked this - you are using the PWM only due to its high frequency output capability.

    That said - what is the value of such high speed clock - when your ability to manipulate, capture and/or present data - at/near that rate - likely will prove a challenge.

    (iirc - that camera module (or similar) has been massaged into operation via similar class MCUs with camera-targeted peripheral - easing the SW burden...)  Your review of that effort may prove worthwhile...

  • thanks.

    i am going to get more information.

    Regards

  • thanks.

    Regards.