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.

CLK output on Tiva C Launchpad

Other Parts Discussed in Thread: TM4C123GH6PM, ADS1278

Hello,

I am trying to generate the clk input for a TI ADS1278 ADC from the TIVA C series Launchpad with a Tiva C tm4c123gh6pm processor.  I would like a clock output that can run at a little less than 27MHz.  

The board, a custom launchpad booster pack, has a jumper to select between Port F1 (M1PWM5) and Port B4 (SSI2 CLK) with the intent to run the ADS1278 main clock either from the PWM output or the SSI CLK output.

First I have tried to use one of the PWM outputs, M1PWM5 on Port F1, to generate a 25 MHz output clk from a 50 MHz system clock.  I set the count of the PWM timer to 2, the pulse width to 1 and the PWM clk divider to 1.  This just outputs 3.3v.  However when I change the count to 4 and the pulse width to 2 I get the expected 12.5MHz output.  Is there some limitation that doesn't allow these counter settings?  If so, where is this stated in the documentation?  I have been looking for the minimum value for these settings, but haven't found any stated.

Second, I have considered running the clk input off the SSI2 CLK (Port B4) but I'm not sure how to setup the SSI port clk to continuously run.  Is there an easy way to do this?  How would I read from the device using SSI2 when in this configuration?

Third,  is there another method you would recommend to generate the required clock?  It needs to take up minimal CPU overhead.  Using a timer?  Some other method of outputting the clock or a divided version directly to a GPIO?

Here is the code I used for the setup of M1PWM5:

/**
 * Initializes the M1PWM5 to generate the clock for the ADC
 *  Utilizes PWM module 1 output 5 (PF1)
 *
 *
 *
 *  Clock Setup Options
 *  *25MHz    - 50 MHz system clock,    sysClkFreqDiv = ADC_PWM_DIV2
 *  *26.67MHz - 80 MHz system clock,    sysClkFreqDiv = ADC_PWM_DIV3
 *  *33.33MHz - 66.67 MHz system clock, sysClkFreqDiv = ADC_PWM_DIV2
 *	 (Need 2.0v < DVDD < 2.2v)
 *  /param sysClkFreqDiv - frequency divider of the PWM
 *  values: ADC_PWM_DIV2, ADC_PWM_DIV3
 **/
 void ADC_initClkM1PWM5(uint32_t sysClkFreqDiv) {
	// Setup GPIO config
	SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM1);
	ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);

	GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_1);
	GPIOPinConfigure(GPIO_PF1_M1PWM5);
	SysCtlPWMClockSet(SYSCTL_PWMDIV_1);
	
	// Configure the PWM generator for count down mode with immediate updates
	// to the parameters.
	PWMGenConfigure(PWM1_BASE, PWM_GEN_2,
			        PWM_GEN_MODE_DOWN | PWM_GEN_MODE_NO_SYNC | PWM_GEN_MODE_DBG_STOP);
	
	// Set the period in number of clock cycles.
	//PWMGenPeriodSet(PWM1_BASE, PWM_GEN_2, sysClkFreqDiv);
	//PWMGenPeriodSet(PWM1_BASE, PWM_GEN_2, 2);
	PWMGenPeriodSet(PWM1_BASE, PWM_GEN_2, 4);
// Set the pulse width. // PWMPulseWidthSet(PWM1_BASE, PWM_OUT_5, 1); PWMPulseWidthSet(PWM1_BASE, PWM_OUT_5, 2);
// Start the timer. PWMGenEnable(PWM1_BASE, PWM_GEN_2); // Enable the output. PWMOutputState(PWM1_BASE, PWM_OUT_5_BIT, true); }

Here is the output with a PWM count of 4 and a pulse width of 2:

Let me know if you need any other information.  I appreciate any help you can give.

Regards,

Curtis

  • Feel your pain - but the goal of achieving a robust clock output w/in one binary divide of System Clock - may prove elusive. 

    From PWM viewpoint - ARM MCUs (not just this vendor's various incarnations) have long had "difficulty" in achieving robust PWM output when the duty cycle drives to the extreme.  (either max or min)  While you've not (precisely) reached those bounds - your report duplicates our group's findings - across ARM MCUs here & from other makers.

    A Timer - when configured for PWM mode - may be able to exceed, (System Clock / 4).  (we've recently tested at that division - our findings at, "/2" were somewhat suspect - you may wish to attempt such under your unique conditions - using your chosen MCU.  Note that - to my knowledge - Timer strapped to PWM mode is unique in actually applying the timer's output to an MCU pin.  I'd suspect that this may be your best (only) method of meeting your clock output requirement.

    While not mentioned - your post - might this 25-27MHz clock you target have to be "sync'ed" to other signals?  Should that prove the case - your (design goose) may be, "en flambe!"

  • Thanks for the response.  It's a shame I can't get the device to output a clock source from the onboard PLL.

    I also found another response in the precision dataconverter forums helpful:

    http://e2e.ti.com/support/data_converters/precision_data_converters/f/73/t/324019.aspx

    I think I'm just going to add an oscillator that was used in the EVM. (http://www.ctscorp.com/components/Datasheets/008-0256-0.pdf)

    -Curtis

  • Curtis Mayberry1 said:
     It's a shame I can't get the device to output a clock source from the onboard PLL.

    Continue to feel your pain - but your statement (boldened, especially) is too broad in its conclusion!  You may not be able to robustly reach so high an output frequency - as you seek - via the onboard PLL and its connected, follow-on peripherals.  You (and all others) most assuredly may output a selectable clock source - which "normally" will reach w/in SysClk/4 (max)!  (and perhaps - under the right set-up/config - reach even higher...)

    One last gasp here - possibly if you ran your MCU's System Clock @ 80MHz (assume that's allowed) the "/4" you've already achieved thus yields a stable, 20MHz - which may prove acceptable as clock source for your ADC. (i.e. may reduce, "speed of conversions" - but not degrade ADC's accuracy - one hopes...)

    Note:  I've neither used nor examined your ADC's data manual - but this just may work - while saving the cost/size/effort required of additional components...  Thanks for your verify - always welcome & appreciated...