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.

CCS: got some error in hwi/swi

Other Parts Discussed in Thread: CC1312R

Tool/software: Code Composer Studio

Dead sir/madam.

i am running an modified uart program(with adding uasrt callback  and timer callback.the program Error_policyMin after some time. and i got the following error.

can someone give me idea why will it happen

  • Hi Jeff,

    Assigning an expert to comment. 

    Thanks, 
    Elin

  • Hi Jeff,

    Can you share which device and SDK you are working on? Could you also share the changes you have made to the UART example?

  • Hi M-W,

    i am using CC1312R and using SDK4-10-00-78
    i have change many thing in the code

    1) adding extra uart for debug use
    2) adding a timer cb to do the timeout

    3) modify the original uart to communicate with gsm.

    thanks

    Jeff

  • Hi Jeff,

    You would need to be a bit more specific, code would help. As you seem to have made quite some changes to the code, I would guess you might have overlooked an array size or you are getting a bad pointer (assuming you got some data handling going with the GSM part).

    I draw these conclusions on the fact that you seem to have a memory corruption due to the priority report of the task in ROV. 

  • Hi M-W,

    Thanks . I was working on CC1312R + SDK_4_10_00_78.

    I was modify my project code base on uartecho and aim to control a GSM module (UART0) , a debug UART port (UART1) and a timer for timeout usage.

    void *mainThread(void *arg0)
    {
        /* Call driver init functions */
        GPIO_init();                                            //TI DRIVER IO INIT
        UART_init();
        //Timer_init();                                           //20200518
    
        /* Configure the LED pin */
        GPIO_setConfig(CONFIG_GPIO_LED_0, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
    
        /* Turn on user LED */
        GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_ON);
    
        //reset leg
    
        GPIO_setConfig(GSM_RESET, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_HIGH);
    
        /* Turn on user LED */
        GPIO_write(GSM_RESET, CONFIG_GPIO_LED_ON);
    
        cc13_uart_init();                                       //init the cc1312 uart
        cc131x_timer_init();
        //wantedRxBytes   = 60;                                     //
        send_once       = 1;
    //============================
    //  neededn?
        start_cc13_callback();
    //======================
        gsm_init(); //a first kick is needed ORG was here
    //======================
    /*
     * function to test time in 0527
        gsm_gettime();
        while (1)
        {
            if(uart_received == 1)
            {
                print_debug_uart();
    
                gsm_get_time_value();
            }
        }
        gsm_gettime();
        gsm_get_time_value();
        // sleep(1);
         *
         */
    //=========================================================
    //  Main Loop
    //
    //=========================================================
        while (1)
        {
            if(uart_received == 1)
            {
                //write back the message from 
                print_debug_uart();
    //====================================
                chk_feedback();                 //check the ack message from IOT
                uart_received = 0;              // ?
                if(gsm_init_f == 1)            //initialization flag
                {
                    gsm_init();                //
                }
                if(gsm_init_f == 0)            //
                {
                    gsm_regular_send();        //
                }
                if(loop_finish == 1)            //sleep flag
                {
                    stop_timer();
                    sleep(10);//300 = 5minute                  //sleep 10 sec
                    loop_finish = 0;
                    start_timer();
    
                }
            }
            nb_timeout_chk();
    //=========================================================
    //=========================================================
        }
    }

    callback :

    void Uart_ReadCallback(UART_Handle handle, void *rxBuf, size_t size)
    {
        unsigned int i;
    //0526
        timeout_cnt = 0;
    //  if (size == wantedRxBytes)
    //  {
    //  Copy bytes from RX buffer to TX buffer TO DEBUG PURPOSE
        for(i = 0; i < wantedRxBytes; i++)
        {
            txBuf[i]    = ((uint8_t*)rxBuf)[i];
            Buf_test[i] = txBuf[i];                             // Transmit buffer
               // test_cnt++;
        }
        uart_received = 1;
        UART_read(uart, rxBuf, wantedRxBytes);
    //    }
        debug_f++;  //
    }

    uart_init

    void cc13_uart_init(void)
    {
        const char  echoPrompt[] = "Echoing characters:\r\n";
        //================
       //UART0 for BC28
           /* Create a UART with data processing off. */
        UART_Params_init(&uartParams);
        uartParams.readMode         = UART_MODE_CALLBACK;
        uartParams.readCallback     = Uart_ReadCallback;
        uartParams.writeDataMode    = UART_DATA_TEXT;
        uartParams.readDataMode     = UART_DATA_TEXT;
        uartParams.readReturnMode   = UART_RETURN_NEWLINE;      //UART_RETURN_FULL;//UART_RETURN_NEWLINE;
        uartParams.readEcho         = UART_ECHO_OFF;
        uartParams.baudRate         = 9600;
       //================
        uart = UART_open(CONFIG_UART_0, &uartParams);
        UART_control(uart, UARTCC26XX_CMD_RETURN_PARTIAL_ENABLE, NULL);
          //================
       //UART2 for DEBUG
        UART_Params_init(&uartParams1);
        uartParams1.readMode        = UART_MODE_CALLBACK;
        uartParams1.readCallback    = Uart2_ReadCallback;
        uartParams1.writeDataMode   = UART_DATA_TEXT;           // text mode = processed , binrary is unprocess
        uartParams1.readDataMode    = UART_DATA_TEXT;
        uartParams1.readReturnMode  = UART_RETURN_NEWLINE;
        uartParams1.readEcho        = UART_ECHO_OFF;
        uartParams1.baudRate        = 9600;
        uart2 = UART_open(CONFIG_UART_1, &uartParams1);
       //================
        UART_write(uart, echoPrompt, sizeof(echoPrompt));
        // UART_write(uart2, echoPrompt, sizeof(echoPrompt));
        if (uart == NULL)
        {
               /* UART_open() failed */
            while (1);
        }
    }

    timer:

    void cc131x_timer_init(void)
    {
        Timer_init();
    
    //==================================================
    //0.1 sec interupt
        Timer_Params_init(&params);
        params.period           = 100000;                         //100ms interrupt = 100,000us
        params.periodUnits      = Timer_PERIOD_US;
        params.timerMode        = Timer_CONTINUOUS_CALLBACK;
        params.timerCallback    = timerCallback;
    
        timer0 = Timer_open(CONFIG_TIMER_0, &params);
    
        if (timer0 == NULL) {
              /* Failed to initialized timer */
              while (1) {
                  tim_err = 1;
              }
          }
    
        if (Timer_start(timer0) == Timer_STATUS_ERROR) {
                /* Failed to start timer */
                while (1) {
                    tim_err = 1;
                }
            }
        return (NULL);
    }

    uart_debug:

    //==========================================================
    //
    //==========================================================
    void print_debug_uart(void)
    {
        UART_write(uart2, txBuf, wantedRxBytes);                //receive from
        sprintf(test_buf,"No. of CallBack  = %d\r\n",debug_f);
        UART_write(uart2, &test_buf, (size_t)strlen(test_buf));
    //==
        sprintf(test_buf," step  = %d\r\n",step);
        UART_write(uart2, &test_buf, (size_t)strlen(test_buf));
    
    }

  • Hi,

    I would try to comment out the "pinrt_debug_uart" and see if that "fixes" it. sprintf for example could require quite some stack and if your main task stack is to small, you might end up experiencing a stack overflow. Could you check the stacks of your task as well?