Part Number:BOOSTXL-CC3135Other Parts Discussed in Thread:CC3135
I built the test code based on the routines in the sdk。The pseudo-code is as follows:
int main(){
MCU_init();
sl_start();
while(1){
sl_Task();
}
}
After executing the above code, the sl_start function does not return normally. Further debugging found:
1、Program flow blocking position for _SlDrvWaitForInternalAsyncEvent, sl_SyncObjWait function have been waiting for a semaphore release, and sl_SyncObjSignal and sl_SyncObjSignalFromIRQ has not been called.
2、add breakpoint discovery in the external interrupt callback function, enter sl_start and pull up the nHIB pin, soon CC3135 pulls up the Host IRQ pin and then calls sl_Spawn
3、According to the design structure of sdk, a sl_IfRead/Write task is added to sl_Task in sl_Spawn.From the design structure of sdk. A sl_IfRead/Write task is added to sl_Task in sl_Spawn. Send information after the call flow sl_Task, MCU, CC3135 complete response after _SlDrvWaitForInternalAsyncEvent will receive semaphore, continue to implement the back of the process
4、In the above mentioned test, however, sl_start function needs to be terminated before sl_Task can be executed. This leads to a deadlock like state.
Yolande Wang:
您好,
根据您的描述,似乎添加外部中断程序会按照您的设计进行。
然而在sl_start函数中,程序在等待一个信号量释放,但对于释放该信号量的操作却没有调用,导致程序陷入了死锁或无法执行的状态。
以下是一些建议:
1.检查代码中关于信号量的部分,确保信号量的等待和释放操作是正确的,没有遗漏或者错误。
2.确认信号量何时被获取、使用和释放。确保没有在获取信号量后忘记释放它。
3.确认信号量的释放操作是否被调用,尤其是sl_SyncObjSignal和sl_SyncObjSignalFromIRQ。
,
Yolande Wang:
您好。我重新梳理了一下,根据您提供的信息,代码运行后出现了死锁的状态,sl_start函数无法正常返回,因为它在等待一个信号量释放。
我将我的建议稍微细化一下,希望能给您一点帮助。
sl_Start是用来打开NWP的,若没有回调函数它应该是阻塞的;若有InitCallBack,它将立即返回。Sl_Start – This function initializes the communication interface, sets the enable pin of the device, and callsto the init complete callback. If no callback function is provided, the function is blocking until the devicefinishes the initialization process.
_i16 sl_Start(const void* pIfHdl, _i8* pDevName, const P_INIT_CALLBACK pInitCallBack);
所以您可以重点检查一下你是否在 sl_start 提供了回调函数。