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/TMS320F28379D: CPU2 can not run well!

Part Number: TMS320F28379D
Other Parts Discussed in Thread: CONTROLSUITE

Tool/software: Code Composer Studio

Hi,everyone.

Now I have 28379d board designed by myself.  Software was programmed by myself .Now I have a problem about CPU2 can not work well.

Specifically CPU2 main function will run repeatly , I don not kown why. CPU1 runs well.

I am sure hardware is good because i have test software examples from controlsuite . It is ok .

I compare the example project with my project ,especially for cpu2 Project Properties->Debug, there is the same .

So I need help to sovle above problem.

  • Hello

    If CPU2 is running the main function repeatedly, then it sounds like CPU2 is resetting.
    If controlSUITE examples are working, compare your project settings, predefined symbols, etc to make sure you configured everything necessary. Is watchdog disabled?

    Any other information regarding the behavior you're seeing on CPU2 would be helpful.

    Best regards
    Chris
  • Chris,thanks for your reply.
    You are correct, I also think cpu2 is reset,because a variable called flag_cnt is put at the beginning of main function .And excute flag_cnt++.
    As a result , flag_cnt is constantly equal to 0. so check it and cpu2 is reseting.
    Now in my project watchdog is unused .Only in 

    void InitSysCtrl(void)
    {
    //
    // Disable the watchdog
    //
    DisableDog();

    there is DisableDog which is the only place to call watchdog function.

    And my project was ok before.
    My project have many .c and .h files on cpu2, which include statemachine \ some interrupts\and Peripherals settup.

    I wonder My problem is related with .cmd and memory location .
    I have checked project setting ,it is the same with controlsuite example.

    Now the problom is fix on the new .c file called Func_CANAPP.c I created . When I add Func_CANAPP.c  into the project , Cpu2 begin to reset.So I copy the code here ,hope to help solve this problem.

     

    #include "Main_Define_CPU2.h"
    #include "Motor_Include_CPU2.h"
    #include "Func_Include_CPU2.h"

    #define TX_MSG_OBJ_ID_01 02
    #define TX_MSG_OBJ_ID_10 10
    #define TX_MSG_OBJ_ID_11 11
    #define TX_MSG_OBJ_ID_15 15 //backup
    #define TX_MSG_OBJ_ID_20 20
    #define TX_MSG_OBJ_ID_21 21
    #define TX_MSG_OBJ_ID_22 22
    #define TX_MSG_OBJ_ID_23 23
    #define TX_MSG_OBJ_ID_24 24

    #define RX_MSG_OBJ_ID_30 20
    #define RX_MSG_OBJ_ID_31 21
    #define RX_MSG_OBJ_ID_32 22

    #define RX_MSG_OBJ_ID_40 32 //backup

    #define CAN_MSG_DATA_LENGTH 8

    tCANMsgObject sTXCANMessage_01;
    tCANMsgObject sTXCANMessage_10;
    tCANMsgObject sTXCANMessage_11;
    tCANMsgObject sTXCANMessage_15;
    tCANMsgObject sTXCANMessage_20;
    tCANMsgObject sTXCANMessage_21;
    tCANMsgObject sTXCANMessage_22;
    tCANMsgObject sTXCANMessage_23;
    tCANMsgObject sTXCANMessage_24;

    tCANMsgObject sRXCANMessage_30;
    tCANMsgObject sRXCANMessage_31;
    tCANMsgObject sRXCANMessage_32;
    tCANMsgObject sRXCANMessage_40;

    unsigned char txMsgData01[8];
    unsigned char txMsgData10[8];
    unsigned char txMsgData11[8];
    unsigned char txMsgData15[8];
    unsigned char txMsgData20[8];
    unsigned char txMsgData21[8];
    unsigned char txMsgData22[8];
    unsigned char txMsgData23[8];
    unsigned char txMsgData24[8];

    unsigned char rxMsgData30[8];
    unsigned char rxMsgData31[8];
    unsigned char rxMsgData32[8];

    unsigned char rxMsgData40[8];


    //#define RX_MSG_OBJ_ID_4 0x18000023
    //#define RX_MSG_OBJ_ID_5 0x18000023

    void Update_CANdata(void);

    void CAN_TransmitData(void)
    {
    Update_CANdata();
    CANMessageSet(CANA_BASE, TX_MSG_OBJ_ID_01, &sTXCANMessage_01,MSG_OBJ_TYPE_TX);
    CANMessageSet(CANA_BASE, TX_MSG_OBJ_ID_10, &sTXCANMessage_10,MSG_OBJ_TYPE_TX);
    CANMessageSet(CANA_BASE, TX_MSG_OBJ_ID_11, &sTXCANMessage_11,MSG_OBJ_TYPE_TX);
    CANMessageSet(CANA_BASE, TX_MSG_OBJ_ID_15, &sTXCANMessage_15,MSG_OBJ_TYPE_TX);
    CANMessageSet(CANA_BASE, TX_MSG_OBJ_ID_20, &sTXCANMessage_20,MSG_OBJ_TYPE_TX);
    CANMessageSet(CANA_BASE, TX_MSG_OBJ_ID_21, &sTXCANMessage_21,MSG_OBJ_TYPE_TX);
    CANMessageSet(CANA_BASE, TX_MSG_OBJ_ID_22, &sTXCANMessage_22,MSG_OBJ_TYPE_TX);
    CANMessageSet(CANA_BASE, TX_MSG_OBJ_ID_23, &sTXCANMessage_23,MSG_OBJ_TYPE_TX);
    }


    void CAN_ReceiveData(void)
    {
    //
    // Get the received message
    //
    Uint16 i,status;
    status = CANStatusGet(CANA_BASE, CAN_STS_CONTROL);
    if(RX_MSG_OBJ_ID_40 == status)
    {
    CANMessageGet(CANA_BASE, RX_MSG_OBJ_ID_40, &sRXCANMessage_40, true);
    for(i = 0;i < CAN_MSG_DATA_LENGTH;i++)
    txMsgData24[i] = rxMsgData40[i];

    CANMessageSet(CANA_BASE, TX_MSG_OBJ_ID_24, &sTXCANMessage_24,MSG_OBJ_TYPE_TX);
    }
    }

    void Update_CANdata(void)
    {
    ;
    }

    void Init_CANdata(void)
    {
    // 18000_001
    sTXCANMessage_01.ui32MsgID = 18000001;
    sTXCANMessage_01.ui32MsgIDMask = 0;
    sTXCANMessage_01.ui32Flags = 0;
    sTXCANMessage_01.ui32MsgLen = CAN_MSG_DATA_LENGTH;
    sTXCANMessage_01.pucMsgData = txMsgData01;
    txMsgData01[0] = 0xFF;
    txMsgData01[1] = 0xFE;
    txMsgData01[2] = 0xF6;
    txMsgData01[3] = 0xF8;
    // 18000_010
    sTXCANMessage_10.ui32MsgID = 18000010;
    sTXCANMessage_10.ui32MsgIDMask = 0;
    sTXCANMessage_10.ui32Flags = 0;
    sTXCANMessage_10.ui32MsgLen = CAN_MSG_DATA_LENGTH;
    sTXCANMessage_10.pucMsgData = txMsgData10;
    txMsgData10[0] = 0xFF;
    txMsgData10[1] = 0xFE;
    txMsgData10[2] = 0xF6;
    txMsgData10[3] = 0xF8;
    // 18000_011
    sTXCANMessage_11.ui32MsgID = 18000011;
    sTXCANMessage_11.ui32MsgIDMask = 0;
    sTXCANMessage_11.ui32Flags = 0;
    sTXCANMessage_11.ui32MsgLen = CAN_MSG_DATA_LENGTH;
    sTXCANMessage_11.pucMsgData = txMsgData11;
    txMsgData11[0] = 0xFF;
    txMsgData11[1] = 0xFE;
    txMsgData11[2] = 0xF6;
    txMsgData11[3] = 0xF8;
    // 18000_015
    sTXCANMessage_15.ui32MsgID = 18000015;
    sTXCANMessage_15.ui32MsgIDMask = 0;
    sTXCANMessage_15.ui32Flags = 0;
    sTXCANMessage_15.ui32MsgLen = CAN_MSG_DATA_LENGTH;
    sTXCANMessage_15.pucMsgData = txMsgData15;
    txMsgData15[0] = 0xFF;
    txMsgData15[1] = 0xFE;
    txMsgData15[2] = 0xF6;
    txMsgData15[3] = 0xF8;
    // 18000_020
    sTXCANMessage_20.ui32MsgID = 18000020;
    sTXCANMessage_20.ui32MsgIDMask = 0;
    sTXCANMessage_20.ui32Flags = 0;
    sTXCANMessage_20.ui32MsgLen = CAN_MSG_DATA_LENGTH;
    sTXCANMessage_20.pucMsgData = txMsgData20;
    txMsgData20[0] = 0xFF;
    txMsgData20[1] = 0xFE;
    txMsgData20[2] = 0xF6;
    txMsgData20[3] = 0xF8;
    txMsgData20[6] = 0x11;
    txMsgData20[7] = 0x22;
    // 18000_021
    sTXCANMessage_21.ui32MsgID = 18000021;
    sTXCANMessage_21.ui32MsgIDMask = 0;
    sTXCANMessage_21.ui32Flags = 0;
    sTXCANMessage_21.ui32MsgLen = CAN_MSG_DATA_LENGTH;
    sTXCANMessage_21.pucMsgData = txMsgData21;
    txMsgData21[0] = 0xFF;
    txMsgData21[1] = 0xFE;
    txMsgData21[2] = 0xF6;
    txMsgData21[3] = 0xF8;
    txMsgData21[6] = 0xF6;
    txMsgData21[7] = 0xF8;
    // 18000_022
    sTXCANMessage_22.ui32MsgID = 18000022;
    sTXCANMessage_22.ui32MsgIDMask = 0;
    sTXCANMessage_22.ui32Flags = 0;
    sTXCANMessage_22.ui32MsgLen = CAN_MSG_DATA_LENGTH;
    sTXCANMessage_22.pucMsgData = txMsgData22;
    txMsgData22[0] = 0xFF;
    txMsgData22[1] = 0xFE;
    txMsgData22[2] = 0xF6;
    txMsgData22[3] = 0xF8;
    // 18000_023
    sTXCANMessage_23.ui32MsgID = 18000023;
    sTXCANMessage_23.ui32MsgIDMask = 0;
    sTXCANMessage_23.ui32Flags = 0;
    sTXCANMessage_23.ui32MsgLen = CAN_MSG_DATA_LENGTH;
    sTXCANMessage_23.pucMsgData = txMsgData23;
    txMsgData23[0] = 0xFF;
    txMsgData23[1] = 0xFE;
    txMsgData23[2] = 0xF6;
    txMsgData23[3] = 0xF8;

    sTXCANMessage_24.ui32MsgID = 18000024;
    sTXCANMessage_24.ui32MsgIDMask = 0;
    sTXCANMessage_24.ui32Flags = 0;
    sTXCANMessage_24.ui32MsgLen = CAN_MSG_DATA_LENGTH;
    sTXCANMessage_24.pucMsgData = txMsgData24;
    txMsgData24[0] = 0xFF;
    txMsgData24[1] = 0xFE;
    txMsgData24[2] = 0xF6;
    txMsgData24[3] = 0xF8;

    //Receive :18000040
    sRXCANMessage_40.ui32MsgID = 18000040;
    sRXCANMessage_40.ui32MsgIDMask = 0;
    sRXCANMessage_40.ui32Flags = MSG_OBJ_RX_INT_ENABLE;
    sRXCANMessage_40.ui32MsgLen = CAN_MSG_DATA_LENGTH;
    sRXCANMessage_40.pucMsgData = rxMsgData40;
    //CANMessageSet(CANA_BASE, RX_MSG_OBJ_ID_40, &sRXCANMessage_40,MSG_OBJ_TYPE_RX);

    }

    I have solve the proble,the reason is that memory is not enough to allocate .text.But why CCS give me a hint?

    In the .cmd file ,RAMGS0-15 are both accessed by cpu1 and cpu2,but .text can not automatically allocate into the RAMGS0-15. Of courese I have setup the MemCfgRegs.GSxMSEL so that RAMGS belong to CPU2. So I think if program can run in RAMGS memory ,there is only one way to excute below in .cmd file

    isrfunc : LOAD = RAMD0 | RAMLS0 | RAMLS1 | RAMLS2 | RAMLS3 | RAMLS4,
    RUN = RAMGS14,
    LOAD_START(_isrfuncLoadStart),
    LOAD_END(_isrfuncLoadEnd),
    RUN_START(_isrfuncRunStart),
    LOAD_SIZE(_isrfuncLoadSize),
    PAGE = 0

    Another question is that if RAMGS0-15 cannot be as .text aera, LS0-5, d0,d1,m0,m1 are not enough to load my program ,how to do it . 

  • Hello

    Good to hear you identified the source of the issue.
    You're correct, you can set it to copy and run from GSRAM.
    If you have enough memory but it is saying it can't fix into memory then you can either split the memory sections or combine into a single section.
    See for splitting: processors.wiki.ti.com/.../Linker_Command_File_Primer
    See here for combining: e2e.ti.com/.../556903

    Best regards
    Chris
  • chris, It is clear for a way of sliping or combining .
    Why GSRAM can not be automatically allocated, and only be set manually by programming? If it can be,how to set or do what?
    If gsram can be used fully,memory space is enough.
  • Hello

    GSRAM can only be allocated through programming. On reset, its default ownership is CPU1.

    Best regards
    Chris