Tool/software: TI-RTOS
I used Mutex to lock critical variables form being interrupted, but after call GateMutex_enter, MCU will be dead. i don't know why
This was used in CC2640R2 SDK V1.40, and is OK. But failed in CC2642R SDK 3.10.00.53
code as:
GateMutex_Struct SendmutexStruct[DATA_SEND_DIR_NUM];
GateMutex_Handle SendmutexHandle[DATA_SEND_DIR_NUM];
IArg SendmutexKey[DATA_SEND_DIR_NUM];
GateMutex_construct(&SendmutexStruct[TO_AIR], NULL);
SendmutexHandle[TO_AIR] = GateMutex_handle(&SendmutexStruct[TO_AIR]);
GateMutex_construct(&SendmutexStruct[TO_UART], NULL);
SendmutexHandle[TO_UART] = GateMutex_handle(&SendmutexStruct[TO_UART]);
#if SEND_MUTEX_EN
SendmutexKey[dir] = GateMutex_enter(SendmutexHandle[dir]);
#endif
pSend->length += len;
#if SEND_MUTEX_EN
GateMutex_leave(SendmutexHandle[dir], SendmutexKey[dir]);
#endif