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.

死机问题

Other Parts Discussed in Thread: CC2640

大家好:

            在调试CC2640的过程中,发现如果在接收 App发送的消息 和 程序内部发送消息处理 碰撞在一起是就会死机.每次都停留在如下图:

在这里 exit 内部死循环?

请问TI工程师 及 各位 大神有何大招解决,谢谢!

还有,我也从 e2e 的帖子上查询了下,内存泄漏的改善地方也修改了。

uint8_t Util_enqueueMsg(Queue_Handle msgQueue, Semaphore_Handle sem,
uint8_t *pMsg)
{
queueRec_t *pRec;

// Allocated space for queue node.
#ifdef USE_ICALL
if (pRec = ICall_malloc(sizeof(queueRec_t)))
#else
if (pRec = (queueRec_t *)malloc(sizeof(queueRec_t)))
#endif
{
ICall_CSState key;
key = ICall_enterCriticalSection(); //互斥功能,避免同时调用此函数会死机

pRec->pData = pMsg;

Queue_enqueue(msgQueue, &pRec->_elem);

ICall_leaveCriticalSection(key);

// Wake up the application thread event handler.
if (sem)
{
Semaphore_post(sem);
}

return TRUE;
}

// Free the message.
#ifdef USE_ICALL
ICall_free(pMsg);
#else
free(pMsg);
#endif
return FALSE;
}

uint8_t *Util_dequeueMsg(Queue_Handle msgQueue)
{

ICall_CSState key;
key = ICall_enterCriticalSection(); //互斥功能,避免同时调用此函数会死机

if (!Queue_empty(msgQueue))
{
queueRec_t *pRec = Queue_dequeue(msgQueue);
uint8_t *pData = pRec->pData;

ICall_leaveCriticalSection(key);
// Free the queue node
// Note: this does not free space allocated by data within the node.
#ifdef USE_ICALL
ICall_free(pRec);
#else
free(pRec);
#endif
return pData;
}

ICall_leaveCriticalSection(key);

return NULL;
}

麻烦TI工程师协助,此案子死机问题卡了很久,谢谢!

  • 问题点找到了,但是不知道为什么不能这样操作。就是在一个建立一个循环事件时,例如一个按键事件 KeySetClockHandler 事件回调函数

    在这个回调函数里 进行发送 数据给App

    uint8 pData[20] = {0xAA, 0xBB};
    TTCBleProfileSetParameter(TTCBLE_PROFILE_CHAR2, 12, pData);

    然后又同时 内部 置起 按键消息,若这时候当App也发送给2640模块时就会出现上诉问题,直接死机。但是如果 这3者只出现2个时就不会?请问这是为什么?

    希望TI员工协助解析下,谢谢!

  • Asheng Lin 你好 ,请问你的问题解决了没有,我跟你遇到同样的问题,我的情况是例如启动了一个按键查询的定时任务是100ms一次,再注册一个串口接收任务,在串口没收到数据时一切正常,在收到串口数据调用CallBack函数接收数据完毕后出现死机,所有系统功能丧失,请问跟你所描述的情况是否类似,你是怎么处理的