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.

AWR1843: AWR1843 device terminates due to runtime error

Expert 2050 points
Part Number: AWR1843

Our project is base on automotive lab demo mrr. We added a new task into the mss_main.c, the task is used to read Uart data and send message to CAN bus at runtime. 

static void MRR_MSS_initTask (UArg arg0, UArg arg1)
{    
    ...
    
    /*****************************************************************************
     * Create a New task
     *****************************************************************************/
    /* Create a new task */
    Task_Params_init(&taskParams);
    taskParams.stackSize = 3*1024;
    Task_create(newTask, &taskParams, NULL);

    /*****************************************************************************
     * Initialize the mmWave module:
     *****************************************************************************/
    memset ((void *)&initCfg, 0, sizeof(MMWave_InitCfg));
    ...
}

...

static void newTask(UArg arg0, UArg arg1)
{
    ...
    while(1)
    {
        ...
        retVal = UART_read(gMrrMSSMCB.newUartHandle, (uint8_t*)&uartData, UART_DATAREAD_SIZE);
        if(retVal > 0)
        {
          ...
          Can_Transmit_Schedule(MESSAGE_BODY,message.bytes,sizeof(message_body));
          ...
        }
    }
}

The program does running well sometimes, but most time, it will terminate due to a runtime error after few minutes running.

Can you please check if this problem is caused by the new task I created? 

 

  • Hi,

    I can think of two causes:

    1. Can you confirm that semaphore pend is being called from task context only and not in any interrupt context? Semaphore pends cannot be called in interrupt contexts. This is what the error log seems to indicate.

    2. It is unlikely, but perhaps  it could be a stack overflow issue. Could you ensure that the stack size allocated to the new task is enough? If there are any large arrays being allocated on the stack by this task as local variables, this would be something to consider. Perhaps for debugging you can consider making them global.

    Regards,

    Aayush

  • Thanks Aayush, 

    1) In whole mrr demo code, I only find the Semaphore_pend is called in task mboxReadTask:

    static void MmwDemo_mboxReadTask(UArg arg0, UArg arg1)
    {
        MmwDemo_message      message;
        int32_t              retVal = 0;
    
        while(1)
        {
            /* ************************************************************************* *
             * wait for new message and process all the messsages received from the peer *
             * ************************************************************************* */
            Semaphore_pend(gMrrMSSMCB.mboxSemHandle, BIOS_WAIT_FOREVER);
    ...

    In my modified demo, do I need add a Semaphore_pend into my new Task?

    2) Can you tell me the memory size of Stack and Heap in mrr demo? When I increase Stack size (3*1024->10*1024) as:

        /* Create a new task */
        Task_Params_init(&taskParams);
        taskParams.stackSize = 10*1024;
        Task_create(newTask, &taskParams, NULL);

    I get Heap memory error:

    [Cortex_R4_0] SOFTSYSRST:
    [C674X_0] Heap L1 : size 16384 (0x4000), free 6144 (0x1800)
    Heap L3 : size 1048576 (0x100000), free 0 (0x0)
    [Cortex_R4_0] Address: ffffe11c
    [C674X_0] Heap L1 : size 16384 (0x4000), free 1000 (0x3e8)
    [Cortex_R4_0] Setting: 0
    [C674X_0] Heap L3 : size 1048576 (0x100000), free 262144 (0x40000)
    [Cortex_R4_0] Debug: Launched the Initialization Task
    [C674X_0] Heap L2 : size 102400 (0x19000), free 21488 (0x53f0)
    [Cortex_R4_0] gnss read task priority: 2 
    [C674X_0] Heap L2 : size 102400 (0x19000), free 14432 (0x3860)
    [Cortex_R4_0] Debug: Initialized the mmWave module
    Debug: Synchronized the mmWave module
    ti.sysbios.heaps.HeapMem: line 221: out of memory: handle=0x800b438, size=3072
    xdc.runtime.Error.raise: terminating execution

  • Hi Lei,

    The MRR lab is configured for a 32KB MSS heap in the file <LAB_LOC>\src\mss\mss_mrr.cfg via heapMemParams.size.

    You can try increasing this size a little, upto what the L2 memory size restriction permits.

    As for this: 

    In my modified demo, do I need add a Semaphore_pend into my new Task?

    No need for this. I asked because of the error prompt in your screenshot. It seemed to indicate that the issue originated because semaphore pend was being called in an interrupt context. But it seems that you have not added any semaphore pend calls, so this should not be the root cause.

    Do you expect this task to be large? If not, we don't need to worry about the stack size allocated to it.

    Regards,

    Aayush