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/TMS320F28388D: IPC communication from CM to CPU1

Part Number: TMS320F28388D
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

Hi,
as mentioned by PAk in his thread "CM Ethernet issue (lwip)" the IPC communication does not work in the opposite way from CM to CPU1. Some lousy part in the initialization is missing, I'm sure you'll find it at first glance.
Short: I've decorated your example  "C:\ti\c2000\C2000Ware_3_02_00_00\driverlib\f2838x\examples\c28x_cm\ipc"
with both LEDs from ControlCard and stuffed them into IPC_ISR1 and IPC_ISR0. But only the event from CPU1 into CM is fired (as described in the original example); the opposite way remains untouched.
Regards

200923b_Test_IPC0_OK_but_CM2CPU_missing_min.zip

  • Hi,

    In the C28x_CM IPC example we haven't enabled the Interrupt module on the C28x core since it was not used. Can you add those init routines (you can pick from any other C28x example). Also, recommend you to use Device_initGPIO function before configuring the GPIOs. I will raise a ticket to have this included by default even though it is not sued in the example.

    Quick summary of functions to be invoked:

    Device_initGPIO()
    Interrupt_initModule()
    Interrupt_initVectorTable()
    EINT;
    ERTM;
    The last 2 are  macros which internally invokes assembly instructions to enable interrupt in the C28x core.
    Regards,
    Veena
  • Hi Veena,
    thank you very much for your quick response. You're absolutely right, the interrupt configuration was missing. Now the IPC path from CM to CPU1 is working.
    Regards

    //#############################################################################
    //
    // FILE:   ipc_ex1_basic_c28x1.c
    //
    // TITLE:  IPC example with interrupt
    //
    //! \addtogroup driver_cm_c28x_dual_example_list
    //! <h1> IPC basic message passing example with interrupt </h1>
    //!
    //! This example demonstrates how to configure IPC and pass information from
    //! C28x to CM core without message queues.
    //! It is recommended to run the C28x1 core first, followed by the CM core.
    //!
    //! \b External \b Connections \n
    //!  - None.
    //!
    //! \b Watch \b Variables \n
    //!  - pass
    //!
    //
    //#############################################################################
    // $TI Release: F2838x Support Library v3.02.00.00 $
    // $Release Date: Tue May 26 17:21:56 IST 2020 $
    // $Copyright:
    // Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
    //
    // Redistribution and use in source and binary forms, with or without 
    // modification, are permitted provided that the following conditions 
    // are met:
    // 
    //   Redistributions of source code must retain the above copyright 
    //   notice, this list of conditions and the following disclaimer.
    // 
    //   Redistributions in binary form must reproduce the above copyright
    //   notice, this list of conditions and the following disclaimer in the 
    //   documentation and/or other materials provided with the   
    //   distribution.
    // 
    //   Neither the name of Texas Instruments Incorporated nor the names of
    //   its contributors may be used to endorse or promote products derived
    //   from this software without specific prior written permission.
    // 
    // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
    // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
    // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
    // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
    // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
    // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
    // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
    // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    // $
    //###########################################################################
    
    #include "driverlib.h"
    #include "device.h"
    
    #define IPC_CMD_READ_MEM   0x1001
    #define IPC_CMD_RESP       0x2001
    
    #pragma DATA_SECTION(readData, "MSGRAM_CPU_TO_CM")
    uint32_t readData[10];
    
    //###########################################################################
    __interrupt void IPC_ISR1() {
        uint32_t command, addr, data;
        IPC_readCommand(IPC_CPU1_L_CM_R, IPC_FLAG1, IPC_ADDR_CORRECTION_ENABLE,
                        &command, &addr, &data);
        IPC_ackFlagRtoL(IPC_CPU1_L_CM_R, IPC_FLAG1);
        GPIO_togglePin(DEVICE_GPIO_PIN_LED1);
        Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP11);
    }
    
    //###########################################################################
    void main(void) {
        int i;
    
        Device_init();
    
    #ifdef _FLASH
        Device_bootCM(BOOTMODE_BOOT_TO_FLASH_SECTOR0);
    #else
        Device_bootCM(BOOTMODE_BOOT_TO_S0RAM);
    #endif
    
        Device_initGPIO();
    
        GPIO_setPadConfig(DEVICE_GPIO_PIN_LED1, GPIO_PIN_TYPE_STD);
        GPIO_setDirectionMode(DEVICE_GPIO_PIN_LED1, GPIO_DIR_MODE_OUT);
        GPIO_setPadConfig(DEVICE_GPIO_PIN_LED2, GPIO_PIN_TYPE_STD);
        GPIO_setDirectionMode(DEVICE_GPIO_PIN_LED2, GPIO_DIR_MODE_OUT);
        GPIO_setMasterCore(DEVICE_GPIO_PIN_LED2, GPIO_CORE_CM);
    
        Interrupt_initModule();
        Interrupt_initVectorTable();
        IPC_registerInterrupt(IPC_CPU1_L_CM_R, IPC_INT1, IPC_ISR1);
    
        IPC_clearFlagLtoR(IPC_CPU1_L_CM_R, IPC_FLAG_ALL);
        IPC_sync(IPC_CPU1_L_CM_R, IPC_FLAG31);
    
        for(i=0; i<10; i++) readData[i] = i;
    
        EINT; ERTM;
    
        for(;;) {
    
            DEVICE_DELAY_US(1000000);
    
            IPC_sendCommand(IPC_CPU1_L_CM_R, IPC_FLAG0, IPC_ADDR_CORRECTION_ENABLE,
                            IPC_CMD_READ_MEM, (uint32_t)readData, 10);
    
            IPC_waitForAck(IPC_CPU1_L_CM_R, IPC_FLAG0);
    
        }
    }
    
    
    //
    // End of File
    //
    
    //#############################################################################
    //
    // FILE:   ipc_ex1_basic_cm.c
    //
    // TITLE:  IPC example with interrupt
    //
    //! \addtogroup driver_cm_c28x_dual_example_list
    //! <h1> IPC basic message passing example with interrupt </h1>
    //!
    //! This example demonstrates how to configure IPC and pass information from
    //! C28x to CM core without message queues
    //! It is recommended to run the C28x1 core first, followed by the CM core.
    //!
    //! \b External \b Connections \n
    //!  - None.
    //!
    //! \b Watch \b Variables \n
    //!  - None.
    //!
    //
    //#############################################################################
    // $TI Release: F2838x Support Library v3.02.00.00 $
    // $Release Date: Tue May 26 17:21:56 IST 2020 $
    // $Copyright:
    // Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
    //
    // Redistribution and use in source and binary forms, with or without 
    // modification, are permitted provided that the following conditions 
    // are met:
    // 
    //   Redistributions of source code must retain the above copyright 
    //   notice, this list of conditions and the following disclaimer.
    // 
    //   Redistributions in binary form must reproduce the above copyright
    //   notice, this list of conditions and the following disclaimer in the 
    //   documentation and/or other materials provided with the   
    //   distribution.
    // 
    //   Neither the name of Texas Instruments Incorporated nor the names of
    //   its contributors may be used to endorse or promote products derived
    //   from this software without specific prior written permission.
    // 
    // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
    // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
    // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
    // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
    // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
    // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
    // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
    // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    // $
    //###########################################################################
    
    #include "cm.h"
    #include "ipc.h"
    
    #define IPC_CMD_READ_MEM   0x1001
    #define IPC_CMD_RESP       0x2001
    
    #define TEST_PASS          0x5555
    #define TEST_FAIL          0xAAAA
    
    #pragma DATA_SECTION(readData, "MSGRAM_CM_TO_CPU1")
    uint32_t readData[10];
    
    
    //###########################################################################
    __interrupt void IPC_ISR0() {
        uint32_t command, addr, data;
    
        IPC_readCommand(IPC_CM_L_CPU1_R, IPC_FLAG0, IPC_ADDR_CORRECTION_ENABLE,
                        &command, &addr, &data);
    
        IPC_ackFlagRtoL(IPC_CM_L_CPU1_R, IPC_FLAG0);
    
        GPIO_togglePin(DEVICE_GPIO_PIN_LED2);
    }
    
    //###########################################################################
    void main(void)
    {
        int i;
        CM_init();
    
        IPC_clearFlagLtoR(IPC_CM_L_CPU1_R, IPC_FLAG_ALL);
    
        IPC_registerInterrupt(IPC_CM_L_CPU1_R, IPC_INT0, IPC_ISR0);
    
        IPC_sync(IPC_CM_L_CPU1_R, IPC_FLAG31);
    
        for(i=0; i<10; i++) readData[i] = 10-i;
    
        for(;;) {
    
            DEVICE_DELAY_US(1000000);
    
            IPC_sendCommand(IPC_CM_L_CPU1_R, IPC_FLAG1, IPC_ADDR_CORRECTION_ENABLE,
                            IPC_CMD_READ_MEM, (uint32_t)readData, 10);
    
            IPC_waitForAck(IPC_CM_L_CPU1_R, IPC_FLAG1);
    
    
        }
    }
    
    

  • Thank you  !!

    That was really help ful.

    I will try and get back to share.