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.

TMS320F28388D: ipc消息队列接收函数跑飞的问题

Part Number: TMS320F28388D


大家好,

我新建一个CPU1的工程,main函数代码如下:

#include "cpu1_board.h"

bool ipc1_ret = false;

IPC_MessageQueue_t messageQueue1;
IPC_Message_t TxMsg1, RxMsg1;

/**
 * main.c
 */
uint32_t main(void)
{
    //
    // Initialize device clock and peripherals
    //
    Device_init();

    //
    // init interrupt and vectorTable, drivelib.
    //
    Interrupt_initModule();
    Interrupt_initVectorTable();

    //
    // SYSCFG
    //
    Board_init();

    IPC_clearFlagLtoR(IPC_CPU1_L_CM_R, IPC_FLAG_ALL);
    IPC_initMessageQueue(IPC_CPU1_L_CM_R, &messageQueue1, IPC_INT1, IPC_INT1);

    //
    // Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
    //
    EINT;
    ERTM;

//	return 0;
    while(1)
    {
    	testCnt++;
    	if(testCnt >= 500000)
    	{
    		GPIO_togglePin(mGPIO_PIN_LED5);
    		testCnt = 0;

    		jumpCnt++;
    	}

    	if(jumpCnt >= 10)
    	{
    		jumpCnt = 0;
//    		asm("    LB 0x080000");
    	}

		ipc1_ret = IPC_readMessageFromQueue(IPC_CPU1_L_CM_R, &messageQueue1, IPC_ADDR_CORRECTION_ENABLE,
											&RxMsg1, IPC_NONBLOCKING_CALL);  // IPC_NONBLOCKING_CALL

		if(ipc1_ret != false)
		{
			IPC_ackFlagRtoL(IPC_CPU1_L_CM_R, IPC_FLAG1);
		}
    }
}

我初始化的IPC1的消息队列,然后在while循环添加了IPC_readMessageFromQueue函数。

当我用CCS的debug模式运行时,while能正常运行(灯闪烁),但当我掉电重新上电后发现,灯不再闪烁,估计是跑飞了。

然后我将IPC_readMessageFromQueue函数注释掉后,发现debug模式和重新上电后都能正常运行。

请问这是什么原因?