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: Implementing CAN communication on CPU2

Part Number: TMS320F28377D


Tool/software: Code Composer Studio

Hello,

I want to transfer the CAN communication from CPU1 to CPU2. I had found following two introductions in the forum and implemented to my project:

https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/787160

https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/539650?How-to-enable-cpu02-to-send-receive-over-CAN-bus-A-TMS320F28377D-

Code CPU1:

DevCfgRegs.CPUSEL8.bit.CAN_A = 1;       // Connected to CPU2

#if CANA_RX_GPIO == 30       // set pins

       sdiGpioPinMuxSetup(CANA_RX_GPIO, GPIO_MUX_CPU2, 1);       //CANRXA

#endif

sdiGpioPinOptionsSetup(CANA_RX_GPIO, GPIO_INPUT, GPIO_ASYNC);

#if (CANA_TX_GPIO == 31)

       sdiGpioPinMuxSetup(CANA_TX_GPIO, GPIO_MUX_CPU2, 1);        //CANTXA

#endif

sdiGpioPinOptionsSetup(CANA_TX_GPIO, GPIO_OUTPUT, GPIO_PUSHPULL);

CANInit(0x00048000);

Code CPU 2:

CpuSysRegs.PCLKCR10.bit.CAN_A = 1;        //  turning on the peripheral clock

CANClkSourceSelect(CANA_BASE, CANA_CLK_SOURCE);

CANBitRateSet(CANA_BASE, CANA_CLK_FREQ, CANA_BITRATE);

If only CPU1 is used, CAN is already initialize if the expression window is used and set: CpuSysRegs.PCLKCR10.bit.CAN_A = 1;

Same procedure, after DevCfgRegs.CPUSEL8.bit.CAN_A = 1; from CPU1 the CAN communication in CPU2 does not work! Are there additional settings, which are not mentioned in the forum?

Thanks in advance!

Matthias

  • Hi Matthias,

    Your flow should be:

    - Assign CAN pin mux configuration in CPU1

    - Disable peripheral clock from CPU1 (CpuSysRegs.PCLKCR10.bit.CAN_A = 0)

    - Switch ownership of CAN to CPU2 ( DevCfgRegs.CPUSEL8.bit.CAN_A = 1; ) from CPU1;

    - In CPU2, turn on CAN clock (CpuSysRegs.PCLKCR10.bit.CAN_A = 1) and set up CAN_CLK (CANClkSourceSelect(CANA_BASE, CANA_CLK_SOURCE) and configure bit timings ( CANBitRateSet(CANA_BASE, CANA_CLK_FREQ, CANA_BITRATE) ).

    Regards,

    Joseph

  • Hi Joseph,

    Thank you for your help!

    The problem was in the memory linker file. There the memory was not allocated and I ignored the warning of the Code Composer Studio.

    The CAN communication operates after I changed the linker file:

    MEMORY:

    // CAN communication (only CPU1)
    DEVCFGREGSMEM : origin = 0x0005D000, length = 0x000017F

    SECTIONS:

    // CAN communication (only CPU1)
    DevCfgRegsFile : > DEVCFGREGSMEM, PAGE = 1

    Regards,

    Matthias