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.
如题,我的CPU1代码为
#include "device.h"
#include "F28x_Project.h"
#include "board.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();
Device_bootCPU2(BOOT_MODE_CPU2);//启动CPU2
// Clear any IPC flags if set already
//
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);
// IpcRegs.IPCSET.bit.IPC0=1;
EINT; // Enable Global Interrupt (INTM)
ERTM; // Enable real-time interrupt (DBGM)
for (;;)
{
IpcRegs.IPCSET.bit.IPC0=1;
DELAY_US(100000);
}
}
CPU2的工程为
#include "device.h"
#include "F28x_Project.h"
#include "board.h"
/**
* main.c
*/
void main(void)
{
//
// Initialize device clock and peripherals
//
Device_init();
//
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
//
Interrupt_initModule();
//
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
//
Interrupt_initVectorTable();
//
// Initialize SysConfig Settings
//
Board_init();
//
// Clear any IPC flags if set already
//
IPC_clearFlagLtoR(IPC_CPU2_L_CPU1_R, IPC_FLAG_ALL);
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
//
// Synchronize both the cores.
//
IPC_sync(IPC_CPU2_L_CPU1_R, CPU2_to_CPU1_IPC_FLAG31);
//
// Loop forever. Wait for IPC interrupt
//
GpioDataRegs.GPDSET.bit.GPIO99=1;
GpioDataRegs.GPECLEAR.bit.GPIO133=1;
while(1);
}
__interrupt void IPC_0_ISR(void)
{
GpioDataRegs.GPDTOGGLE.bit.GPIO99=1;
GpioDataRegs.GPETOGGLE.bit.GPIO133=1;
// Acknowledge the flag
//
IPC_ackFlagRtoL(IPC_CPU2_L_CPU1_R, IPC_FLAG0);
//
// Acknowledge the PIE interrupt.
//
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
}
仿真结果如下
请问是哪里出问题了呢?
程序试图做什么?我认为添加一些外部开关(如闪烁LED)来指示程序的状态可能是有意义的。收到的消息不一定表示调试程序代码有问题。
如果还没有参考SDK中的双核示例来正确设置双核项目环境,建议也参考这些示例
这个问题已经解决了,是我的CPU2启动代码不对,是否能解答我另外一个问题呢?TMS320F28377D: 想请教一个问题,为什么我的双核程序下载到FLASH里面,仿真的时候两个CPU挨个运行就可以运行程序,但是重新上电之后就运行不了。不知道是不是CPU2没有启动起来,这个咋办呢 - C2000︎ 微控制器论坛 - C2000 微控制器 - E2E
设计支持