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.

[参考译文] LP-CC1312R7:两线程挂起 hwi 中断

Guru**** 1624225 points
Other Parts Discussed in Thread: CC1312R7
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/1350357/lp-cc1312r7-two-thread-pending-hwi-interrupt

器件型号:LP-CC1312R7
主题中讨论的其他器件:CC1312R7

大家好!

我正在尝试使用 CC1312R7创建应用。 有两个不同的线程。 只有 rf_runcmd 命令在第一个线程上运行。 在第二个线程中、我捕获来自串行端口的数据并将其排列在一个数组中。  但经过一段时间后、系统会崩溃并出现运行时错误。   我不知道我应该如何组织我的线程结构。 有人有评论吗?  下面是我的线程配置

#define PTHREAD_CREATE_DETACHED

int main(void)
{
    pthread_t           thread[2];
    pthread_attr_t      attrs[2];
    struct sched_param  priParam[2];
    int                 retc[2];
    int                 detachState[2];
    
    
    
    /* Call driver init functions */
    Board_initGeneral();
    
    GPIO_init();
    
    /* Set priority and stack size attributes */
    pthread_attr_init(&attrs[0]);
    priParam[0].sched_priority = 1;
    
    detachState[0] = PTHREAD_CREATE_DETACHED;
    retc[0] = pthread_attr_setdetachstate(&attrs[0],detachState[0]);
    if (retc[0] != 0)
    {
        /* pthread_attr_setdetachstate() failed */
        while (1);
    }
    
    pthread_attr_setschedparam(&attrs[0], &priParam[0]);
    
    retc[0] |= pthread_attr_setstacksize(&attrs[0], THREADSTACKSIZE);
    if (retc[0] != 0)
    {
        /* pthread_attr_setstacksize() failed */
        while (1);
    }
    
    retc[0] = pthread_create(&thread[0], &attrs[0], mainThread, NULL);
    if (retc[0] != 0)
    {
        /* pthread_create() failed */
        while (1);
    }
    
    
    /* Set priority and stack size attributes */
    pthread_attr_init(&attrs[1]);
    priParam[1].sched_priority = 2;
    
    detachState[1] = PTHREAD_CREATE_DETACHED;
    retc[1] = pthread_attr_setdetachstate(&attrs[1],detachState[1]);
    if (retc[1] != 0)
    {
        /* pthread_attr_setdetachstate() failed */
        while (1);
    }
    
    pthread_attr_setschedparam(&attrs[1], &priParam[1]);
    
    retc[1] |= pthread_attr_setstacksize(&attrs[1], THREADSTACKSIZE);
    if (retc[1] != 0)
    {
        /* pthread_attr_setstacksize() failed */
        while (1);
    }
    
    retc[1] = pthread_create(&thread[1], &attrs[1], rf_transmitThread, NULL);
    if (retc[1] != 0)
    {
        /* pthread_create() failed */
        while (1);
    }
    
    pthread_join(thread[0], NULL);
    pthread_join(thread[1], NULL);
    
    BIOS_start();
}

辛塞莱里