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.

TMS320F28375S: TMS320F28375S

Part Number: TMS320F28375S
Other Parts Discussed in Thread: SYSCONFIG, , C2000WARE

Hello Team,

I am working on TMS320F28375S with ccs 12.6.0. I am using inbuilt sysconfig (1.19.0) of ccs. I am facing problem in delay generation and also in PWM. I am explaining my problem in detail.

(1)  the PWM which I am getting are the Half of what I am setting in sysconfig.

my Ftbclk is 200 MHz. (TimeBase Clk Divider  = 1 and HighSpeed Clk Divider = 1)

with the help of above formula, I set the value of Time Base Period as 5000 to generate 10KHz frequency.

Counter mode = up-down count mode.

but I am getting only 5KHz by above settings.

(2) I am using FreeRTOS in my project with cpu clock as 200MHz and tick rate as 1000.

I have set the delay of 100ms in vTaskDelay function but i am getting 200ms delay.

can anybody please help me with this?

  • Hi Muzammil,

    Keep in mind that the frequency of your TBCLK (f_TBCLK) is a scaled version of the frequency of your EPWM clock (not your system clock which is 200MHz). The EPWM clock should be 100MHz max as defined by the device datasheet section 7.11.2.2.1 ePWM Timing Requirements. There is also a note in the datasheet there that states " For SYSCLK above 100 MHz, the EPWMCLK must be half of SYSCLK." meaning that your EPWMCLK should be 100MHz (there is a divider (EPWMCLKDIV) of the system clock that defaults to EPWMCLK = SYSCLKOUT/2).

    With the CLKDIV and HSPCLKDIV dividers set to 1, the TBCLK frequency should be100MHz. So if your target PWM frequency is10kHz, you should indeed be using a TBPRD of 5000 as you have currently set for up-down count mode correctly.

    Could you please double check that the clock divider bits are correctly set during debug? If one of these is set to /2 that would explain the 5kHz (HSPCLKDIV specifically is set to /2 by default).

    Best Regards,

    Allison

  • Hello Allison,

    Thanks for correcting me.

    F_tbclk is actually 100 MHz. even though I have set true value in TBPRD (5000). still i am not getting 10KHz frequency.

    Could you please double check that the clock divider bits are correctly set during debug? If one of these is set to /2 that would explain the 5kHz (HSPCLKDIV specifically is set to /2 by default).

    Secondly, can you please help me with my second issue related to delay in vTaskDelay function in FreeRTOS which i have mentioned earlier?

    thanks for your support.

  • Hello Allison,

    After checking, my all peripherals are working on half the frequency from which i have set.

    means they are working on 100 MHz instead of 200 MHz.

    I am using Launchpad F28379D because i come to know that i can run my f28375s code in launchpad (considering the peripheral / device differences).is there any settings on launchpad that i am missing??

  • Hi Muzammil,

    Could you check the clocktree in SysConfig so we can trace the clock source back and see what dividers/multipliers are being used for SYSCLK --> PLL --> EPWMCLK...?

    Regarding the Free RTOS question - I am speculating this may be resolved when we figure out the half-frequency clocking issue. If not, I will loop in a Free RTOS expert for some help with that Slight smile

    Best Regards,

    Allison

  • Hello Allison,

    here is the screenshot of my clock tree. Please guide me if anything is wrong in this clock source.

      

    Regarding the Free RTOS question - I am speculating this may be resolved when we figure out the half-frequency clocking issue.

    Yes, I am also assuming that.

    thanks and regards

  • Hi Muzammil,

    The clocktree looks good to me so far, so I will try to test this on my end. In the meantime you can also scope out the clocks (e.g. PLL, SYSCLK, etc) by using the sysctrl module. There is not a C2000Ware example to do this for this specific device, but there is an example for another device you can reference ({C2000Ware}\driverlib\f28p65x\examples\c28x\sysctl\sysctl_ex2_xclkout_config.c) and select which clock to route out to a GPIO.

    By using an oscilloscope with this, you can check that the frequencies indeed match what is expected based upon your clock multipliers/dividers.

    Best Regards,

    Allison

  • Hello Allison,

    for some reason, there is not showing the reply option on your thread. i don't know why so i am reply to this.

    coming to my question, i show that the clocking functions in Device.c file are not taking parameters from clocktree.h file but instead of that they are taking parameters from Device.h file. can this be the source of errors???

    thanks and regsrds

  • Hi Muzammil,

    Thanks for the note about it going to Device.h. I've been trying to test out some of our examples and I see the same behavior on this single core and the dual-core version of the device at the moment. I also did triple check that the device.h files share the same configurations for the clock settings between the 2 devices, but I want to look more into some of the clock dividers and will get back to you with an update tomorrow. 

    Best Regards,

    Allison

  • Hi Muzammil, 

    Please allow for another day for me to look into this. Thanks for the patience!

    Best Regards,

    Allison

  • Hello Allison,

    Not a problem

    thanks for support.

  • Hi Muzammil,

    Apologies again for some delay but I will try to find more clarity on if it's in device.h by end of Monday. I also wanted to be sure I asked if you are using our C2000Ware EPWM examples or your own code? If you haven't already, you could try out one of our examples and see if you get a similar result based on the TBPRD? Another question- if you switch count modes to asymmetric (e.g. up-count) do you still see half the expected frequency?

    Best Regards,

    Allison

  • Hello Allison,

    you could try out one of our examples and see if you get a similar result based on the TBPRD?

    I have already checked the example (epwm_ex2_updown_aq) and other like this, and it is working fine in this case. but i think that the the EPWM module is not configured by sysconfig tool in that projects. but it is configured manually by making initEPWM1(); functions like this. so the change in Ftbclk by syscongif does not effect to epwm frequency in this case.

    if you switch count modes to asymmetric (e.g. up-count) do you still see half the expected frequency?

    for up/down case the formula is,

    but for only up-count the formula is,

    so it is obvious that the frequency will change.

    please correct me if i am wrong.

    thanks and regards.

  • Hi Muzammil,

    I have already checked the example (epwm_ex2_updown_aq) and other like this, and it is working fine in this case. but i think that the the EPWM module is not configured by sysconfig tool in that projects.

    Thanks for letting me know. I will look into other sysconfig based projects for this. Would you also be able to attach your code? Or if it is based on a specific sysconfig project, let me know.

    As for changing the count modes, what I meant was that you could change to up-count and alter the TBPRD accordingly with that second equation (so you would use TBPRD = 10000) to see if you are able to get the desired 10kHz frequency or if you still see 5kHz. That was just a thought to be sure that it wasn't dependent on your EPWM counter settings and was a project-level issue Slight smile

    Best Regards,

    Allison

  • Hello Allison,

    Or if it is based on a specific sysconfig project, let me know.

    I have made my project form existing project "cla_ex1_asin" and modified it according to my use.

    That was just a thought to be sure that it wasn't dependent on your EPWM counter settings and was a project-level issue

    as i have mentioned previously that, After checking, not only EPWM but all peripherals are working on half the frequency from which i have set. e.g. timers, freertos etc.

    I am attaching my code here,

    2577.motor-controller-ti.zip

    please note that, i have included the clocktree.h file in Device.c and i have commented the necessory clock function in Device.h file so that it can take that arguments from clocktree.h file. at this stage the code is working fine but as i remove the clocktree.h file from Device.c, the clock functions take the arguments from Device.h and the issue begins. i just want to find the root cause so that this problem do not occur afterwards.

    thanks and regards

  • Hi Muzammil,

    Thanks for the info. Can you please send a screenshot of the SYSPLLMULT and SYSCLKDIVSEL register values while running? I want to check exactly what these are set to during run time.

    Best Regards,

    Allison

  • Hello Allison,

    I don't know exactly what you are asking for but i have sent my whole project in previous message. can you please check it from there for me?

    btw i am using launchpad F28379D for now.

    thanks for your support.

    the frequency problem will occur when you will remove the "CPU1_RAM/syscfg/clocktree.h" file from device.c and include device.h file.

  • Hi Muzammil,

    In case you didn't know, there is a register viewing window you can use in CCS to look at register values live during debug. Here are the steps to do so, since this is a very helpful way to debug your program Slight smile

    1. Open CCS, start a debug session to run your project code.
    2. With the code running, in the CCS tool bar at the top, go to 'View' > "Registers'
    3. A window should pop open called 'Registers'. Be sure to select the 'Continuous Refresh' button at the top of that window so that the registers are automatically refreshed (they will highlight yellow as the values change/update).
    4. You can scroll down to any register and expand it to reveal the register fields and check the values of each field in hex or binary. For numbers like TBPRD etc. you can also right click on the register field value and change the number format to decimal if you don't want to see it in hex.

    Now to explain a bit of what I've been doing while looking into this and how I figured out what was going wrong:

    • I ran your project as is (and then with 5000 TBPRD for EPWMs) and measured EPWM2A on GPIO2 (pin 80 of F28377S LaunchPad):
      • PLL registers were all expected values
      • Resulting frequency was 10kHz for TBPRD of 5000 which is good/expected
    • I commented out clocktree.h and included device.h within the device.c file and also tried to comment out clocktree.h from device.h, but could not as I received some errors - so I switched back to other examples I've been running to debug this.
    • Specifically, I have been running epwm_ex2_updown_aq.c driverlib example from C2000Ware:
      • Modified the project so that TBPRD is 5000 and kept duty cycle constant
      • EPWM frequency output has been 5kHz instead of 10kHz which is unexpected
      • One of the PLL clock multipliers was different (all else looked good).
        • In the SYSPLLMULT register, IMULT (integer multiplier was 20 decimal instead of the expected 40).
        • This is what was causing the system to run at half clock, so there was a 5kHz PWM instead of 10kHz.

    Looking at the device.h file, the project must accidentally be pulling in the F2837xS ControlCard default configurations, which uses a 20MHz OSC source and IMULT of 20. The F2837xS LaunchPad has a 10MHz OSC source and should hence be using an IMULT of 40. I believe this is what was causing the issue - so while the device.h is correct, the wrong board-specific configurations were being pulled into the project.

    • To resolve this without implementing the SysConfig clocktree:
      • Some C2000 boards require a predefine symbol to correctly set the clock and other configuration settings on the device. When viewing the “device.h” file of the project, there are #ifdef lines that use pre-defined symbols like:
        • "#ifdef _LAUNCHXL_F28377S" seen in image below
      • When you see an ifdef symbol like “_LAUNCHXL_F28377S” AND that is the board you are using for your tests, you will need to add a pre-defined symbol to your project so that it can recognize the board you are using and implement any changes accordingly
      • To add the pre-defined symbol:
        • In CCS, right click the project being used, then choose Properties → Build → C2000 Compiler → Predefined Symbol → then choose the plus button “add” symbol. Add the given pre-define symbol for your particular device that was found in the device.h file (like “_LAUNCHXL_F28377S”)
    • To resolve this by implementing the SysConfig clocktree:
      • The multipliers/dividers etc are all correct in the SysConfig clocktree, but were not being implemented, so in order to do so you need to add the sysconfig 'device support' and then also exclude the project device files from the build (which can be done by right-clicking on the files in project explorer panel and 'excluding from build')
      • After adding device support and rerunning the example, I see the 10kHz EPWM as expected since the project is using SysConfig and adjusting to the board used.
    • Please note that this frequency change and difference in board-specific configurations are not a concern with newer devices and with SysConfig support. Also just wanted to say thank you for your patience as I looked into this! Please let me know if this resolves the issue and if there's anything else I can do to help!

    Best Regards,

    Allison

  • Hello Allison,

    Thank you for your continuous support, i really appreciate it.

    Looking at the device.h file, the project must accidentally be pulling in the F2837xS ControlCard default configurations, which uses a 20MHz OSC source and IMULT of 20. The F2837xS LaunchPad has a 10MHz OSC source and should hence be using an IMULT of 40. I believe this is what was causing the issue - so while the device.h is correct, the wrong board-specific configurations were being pulled into the project.

    So all this clocking issue was because of using the Launchpad F28379D (which i am using currently but with TMS320F28375S based project). that is what you are trying to say??

    • When you see an ifdef symbol like “_LAUNCHXL_F28377S” AND that is the board you are using for your tests, you will need to add a pre-defined symbol to your project so that it can recognize the board you are using and implement any changes accordingly
    • To add the pre-defined symbo

    I have selected TMS320F28375S for my project but as i come to know that there is no any board related to this controller(please suggest if any), so i am using the Launchpad F28379D till my actual PCB of TMS320F28375S gets ready which is in R&D stage at this time. (please note that i am not using 77S but i am using 75S).so which predefined symbol should i use for that??

    Please note that this frequency change and difference in board-specific configurations are not a concern with newer devices and with SysConfig support.

    overall, the issue was not in clock selection but in the controller selection and in the symbols. that is what you are trying to say??

    thanks and regards

  • Hi Muzammil,

    Yes, this was a difference between only the F2837 Launchpad vs. F2837 ControlCard. Like I mentioned, this is not the case for newer devices or if you use SysConfig.

    For testing with the launchpad as you are doing now, you should add the pre-define symbol so that the clock settings reflect what you'd expect. When you are using the controlcard, you can remove the pre-define symbol Slight smile

    Looking at the device.h, the ifdef statement is "#ifdef _LAUNCHXL_F28377S", so that is the pre-define symbol you would need to add to pass in those sections of code. You could also change the IMULT multiplier so that it is using 40 instead of 20 as I described in the previous response - but it is generally best practice to use the pre-define symbol so that any #ifdef statements that are board-dependent are accounted for. And when you do get the TMS320F28375S, you can switch back to account for the board change.

    Let me know if you have further questions or issues!

    Best Regards,

    Allison