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.

zigbee在Task中对数组赋值导致系统死机



我在用cc2652的zigbee做无线传感器节点时,发现在Task中将ADC数据缓存到数组中时偶尔会导致系统死机,数组没有越界。

不知这是代码问题还是操作系统的问题。麻烦TI工程师帮忙解决一下。

typedef struct MsgObj {
uint16_t data[PACKAGE_LEN];
} MsgObj;

Void myTask_Fun(UArg a0, UArg a1)
{
    //dac
    ADC_Handle   adc;
    ADC_Params   params;
    int_fast16_t res;
    static int count=0;
    //data
    MsgObj msg;

    GPIO_init();
    ADC_init();
    ADC_Params_init(&params);
    adc = ADC_open(CONFIG_ADC_0, &params);
    if (adc == NULL) {
        UART_write(uart,b1,sizeof(b1));
        while (1);
    }
    while(1){
        //采样
        if((GPIO_read(CONFIG_GPIO_1)==0)&&(GPIO_read(CONFIG_GPIO_2)==0)){
            res = ADC_convert(adc, &adcValue0);
            if (res == ADC_STATUS_SUCCESS) {
                msg.data[count]=adcValue0;//数组没有越界,但赋值偶尔会导致系统死机
                count++;
            }
        }
        if(count>=PACKAGE_LEN){
            sendflag=1;
            count = 0;
            Mailbox_post(mbxHandle, &msg, BIOS_NO_WAIT);
            Semaphore_post(appSemHandle);
            GPIO_toggle(CONFIG_GPIO_3);
        }
        Task_sleep(3 * (1000 / Clock_tickPeriod));
    }
}