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.

TMS320F28377D: 想请教一个问题,为什么我的双核程序下载到FLASH里面,仿真的时候两个CPU挨个运行就可以运行程序,但是重新上电之后就运行不了。不知道是不是CPU2没有启动起来,这个咋办呢

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

如题,我的程序就是当CPU2被CPU1从FLASH中启动时,CPU1把IPC_FLAG循环置一,CPU2的中断处理函数就是LED灯闪烁。当运行完CPU1程序之后,点击运行CPU2程序的时候可以看见实验现象。但是重新上电之后就没有这个实验现象了,是因为我的CPU2没有启动起来吗?

  • 您好,      

    请参考双核LED示例led_ex1_blinky ,允许CPU01主系统启动CPU02控制系统:

    device_bootCPU2 (C1C2_brom_bootmode_boot_from_flash);

    c2000ware多核开发指南7. Examples from C2000ware — C2000Tm Multicore Development Guide

  • 我用device_bootCPU2 (C1C2_brom_bootmode_boot_from_flash);启动不了CPU2,用IPC_setBootMode(IPC_CPU1_L_CPU2_R, C1C2_BROM_BOOTMODE_BOOT_FROM_FLASH);可以启动,但是就是会出现我标题里面的问题。我的CPU1代码如下:

    ////#############################################################################
    ////
    //// FILE:   empty_sysconfig_cpu1.c
    ////
    //// TITLE: SysConfig Empty Project
    ////
    //// CPU1 Empty Project Example
    ////
    //// This example is an empty project setup for SysConfig development for CPU1.
    ////
    ////#############################################################################
    ////
    ////
    //// $Copyright:
    //// Copyright (C) 2013-2024 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.
    //// $
    ////#############################################################################
    //
    ////
    //// Included Files
    ////
    //#include "driverlib.h"
    //#include "device.h"
    //
    ////
    //// Main
    ////
    //void main(void)
    //{
    //
    //}
    //
    ////
    //// End of File
    ////
    
    #include "device.h"
    //#include "F28x_Project.h"
    #include "board.h"
    #include <driverlib.h>
    /**
     * main.c
     */
    void main(void)
    {
        Device_init(); // Initialize device clock and peripherals
        Device_initGPIO(); // Initialize GPIO and configure the GPIO pin as a push-pull output
        Interrupt_initModule(); // Initialize PIE and clear PIE registers. Disables CPU interrupts.
        IER = 0x0000; //CPU级中断使能
        IFR = 0x0000; //清除CPU级中断标志
        Interrupt_initVectorTable(); // Initialize the PIE vector table with pointers to ISR
    
        //IPC初始化
        // Initialize SysConfig Settings
        //
        Board_init();
    //    GpioDataRegs.GPDSET.bit.GPIO99=1;
    //    Device_bootCPU2(BOOT_MODE_CPU2);//启动CPU2,不行,用这个函数会
    //    GpioDataRegs.GPDSET.bit.GPIO99=1;
        // Clear any IPC flags if set already
        //
    //#ifdef _STANDALONE
    #ifdef _FLASH
    // Send boot command to allow the CPU02 application to begin execution
    //IPCBootCPU2(C1C2_BROM_BOOTMODE_BOOT_FROM_FLASH);//这是bit-field库
        IPC_setBootMode(IPC_CPU1_L_CPU2_R, C1C2_BROM_BOOTMODE_BOOT_FROM_FLASH);
    #else
    // Send boot command to allow the CPU02 application to begin execution
    //IPCBootCPU2(C1C2_BROM_BOOTMODE_BOOT_FROM_RAM);
        IPC_setBootMode(IPC_CPU1_L_CPU2_R, C1C2_BROM_BOOTMODE_BOOT_FROM_RAM);
    #endif
    //#endif
        IPC_clearFlagLtoR(IPC_CPU1_L_CPU2_R, IPC_FLAG_ALL);
    
        //
        // Synchronize both the cores.
        //
        IPC_sync(IPC_CPU1_L_CPU2_R, CPU1_to_CPU2_IPC_FLAG31);//阻塞直到CPU2也运行到这个函数?
    
    //    IpcRegs.IPCSET.bit.IPC0=1;
    
        EINT; // Enable Global Interrupt (INTM)
        ERTM; // Enable real-time interrupt (DBGM)
    
    //    IPC_sendCommand(IPC_CPU1_L_CPU2_R, IPC_FLAG0, IPC_ADDR_CORRECTION_DISABLE,
    //                                    0, 0, 0);
        for (;;)
        {
            IPC_sendCommand(IPC_CPU1_L_CPU2_R, IPC_FLAG0, IPC_ADDR_CORRECTION_DISABLE,
                                            0, 0, 0);
            DEVICE_DELAY_US(1000000);//driverlib的延时函数
            GPIO_writePin(myGPIO133, 1);
            DEVICE_DELAY_US(1000000);//driverlib的延时函数
            GPIO_togglePin(133);
        }
    }
    

  • 点错了,问题还没有解决

  • 可是我这个工程文件就是从C2000Ware拷贝来的,我只是修改了里面的代码

  • 这里可以发工程给你吗,可以的话我发工程给你,你可以帮我看看吗?非常感谢

  • 您好,

           如前面回复,连接仿真器可以工作,但断电后无法工作,请检查工程配置为Flash active.

          

  • 这里的BOOTMODE_BOOT_TO_FLASH_SECTOR0是什么宏定义,我编译会报错

  • 你好,我现在跑的是C2000Ware的ipc_ex3_basic_sysconfig例程,然后调试的时候CPU1卡在 ,是我的调试环境不对吗

  • 您好,

            在 CPU1_FLASH_STANDALONE build 配置中,定义了两个符号:_STANDALONE 和 _FLASH。

            使用该代码,CPU2 从 Flash Sector0 启动

           是测试这个链接 ipc_ex3_basic_sysconfig 的工程吗,在CCS中 import工程,重新编译一下。

  • 现在是这么个情况:我的启动代码是这样,目前就是 IPCBootCPU2(C1C2_BROM_BOOTMODE_BOOT_FROM_FLASH); //这行会被执行 用这个启动的话,代码烧录进去,然后断掉调试器,没有反应,重启也没反应。IPC_setBootMode(IPC_CPU1_L_CPU2_R, C1C2_BROM_BOOTMODE_BOOT_FROM_FLASH);用这行代码的话,就是代码烧录进去,断掉调试器就有实验现象,但是重启就不行了,就没反应了。这是为什么呢?

  • 这个帖子没有参考价值,因为我调用的就是IPC_setBootMode,但是代码烧录进去,断掉调试器就有实验现象,但是重启就不行了,就没反应。调用Device_bootCPU2和IPCBootCPU2就是代码烧录进去也没实验现象,能否提出具体的可行措施,我已经卡在这里一个月了

  • 您好,

          请私信联系。