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.

C28 core clock and ePWM

Other Parts Discussed in Thread: ADS8556

I am using the Concerto control card that has the F28M35H52C1 micro .

The control card has a 20 MHz crystal so I set up clocking to have C28 core @ 150 MHz and m3 core a@ 75 MHz with the setup below:


// Sets up PLL, M3 running at 75MHz and C28 running at 150MHz
SysCtlClockConfigSet(SYSCTL_USE_PLL | (SYSCTL_SPLLIMULT_M & 0xf) |
SYSCTL_SYSDIV_2 | SYSCTL_M3SSDIV_2 |
SYSCTL_XCLKDIV_2);

then I setup ePWM to get a 1.5 KHz frequency on PWM1A like below:


EPwm1Regs.TBCTL.bit.CLKDIV = 0; // CLKDIV = 1
EPwm1Regs.TBCTL.bit.HSPCLKDIV = 1; // HSPCLKDIV = 2
EPwm1Regs.TBCTL.bit.CTRMODE = 2; // up - down mode

EPwm1Regs.AQCTLA.all = 0x0006; // ZRO = set, PRD = clear

EPwm1Regs.TBPRD = 25000; // 1.5KHz - PWM signal

Based on my calculation and reading: Frequency 0f PWM = C28SYSCLK/(2*HSPCLKDIV*CLKDIV*TBPRD) = 150000000/(2*2*1*25000) = 150000000/100000 = 1500 HZ.

When I run my program, I get a 750 PWM.

What am I doing wrong? Is there another clock divider that I am missing ? OR Is my calculation wrong?


 

  • Mike,

    Here's what I calculate based on your settings:
    C28SYSCLK = (XTAL_freq * PLL_val / SYSDIV_val) / fixed_divider [ has a value of 2] = (20M * 15 / 2) / 2 = 75MHz
    M3SSCLK = C28SYSCLK / M3SDIV_val = 75MHz / 2 = 37.5MHz

    PWM1A_freq = C28SYSCLK/(2 [up-down count] *HSPCLKDIV*CLKDIV*TBPRD) = 750Hz

    Figure 1-11 shows the fixed divider which is used if the PLL is used.


    Thank you,
    Brett

  • Ok I understand the timing profile much better than before.

    Thank you for your detailed explanation.

    The other problem I am facing now is providing clocks for external devices.

    I need to provide at least three clock sources for an ADC, DAC, and another external device.

    What options does the concerto offer?

    I tried to research the documentation but could not find anything.

  • Mohammad,

    I may be wrong, but I believe the, "how to provide a clock source question using C2000" is a part of the bigger question, "how to interface a C2000 with an ADC, DAC, etc".

    These types of components work via Serial (SPI), I2C, Parallel, or some protocol and you'd want to use that interface to connect said component with the C2000 MCU.  For example, if you choose a DAC with a Serial/SPI interface than you'll use the C2000's SPI peripheral and the SPI-CLK will provide the necessary clock.

    Alternatively, you can always toggle GPIOs based on the timings you need in order to create an interface that you need (assuming the MCU has enough bandwidth and is fast enough to do it).

    Also, the internal ADC on the C2000 is quite good so I would recommend using it (or at least trying it) unless your project requires you to do otherwise.


    Thank you,
    Brett

  • So here is the picture:

    I am interfacing an external ADC specifically ADS8556 with F28M35H52C1 micro.

    I want to do parallel interface so I am using EPI.

    I am thinking of using the EPI clock as the conversion clock for the ADA8556 and use a PWM from the ePWM module to trigger the conversions by tying it to the CONVST_A pin. The PWM period would be the conversion time + the time to process the data .

    Any thoughts?

  • Mohammad,

    This seems valid. 

    PWM modules (16 bit timer), eCAP modules (32-bit timers), and toggling GPIOs (where the 32-bit CpuTimers provide the timing) would be my suggestions for trigger outputs/potential clock outputs that would be unrelated to a specific interface like EPI, SPI, McBSP, etc. 


    Thank you,
    Brett