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.
尊敬的团队:
我的客户想要将 例程(IPC_ex2_msgqueue_c28x1.c)的通信方法更改为中断方法。 他作了以下修改:
1、 添加了中断接收功能
//
//标志1的 IPC ISR
// C28x 内核使用标志0发送带有消息队列的数据
//
_interrupt void IPC_ISR1 ()
{
int i;
//IPC_Message_t TxMsg、RxMsg;
bool status = false;
//
//从消息队列中读取消息
//
IPC_readMessageFromQueue (IPC_CPU1_L_CM_R、&messageQueue、IPC_ADDR_CORRECT_ENABLE、
&RxMsg、IPC_NONBLOCK_CALL);
if (RxMsg.command =IPC_CMD_READ_MEM)
{
状态= true;
//
//读取和比较数据
//
for (i=0;i<RxMsg.dataaw1;i++)
{
if ((*(uint32_t *) RxMsg.address + i)!= i)
状态= false;
}
}
//
//确认标志
//
IPC_ackFlagRtoL (IPC_CPU1_L_CM_R、IPC_FLAG1);
//
//确认 PIE 中断。
//
INTERRUPT_clearACKGROUP (INTERRUPT_ACK_Group1);
}
2、 启用 IPC 中断
//
IPC_registerInterrupt (IPC_CPU1_L_CM_R、IPC_INT1、IPC_ISR1);
//
初始化消息队列
//
IPC_initMessageQueue (IPC_CPU1_L_CM_R、&messageQueue、IPC_INT1、IPC_INT1);
3、添加了用于测试的发送环路
while (1)
{
DEVICE_DELAY_US (100000);
IPC_sendMessageToQueue (IPC_CPU1_L_CM_R、&messageQueue、IPC_ADDR_CORRECT_ENABLE、
&TxMsg、IPC_NONBLOCK_CALL);
DEVICE_DELAY_US (100000);
}
测试结果是 CPU1和 CM 之间的 IPC 通信不能中断。 问题是什么? 下面是完整的代码:
// // Included Files // #include "driverlib.h" #include "device.h" // // Defines // #define IPC_CMD_READ_MEM 0x1001 #define IPC_CMD_RESP 0x2001 #define TEST_PASS 0x5555 #define TEST_FAIL 0xAAAA #pragma DATA_SECTION(readData, "MSGRAM_CPU_TO_CM") uint32_t readData[10]; uint32_t pass; IPC_MessageQueue_t messageQueue; IPC_Message_t TxMsg, RxMsg; // // IPC ISR for Flag 1 // C28x core sends data with message queue using Flag 0 // __interrupt void IPC_ISR1() //增加了中断接收函数 { int i; //IPC_Message_t TxMsg, RxMsg; bool status = false; // // Read the message from the message queue // IPC_readMessageFromQueue(IPC_CPU1_L_CM_R, &messageQueue, IPC_ADDR_CORRECTION_ENABLE, &RxMsg, IPC_NONBLOCKING_CALL); if(RxMsg.command == IPC_CMD_READ_MEM) { status = true; // // Read and compare data // for(i=0; i<RxMsg.dataw1; i++) { if((*(uint32_t *)RxMsg.address + i) != i) status = false; } } // // Acknowledge the flag // IPC_ackFlagRtoL(IPC_CPU1_L_CM_R, IPC_FLAG1); // // Acknowledge the PIE interrupt. // Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1); } // // Main // void main(void) { int i; // // Initialize device clock and peripherals // Device_init(); // Boot CM core // #ifdef _FLASH Device_bootCM(BOOTMODE_BOOT_TO_FLASH_SECTOR0); #else Device_bootCM(BOOTMODE_BOOT_TO_S0RAM); #endif // Clear any IPC flags if set already // IPC_clearFlagLtoR(IPC_CPU1_L_CM_R, IPC_FLAG_ALL); // // Enable IPC interrupts // IPC_registerInterrupt(IPC_CPU1_L_CM_R, IPC_INT1, IPC_ISR1); //注册了中断 // // Initialize message queue // IPC_initMessageQueue(IPC_CPU1_L_CM_R, &messageQueue, IPC_INT1, IPC_INT1); //初始化中断 // // Synchronize both the cores // // // Enable Global Interrupt (INTM) and realtime interrupt (DBGM) // EINT; ERTM; IPC_sync(IPC_CPU1_L_CM_R, IPC_FLAG31); // // Fill in the data to be sent // for(i=0; i<10; i++) { readData[i] = i; } // // Update the message // TxMsg.command = IPC_CMD_READ_MEM; TxMsg.address = (uint32_t)readData; TxMsg.dataw1 = 10; // Using dataw1 as data length TxMsg.dataw2 = 1; // Message identifier // // End of example. Loop forever // while(1) //增加了循环发送用于测试 { DEVICE_DELAY_US(100000); IPC_sendMessageToQueue(IPC_CPU1_L_CM_R, &messageQueue, IPC_ADDR_CORRECTION_ENABLE, &TxMsg, IPC_NONBLOCKING_CALL); DEVICE_DELAY_US(100000); } }
此致、
绿色
绿色、
是否意味着说在 CM 侧未触发 IPC_ISR1中断? (或) CPU1侧未触发 IPC_ISR1中断?
代码的 CPU1侧仅显示故事的一个侧? CM 发生什么事了?
此致、
曼诺伊
您好、Manoj:
客户反馈:CM4侧可以正常进入中断、CPU1侧不能进入中断、CM4使用例程:
#include "cm.h" #include "ipc.h" // // Defines // #define IPC_CMD_READ_MEM 0x1001 #define IPC_CMD_RESP 0x2001 #define TEST_PASS 0x5555 #define TEST_FAIL 0xAAAA IPC_MessageQueue_t messageQueue; // // IPC ISR for Flag 1 // C28x core sends data with message queue using Flag 0 // __interrupt void IPC_ISR1() { int i; IPC_Message_t TxMsg, RxMsg; bool status = false; // // Read the message from the message queue // IPC_readMessageFromQueue(IPC_CM_L_CPU1_R, &messageQueue, IPC_ADDR_CORRECTION_ENABLE, &RxMsg, IPC_NONBLOCKING_CALL); if(RxMsg.command == IPC_CMD_READ_MEM) { status = true; // // Read and compare data // for(i=0; i<RxMsg.dataw1; i++) { if((*(uint32_t *)RxMsg.address + i) != i) status = false; } } // // Send response message // TxMsg.command = IPC_CMD_RESP; TxMsg.address = 0; // Not used TxMsg.dataw1 = status ? TEST_PASS : TEST_FAIL; TxMsg.dataw2 = RxMsg.dataw2; // Use the message identifier from the received message IPC_sendMessageToQueue(IPC_CM_L_CPU1_R, &messageQueue, IPC_ADDR_CORRECTION_DISABLE, &TxMsg, IPC_NONBLOCKING_CALL); // // Acknowledge the flag // IPC_ackFlagRtoL(IPC_CM_L_CPU1_R, IPC_FLAG1); } // // Main // void main(void) { // // Initialize device clock and peripherals // CM_init(); // // Clear any IPC flags if set already // IPC_clearFlagLtoR(IPC_CM_L_CPU1_R, IPC_FLAG_ALL); // // Enable IPC interrupts // IPC_registerInterrupt(IPC_CM_L_CPU1_R, IPC_INT1, IPC_ISR1); // // Initialize message queue // IPC_initMessageQueue(IPC_CM_L_CPU1_R, &messageQueue, IPC_INT1, IPC_INT1); // // Synchronize both the cores. // IPC_sync(IPC_CM_L_CPU1_R, IPC_FLAG31); // // Loop forever. Wait for IPC interrupt // while(1); }
此致、
绿色
绿色、
我将尝试从我的一方重现此问题。 请在3-4个工作日内回复。
此致、
曼诺伊
曼诺伊:
感谢您的帮助、并等待您的回复。
绿色
绿色、
我今天就开始讨论这个问题。 我遇到了编译问题并努力解决它。
此致、
曼诺伊
曼诺伊:
非常感谢你的帮助。
此致、
绿色
邓、
我已开始处理该项目。 我会随时向您发布。
我希望在明天作出回应。
此致、
曼诺伊
您好、Manoj:
此问题是否有任何更新?
此致、
绿色
我已经能够让 CM 使用 IPC1中断 CPU1、但尚未成功让 CM 向 CPU1成功发送消息。
绿色、
我已附加了 C2000Ware msgqueue 示例代码的修改版本、其中 CPU1通过信息(数据通过1到10)传递给 CM 和 CM 通过信息(数据通过11到20)、并使用中断方法。 CPU1和 CM 均使用 IPC1中断来中断 eachother。
e2e.ti.com/.../ipc_5F00_ex2_5F00_msgqueue_5F00_cm_5F00_modified.c
e2e.ti.com/.../ipc_5F00_ex2_5F00_msgqueue_5F00_c28x1_5F00_modified.c
此致、
曼诺伊