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.

CCS/TMS320F28377D: Timer Interrupt in CPU2

Part Number: TMS320F28377D
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

Hello,

i have problems with implement a timer in cpu2. My code runs successfuly in cpu1. Here is the minimal implementation with the standard ti driver functions from C2000Ware:

InitSysCtrl();

InitPieCtrl();

IER = 0x0000;

IFR = 0x0000;

InitPieVectTable();

InitUsrTimer();

with:

void InitUsrTimer()
{
/* Initialiuze Timer 1 - clk in MHz, periode in uSec */
ConfigCpuTimer(&CpuTimer1, 200, USRTIMERPERIOD);

/* CPU timer 1 */
EALLOW;
PieVectTable.TIMER1_INT = &Timer1_interrupt;
EDIS;

StartCpuTimer1();

IER |= M_INT13;
PieCtrlRegs.PIEIER1.bit.INTx13 = 1;
ERTM;
}

When i run the code parallel in cpu1 and cpu2, i see that the timer-counter in cpu1 is running, but in cpu2 it is not.

I have used the both macros for CPU1 and CPU2 in my project settings.

Can anyone help me? Thanks a lot!

  • Hi Sascha,

    Could you please try the following and see if this works for you? I tried it and I can see the timer-counter running for both CPUs:

    1) Open the following project spec file using a text editor

    C:\ti\c2000\C2000Ware_Version\driverlib\f2837xd\examples\cpu1\timer\CCS\timer_ex1_cputimers.projectspec

    2) Replace CPU1 with CPU2 or replace the code in the file with what is shown below and save the file

    <projectSpec>
      <project
            name="timer_ex1_cputimers"
            device="TMS320F28377D"
            cgtVersion="20.2.1.LTS"
            outputFormat="ELF"
            launchWizard="False"
            linkerCommandFile=""
            enableSysConfigTool="true"
            sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD"
            >
        <configuration name="CPU2_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT}  -v28 -ml -mt --define=DEBUG  --define=CPU2 --float_support=fpu32   --diag_warning=225  --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
        <configuration name="CPU2_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT}  -v28 -ml -mt --define=DEBUG --define=_FLASH --define=CPU2 --float_support=fpu32   --diag_warning=225  --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 " />
        <pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
        <pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
        <file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
        <file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
        <file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
        <file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
        <file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu2.cmd" targetDirectory="" applicableConfigurations="CPU2_RAM" />
        <file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu2.cmd" targetDirectory="" applicableConfigurations="CPU2_FLASH" />
        <file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
        <file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
        <file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True"/>
        <file action="copy" path="../timer_ex1_cputimers.c" targetDirectory="" />
      </project>
    </projectSpec>
    

    3) Import the project into CCS 

    4) When you debug the project it will prompt you to choose a core, choose both CPU1 and CPU2

    5) Run the example, you should see the 'cpuTimer0IntCount' value increment for both CPUs

    Let me know if this works please!

    Best Regards,

    Marlyn

  • Hi Marlyn,

    thank you for the answer and the simple step by step instruction. I am with you and i see, that "cpuTimer0IntCount" runs for both CPUs.

    But i have the problem that i do not want to use the driverlib-functions. Can you give me a step by step instruction to solve my problem with the functions from the follwing folders:

    C:\ti\c2000\C2000Ware_3_02_00_00\device_support\f2837xd

    Thank you and greetings,

    Sascha

  • Hi Sascha,

    Yes, if you do not want to use the driverlib functions then below are the steps for another method:

    1) Look at the dual examples for the F2837xD (C:\ti\c2000\C2000Ware_Version\device_support\f2837xd\examples\dual ). You will notice that they contain separate folders for CPU1 and CPU2, serving as two separate projects. The main difference is linking to the 2837xD_RAM_lnk_cpu1.cmd versus the 2837xD_RAM_lnk_cpu2.cmd file. Your project should take on a similar approach. You can modify one of the existing examples to start with, for example the blinky_dc example. 

    2) For demonstration purposes, lets assume you will be using blinky_dc. Import the projects for cpu1 and cpu2 within CCS. You can modify the .c file in each project with your own code for the timers. Note that you may need to include the 'F2837xD_CpuTimers.c' file since it is not naturally part of the blinky_dc project.

    3) When you have finished porting over your code, build the projects and make sure there are no build errors.

    4) Instead of clicking the 'debug' button go to your target configurations by going to View -> Target Configurations within CCS

    • If you don't already have one for F2837xD then create a target configuration by right clicking under the 'User Defined' folder of the 'Target Configurations' window and selecting 'New Target Configuration'
    • Once you have a designated F2837xD target configuration that successfully connects to the device, right-click on the .ccxml file and select 'Launch Selected Configuration'
    • In the debug view you should see the C28xx_CPU1, CPU1_CLA, C28xx_CPU2, and CPU2_CLA. Right-click on C28xx_CPU1 and select 'Connect Target'. Do the same for C28xx_CPU2.
    • Next step is to load the project files. Click on CPU1, the find the load option. Below is a picture for help. Select the arrow next to the load icon and choose 'Load Program'. Select the .out file for the CPU1 project. This should be located within your workspace: workspaceX\blinky_dc_cpu01\CPU1_RAM_DEBUG. Do the same for CPU2.

    5) Once the projects have been loaded to both cores you should be able to run the projects and see the timer increment in the expressions window.

    Let me know if this helps or if you need further clarification on a particular step.

    Best Regards,

    Marlyn

  • Hi Marlyn,

    thank you for your answer, but build the both projects und debugging on both CPUs is not my problem.

    Let me describe my momentance situation. I have two projects (one for each CPU) and i can both build without any errors. For CPU1 i use the 2837x_FLASH_Ink_cpu1.cmd and for CPU2 i use 2837x_FLASH_Ink_cpu2.cmd. Both projects run (i toggle a different LED for each CPU in the while-loops). Now i use the same timer-initialization in both CPUs (see my first post), but only in CPU1 i see that the timer runs. In CPU2 the timer-counter stands always on 0 and so i get no interrupts.

    The blicky_dc example for dual core does not use any timer, so that example does not help me. And there are no timers in the other dual core examples, too.

    Thank you for the support.

    Best Regards,

    Sascha  

  • Hi Sascha,

    Thank you for explaining further. The blinky_dc project was just meant as an example for a dual cpu program. Did you try to use your code instead of the code in the .c file for the blinky_dc project? (Please refer to step 2 from my previous reply).

    If I take the code in the .c file from the 'timed_led_blink_cpu01' project (utilizes a timer) and copy and paste it into the .c file for the blinky_dc project I can see the timer increment for both CPUs.

    Best Regards,

    Marlyn

  • Hi Marlyn,

    when i copy the code from "timed_led_blink_cpu01" to "blinky_dc" to both main.c, i see that both timers run, too. Thank you for this solution.

    I will now try to copy this code to my projects and hope, that this will solve my problems, too. If not, i would ask you again for support.

    Thanks and best regards,

    Sascha

  • Sascha,

    Glad you were able to see the timer working on both CPUs. Hopefully this gives you some insight into your specific project. Let me know if you have further questions until then.

    Best Regards,

    Marlyn