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.

TDA4VM: The CanApp_TaskFxn function is not scheduled by the system. after 'BIOS_start'

Part Number: TDA4VM

HI,master

sdk:psdk_rtos_auto_j7_07_00_00_11

     mcuss  can_profile_app   The CanApp_TaskFxn function is not scheduled by the system. after 'BIOS_start' .

main_tirtos.c
int main(void)
{
...
Task_Params_init(&taskParams);
taskParams.instance->name = CAN_PROFILE_DEMO_TASK_NAME;
/* Set the task priority higher than the default priority (1) */
taskParams.priority = 2;
taskParams.stack = CanApp_TaskStack;
taskParams.stackSize = sizeof (CanApp_TaskStack);

task = Task_create(CanApp_TaskFxn, &taskParams, &eb);
...
BIOS_start(); /* does not return */
}

/*
The CanApp_TaskFxn function is not scheduled by the system
after 'BIOS_start'

*/
static Void CanApp_TaskFxn(UArg a0, UArg a1)
{
AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
" Enter CanApp_TaskFxn!!!\n");
CanApp_PlatformInit();

run log:

CAN Profile App: AppUtils_Init done !!!
CAN Profile App:Variant - Pre Compile being used !!!
CAN Profile App: Can_Init done !!!
CAN Profile App: Sciclient_init done !!!
CAN Profile App: CanApp_BuildIntList done !!!
CAN Profile App: CanApp_InterruptConfig done !!!
CAN Profile App: AppUtils_ProfileInit done !!!
CAN Profile App: AppUtils_CanSectionInit done !!!
CAN Profile App: CanApp_Startup done !!!
CAN Profile App: CanApp_PowerAndClkSrc done !!!
CAN Profile App: CanIf_Init done !!!
CAN Profile App: Error_init done !!!
CAN Profile App: pre Task_create !!!
CAN Profile App: Task_create done !!!
CAN Profile App:pred BIOS_start !!!

not found   "Enter CanApp_TaskFxn!!!" , so i think   not scheduled by the system. after 'BIOS_start' .

  • Hi,

    Is this the SDK version of the application or something has changed? If something has been modified can you send me all the changes?

    Are these all the logs that come on the MCU UART?

    Regards,

    Karan

  • HI。

    No modification, just add debug log

    /*
    *
    * Copyright (c) 2019-2020 Texas Instruments Incorporated
    *
    * All rights reserved not granted herein.
    *
    * Limited License.
    *
    * Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
    * license under copyrights and patents it now or hereafter owns or controls to make,
    * have made, use, import, offer to sell and sell ("Utilize") this software subject to the
    * terms herein.  With respect to the foregoing patent license, such license is granted
    * solely to the extent that any such patent is necessary to Utilize the software alone.
    * The patent license shall not apply to any combinations which include this software,
    * other than combinations with devices manufactured by or for TI ("TI Devices").
    * No hardware patent is licensed hereunder.
    *
    * Redistributions must preserve existing copyright notices and reproduce this license
    * (including the above copyright notice and the disclaimer and (if applicable) source
    * code license limitations below) in the documentation and/or other materials provided
    * with the distribution
    *
    * Redistribution and use in binary form, without modification, are permitted provided
    * that the following conditions are met:
    *
    * *       No reverse engineering, decompilation, or disassembly of this software is
    * permitted with respect to any software provided in binary form.
    *
    * *       any redistribution and use are licensed by TI for use only with TI Devices.
    *
    * *       Nothing shall obligate TI to provide you with source code for the software
    * licensed and provided to you in object code.
    *
    * If software source code is provided to you, modification and redistribution of the
    * source code are permitted provided that the following conditions are met:
    *
    * *       any redistribution and use of the source code, including any resulting derivative
    * works, are licensed by TI for use only with TI Devices.
    *
    * *       any redistribution and use of any object code compiled from the source code
    * and any resulting derivative works, are licensed by TI for use only with TI Devices.
    *
    * Neither the name of Texas Instruments Incorporated nor the names of its suppliers
    *
    * may be used to endorse or promote products derived from this software without
    * specific prior written permission.
    *
    * DISCLAIMER.
    *
    * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS
    * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    * IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
    * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
    * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
    * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
    * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    * OF THE POSSIBILITY OF SUCH DAMAGE.
    *
    */
    
    /**
     *  \file     CanApp_Startup.c
     *
     *  \brief    This file contains the pinmux, interrupt and clock configuration.
     */
    /* ========================================================================== */
    /*                             Include Files                                  */
    /* ========================================================================== */
    #include "CanApp_Startup.h"
    #include "can_profile.h"
    
    /* ========================================================================== */
    /*                            Global Variables                                */
    /* ========================================================================== */
    uint32                      CanApp_IntNumbers[CAN_MAX_CONTROLLER];
    /**< Store the interrupt numbers for all enabled CAN instances */
    uint32                      CanApp_InstanceSrcId[CAN_MAX_CONTROLLER];
    /**< Store the interrupt source id for all enabled CAN instances */
    CanApp_IsrType              CanApp_Isr[CAN_MAX_CONTROLLER];
    /**< Associated ISR */
    uint32                      CanApp_RoutIntNumbers[CAN_MAX_CONTROLLER];
    /**< Store the output interrupt number routed */
    extern Can_PduType          CanApp_Pdu, CanApp_Pdu1;
    /**< Variable used for copying protocol data unit */
    extern uint8                CanApp_InputData[64U];
    /**< Variables which contains Can PDU data used in Can transmission */
    extern const Can_PduType    *CanApp_PduInfo;
    /**< Variable which contains Can PDU data passed during Transmission */
    /* ========================================================================== */
    /*                          Function Definitions                              */
    /* ========================================================================== */
    /** \brief Start up sequence : Program the interrupt muxes / priorities */
    void CanApp_Startup(void)
    {
        /* Build Interrupt list for the enabled Can Instances */
        CanApp_BuildIntList();
    
        /* Interrupt configuration for the enabled Can Instances */
        CanApp_InterruptConfig();
        AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                        " --------CanApp_InterruptConfig done !!!\n");
    
        /* Initialize counters, that would be required for profiling operations */
        AppUtils_ProfileInit(0);
        AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                        " AppUtils_ProfileInit done !!!\n");
    
        /* Initialize memory sections, which is used to check memory corruption */
    	AppUtils_CanSectionInit();
        AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                        " AppUtils_CanSectionInit done !!!\n");
    }
    
    void CanApp_BuildIntList(void)
    {
        uint32 idx, flag, intNum;
        const Can_ConfigType *Can_ConfigPtr;
        CanApp_IsrType pIsrHandler = NULL;
        uint32 canMaxControllerCnt = 0U;
    
        /*
         * 1. Determine the number of Can Instances used
         * 2. Build valid Can Instances list
         * 3. Build isr and interrupt number for enabled Can Instances only
         */
        /* Do Can Init */
    #if (STD_ON == CAN_VARIANT_PRE_COMPILE)
        Can_ConfigPtr = &CAN_INIT_CONFIG_PC;
        Can_Init((const Can_ConfigType *) NULL_PTR);
    #if (CAN_INITIAL_PRINT_DISABLE_BEFORE_CAN_RESPONSE == STD_OFF)
        AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                        "Variant - Pre Compile being used !!!\n");
    #endif
    #else
        Can_ConfigPtr = &CanConfigSet;
        Can_Init(Can_ConfigPtr);
    #if (CAN_INITIAL_PRINT_DISABLE_BEFORE_CAN_RESPONSE == STD_OFF)
        AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                        "Variant - Post Build being used !!!\n");
    #endif
    #endif
    
        AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                        " Can_Init done !!!\n");
        /* Enable SCI Client */
        Sciclient_init(NULL_PTR);
        AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                        " Sciclient_init done !!!\n");
        canMaxControllerCnt = Can_ConfigPtr->CanMaxControllerCount;
        for (idx = 0U; idx < canMaxControllerCnt; idx++)
        {
            CanApp_IntNumbers[idx] = 0U;
        }
    
        for (idx = 0U; idx < canMaxControllerCnt; idx++)
        {
            flag = 0U;
            if (CAN_CONTROLLER_INSTANCE_MCU_MCAN0 ==
                CanConfigSet_CanController_List_PC[idx]->CanControllerInst)
            {
                intNum = APP_MCU_MCAN_0_INT0;
                pIsrHandler = Can_0_Int0ISR;
                flag = 1U;
            }
            if (CAN_CONTROLLER_INSTANCE_MCU_MCAN1 ==
                CanConfigSet_CanController_List_PC[idx]->CanControllerInst)
            {
                intNum = APP_MCU_MCAN_1_INT0;
                pIsrHandler = Can_1_Int0ISR;
                flag = 1U;
            }
            if (0U != flag)
            {
                CanApp_IntNumbers[idx] = intNum;
                CanApp_Isr[idx] = pIsrHandler;
                flag = 0U;
            }
        }
        AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                        " CanApp_BuildIntList done !!!\n");
        return;
    }
    
    void CanApp_PlatformInit()
    {
        uint32 regVal = 0U;
        /* Unlock lock key registers for Partition 7: IO PAD
           configuration registers in MAIN_CTRL_MMR */
        /* write Partition 7 Lock Key 0 Register */
        CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1D008, 0x68EF3490);
        /* write Partition 7 Lock Key 1 Register */
        CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1D00C, 0xD172BC5A);
        /* Check for unlock */
        regVal = CSL_REG32_RD(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1D008);
        while ((regVal & 0x1) != 0x1U)
        {
            regVal = CSL_REG32_RD(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1D008);
        }
    
        /* Unlock lock key registers for Partition 7: IO PAD
           configuration registers in MAIN_CTRL_MMR */
        /* write Partition 7 Lock Key 0 Register */
        CSL_REG32_WR(CSL_CTRL_MMR0_CFG0_BASE + 0x1D008, 0x68EF3490);
        /* write Partition 7 Lock Key 1 Register */
        CSL_REG32_WR(CSL_CTRL_MMR0_CFG0_BASE + 0x1D00C, 0xD172BC5A);
        /* Check for unlock */
        regVal = CSL_REG32_RD(CSL_CTRL_MMR0_CFG0_BASE + 0x1D008);
        while ((regVal & 0x1) != 0x1U)
        {
            regVal = CSL_REG32_RD(CSL_CTRL_MMR0_CFG0_BASE + 0x1D008);
        }
    
        /* Unlocking done */
        /* Below code will be replaced by Port module in further releases */
        /* MCU MCAN 0 Tx PAD configuration */
        regVal = 0x60000U;
        CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0A8U, regVal);
        /* MCU MCAN 0 Rx PAD configuration */
        regVal = 0x60000U;
        CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0ACU, regVal);
        /* MCU MCAN 1 Tx PAD configuration */
        regVal = 0x60000U;
        CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0C0U, regVal);
        /* MCU MCAN 1 Rx PAD configuration */
        regVal = 0x60000U;
        CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0C4U, regVal);
        /* MAIN MCAN 0 Tx PAD configuration */
        regVal = 0x60000U;
        CSL_REG32_WR(CSL_CTRL_MMR0_CFG0_BASE + 0x1C20CU, regVal);
        /* MAIN MCAN 0 Rx PAD configuration */
        regVal = 0x60000U;
        CSL_REG32_WR(CSL_CTRL_MMR0_CFG0_BASE + 0x1C208U, regVal);
        /* MAIN MCAN 4 Tx PAD configuration */
        regVal = 0x60006U;
        CSL_REG32_WR(CSL_CTRL_MMR0_CFG0_BASE + 0x1C020U, regVal);
        /* MAIN MCAN 4 Rx PAD configuration */
        regVal = 0x60006U;
        CSL_REG32_WR(CSL_CTRL_MMR0_CFG0_BASE + 0x1C024U, regVal);
        /* MAIN MCAN 9 Tx PAD configuration */
        regVal = 0x60006U;
        CSL_REG32_WR(CSL_CTRL_MMR0_CFG0_BASE + 0x1C0CCU, regVal);
        /* MAIN MCAN 9 Rx PAD configuration */
        regVal = 0x60006U;
        CSL_REG32_WR(CSL_CTRL_MMR0_CFG0_BASE + 0x1C0D0U, regVal);
        /* MAIN MCAN 11 Tx PAD configuration */
        regVal = 0x60006U;
        CSL_REG32_WR(CSL_CTRL_MMR0_CFG0_BASE + 0x1C11CU, regVal);
        /* MAIN MCAN 11 Rx PAD configuration */
        regVal = 0x60006U;
        CSL_REG32_WR(CSL_CTRL_MMR0_CFG0_BASE + 0x1C120U, regVal);
    
        /* Take MCAN transceivers out of STB mode i.e NORMAL Mode */
        CanApp_EnableTransceivers();
    }
    
    void CanApp_EnableTransceivers(void)
    {
        uint32 regVal = 0U;
        Dio_LevelType dioPinLevel[2U];
    
        /* Take MCAN transceiver out of STB mode for MCU MCAN0 */
        /* Below code will be replaced by Port module in further releases */
        /* Pin mux configuration of Dio Pin 355 */
        regVal = 0x08050007U;
        CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + CSL_WKUP_CTRL_MMR_CFG0_PADCONFIG44, regVal);
        /* Set Pin direction to output */
        regVal = CSL_REG32_RD(CSL_WKUP_GPIO0_BASE + 0x10U);
        regVal &= (~(1U << 0x0U));
        CSL_REG32_WR(CSL_WKUP_GPIO0_BASE + 0x10U, regVal);
        /* Drive Pin to High */
        Dio_WriteChannel(CAN_TRCV_MCU_MCAN_0, STD_HIGH);
         /* Read Pin level */
        dioPinLevel[1U] = Dio_ReadChannel(CAN_TRCV_MCU_MCAN_0);
        /*Read back the pin levels to ensure transceiver is enabled*/
        if (STD_HIGH != dioPinLevel[1U])
        {
            AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
            " Error in Enabling CAN Transceiver MCU MCAN0!!!\n");
        }
        else
        {
            regVal = 0x08050007U;
            CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE +
                CSL_WKUP_CTRL_MMR_CFG0_PADCONFIG38, regVal);
            /* Set Pin direction to output */
            regVal = CSL_REG32_RD(CSL_WKUP_GPIO0_BASE + 0x38U);
            regVal &= (~(1U << 0x16U));
            CSL_REG32_WR(CSL_WKUP_GPIO0_BASE + 0x38U, regVal);
            /* Drive Pin to High */
            Dio_WriteChannel(54U, STD_HIGH);
             /* Read Pin level */
            dioPinLevel[1U] = Dio_ReadChannel(54U);
            /*Read back the pin levels to ensure transceiver is enabled*/
            if (STD_HIGH != dioPinLevel[1U])
            {
                AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                " Error in Enabling CAN Transceiver MCU MCAN0!!!\n");
            }
            else
            {
                AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                " Successfully Enabled CAN Transceiver MCU MCAN0!!!\n");
            }
        }
        /* Take MCAN transceiver out of STB mode for MCU MCAN1 */
        /* Below code will be replaced by Port module in further releases */
        /* Pin mux configuration of Dio Pin 2 */
        regVal = 0x08050007U;
        CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + CSL_WKUP_CTRL_MMR_CFG0_PADCONFIG46, regVal);
        /* Set Pin direction to output */
        regVal = CSL_REG32_RD(CSL_WKUP_GPIO0_BASE + 0x10U);
        regVal &= (~(1U << 0x2U));
        CSL_REG32_WR(CSL_WKUP_GPIO0_BASE + 0x10U, regVal);
        /* Drive Pin to Low */
        Dio_WriteChannel(CAN_TRCV_MCU_MCAN_1, STD_LOW);
         /* Read Pin level */
        dioPinLevel[1U] = Dio_ReadChannel(CAN_TRCV_MCU_MCAN_1);
        /*Read back the pin levels to ensure transceiver is enabled*/
        if (STD_LOW != dioPinLevel[1U])
        {
            AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
            " Error in Enabling CAN Transceiver MCU MCAN1!!!\n");
        }
        else
        {
            AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
            " Successfully Enabled CAN Transceiver MCU MCAN1!!!\n");
        }
    
        return;
    }
    
    void CanApp_InterruptConfig(void)
    {
        uint32 idx;
        OsalRegisterIntrParams_t    intrPrms;
        OsalInterruptRetCode_e      osalRetVal;
        HwiP_Handle hwiHandle;
        const Can_ConfigType *Can_ConfigPtr;
    
    #if (STD_ON == CAN_VARIANT_PRE_COMPILE)
        Can_ConfigPtr = &CAN_INIT_CONFIG_PC;
    #else
        Can_ConfigPtr = &CanConfigSet;
    #endif
    
        for (idx = 0U; idx < Can_ConfigPtr->CanMaxControllerCount; idx++)
        {
            Osal_RegisterInterrupt_initParams(&intrPrms);
            intrPrms.corepacConfig.arg          = (uintptr_t)CanApp_Isr[idx];
            intrPrms.corepacConfig.isrRoutine   = &CanApp_CanXIsr;
            intrPrms.corepacConfig.priority     = 1U;
            intrPrms.corepacConfig.corepacEventNum = 0U; /* NOT USED ? */
            intrPrms.corepacConfig.intVecNum        = CanApp_IntNumbers[idx];
    
            osalRetVal = Osal_RegisterInterrupt(&intrPrms, &hwiHandle);
            if(OSAL_INT_SUCCESS != osalRetVal)
            {
                AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                                " Error!!! Could not register the ISR for instance"
                                "%d!!!\n", idx);
                break;
            }
        }
        return;
    }
    
    /** \brief None, SBL/GEL powers up the timers and clock sources */
    void CanApp_PowerAndClkSrc(void)
    {
        /* Mcu module, when included will replace this operation */
        return;
    }
    
    void CanApp_SetupCanFrame(uint32 ctlr_cnt, uint8 *hth, uint32 *mask)
    {
    #if (CAN_TX_ONLY_MODE == STD_ON)
            if (CAN_CONTROLLER_INSTANCE_MCU_MCAN0 ==
                CanConfigSet_CanController_List_PC[ctlr_cnt]->CanControllerInst)
            {
                /* CAN Protocol Data Unit */
                CanApp_PduInfo = &CanApp_Pdu;
                /* Hardware Transmit Handle assigned to MCAN0 */
                *hth     = CAN_HTRH_0;
                /* mask is need for checking id of received message with
                 * sent message as 30th bit the of sent message will be set
                 * for CAN FD frame */
    #if (CAN_LOOPBACK_ENABLE == STD_ON) || (CAN_EXT_LOOPBACK == STD_ON)
                *mask    = 0xC0000000U;
    #endif
            }
    
            if (CAN_CONTROLLER_INSTANCE_MCU_MCAN1 ==
                CanConfigSet_CanController_List_PC[ctlr_cnt]->CanControllerInst)
            {
                /* CAN Protocol Data Unit */
                CanApp_PduInfo = &CanApp_Pdu1;
                /* Hardware Transmit Handle assigned to MCAN1 */
                *hth     = CAN_HTRH_2;
                /* mask is need for checking id of received message with
                 * sent message as 30th bit the of sent message will be set
                 * for CAN FD frame */
    #if (CAN_LOOPBACK_ENABLE == STD_ON) || (CAN_EXT_LOOPBACK == STD_ON)
                *mask = 0xC0000000U;
    #endif
            }
    #endif
    }
    
    #if (CAN_EXT_LOOPBACK == STD_ON)
    Std_ReturnType CanApp_SetupControllersExternalLoopback(uint32 CanControllerTransition)
    { 
        Std_ReturnType      statusTxCan, statusRxCan;
        Std_ReturnType      status = E_OK;
    
        if (CanControllerTransition == CAN_CS_STARTED)
        {
            statusTxCan = Can_SetControllerMode(
            CanConfigSet_CanController_List_PC[APP_MCU_MCAN0_IDX]->ControllerId, CAN_CS_STARTED);
            statusRxCan = Can_SetControllerMode(
            CanConfigSet_CanController_List_PC[APP_MCU_MCAN1_IDX]->ControllerId, CAN_CS_STARTED);
            if ((statusTxCan != E_OK) && (statusRxCan != E_OK))
            {
                status = E_NOT_OK;
            }
        }
    
        if (CanControllerTransition == CAN_CS_STOPPED)
        {
            statusTxCan = Can_SetControllerMode(
            CanConfigSet_CanController_List_PC[APP_MCU_MCAN0_IDX]->ControllerId, CAN_CS_STOPPED);
            statusRxCan = Can_SetControllerMode(
            CanConfigSet_CanController_List_PC[APP_MCU_MCAN1_IDX]->ControllerId, CAN_CS_STOPPED);
            if ((statusTxCan != E_OK) && (statusRxCan != E_OK))
            {
                status = E_NOT_OK;
            }
        }
    
        return status;
    }
    
    void CanApp_SetupCanFrameExternalLoopback(uint8 *hth, uint32 *mask)
    {
        /* Setup Can frame, reception happens on MCAN9 */
        /* CAN Protocol Data Unit */
        CanApp_PduInfo = &CanApp_Pdu1;
        /* Hardware Transmit Handle assigned to MCAN4 */
        *hth     = CAN_HTRH_0;
        /* mask is need for checking id of received message with
         * sent message as 30th bit the of sent message will be set
         * for CAN FD frame */
        *mask    = 0xC0000000U;
    }
    #endif
    

  • /*
    *
    * Copyright (c) 2019-2020 Texas Instruments Incorporated
    *
    * All rights reserved not granted herein.
    *
    * Limited License.
    *
    * Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
    * license under copyrights and patents it now or hereafter owns or controls to make,
    * have made, use, import, offer to sell and sell ("Utilize") this software subject to the
    * terms herein.  With respect to the foregoing patent license, such license is granted
    * solely to the extent that any such patent is necessary to Utilize the software alone.
    * The patent license shall not apply to any combinations which include this software,
    * other than combinations with devices manufactured by or for TI ("TI Devices").
    * No hardware patent is licensed hereunder.
    *
    * Redistributions must preserve existing copyright notices and reproduce this license
    * (including the above copyright notice and the disclaimer and (if applicable) source
    * code license limitations below) in the documentation and/or other materials provided
    * with the distribution
    *
    * Redistribution and use in binary form, without modification, are permitted provided
    * that the following conditions are met:
    *
    * *       No reverse engineering, decompilation, or disassembly of this software is
    * permitted with respect to any software provided in binary form.
    *
    * *       any redistribution and use are licensed by TI for use only with TI Devices.
    *
    * *       Nothing shall obligate TI to provide you with source code for the software
    * licensed and provided to you in object code.
    *
    * If software source code is provided to you, modification and redistribution of the
    * source code are permitted provided that the following conditions are met:
    *
    * *       any redistribution and use of the source code, including any resulting derivative
    * works, are licensed by TI for use only with TI Devices.
    *
    * *       any redistribution and use of any object code compiled from the source code
    * and any resulting derivative works, are licensed by TI for use only with TI Devices.
    *
    * Neither the name of Texas Instruments Incorporated nor the names of its suppliers
    *
    * may be used to endorse or promote products derived from this software without
    * specific prior written permission.
    *
    * DISCLAIMER.
    *
    * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS
    * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    * IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
    * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
    * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
    * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
    * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    * OF THE POSSIBILITY OF SUCH DAMAGE.
    *
    */
    
    /**
     *  \file can_profile.h.c
     *
     *  \brief Main file for TI-RTOS build
     */
    
    /* ========================================================================== */
    /*                             Include Files                                  */
    /* ========================================================================== */
    /* XDCtools Header files */
    #include <xdc/std.h>
    #include <xdc/runtime/Error.h>
    #include <xdc/runtime/System.h>
    /* BIOS Header files */
    #include <ti/sysbios/BIOS.h>
    #include <ti/sysbios/knl/Task.h>
    
    #include <ti/csl/arch/csl_arch.h>
    #include <ti/csl/soc.h>
    #include <ti/csl/cslr.h>
    
    #include <ti/osal/osal.h>
    #include <ti/osal/TaskP.h>
    
    #include "CanApp_Startup.h"
    #include "can_profile.h"
    #include "CanIf.h"
    
    /* ========================================================================== */
    /*                           Macros & Typedefs                                */
    /* ========================================================================== */
    
    /* Test application stack size */
    #define APP_TASK_STACK                  (10U * 1024U)
    /**< Stack required for the stack */
    #define CAN_PROFILE_DEMO_TASK_NAME      ("CAN PROFILE")
    /**< Task name */
    
    /* ========================================================================== */
    /*                         Structure Declarations                             */
    /* ========================================================================== */
    
    /* None */
    
    /* ========================================================================== */
    /*                          Function Declarations                             */
    /* ========================================================================== */
    
    static Void CanApp_TaskFxn(UArg a0, UArg a1);
    static void CanApp_Shutdown(void);
    
    /* ========================================================================== */
    /*                            Global Variables                                */
    /* ========================================================================== */
    /* application stack */
    static uint8_t CanApp_TaskStack[APP_TASK_STACK] __attribute__((aligned(32)));
    /**< Stack for the task */
    static canAppTaskObj_t  CanApp_TestPrms;
    /**< Test parameters */
    static HwiP_Handle      CanApp_IsrHndls[CAN_MAX_CONTROLLER];
    /**< Stores the ISR handles */
    extern SemaphoreP_Handle CanIf_TxConfirmationSemaphore;
    /**< TX Confirmation semaphore, would be posted when TX completes */
    extern SemaphoreP_Handle CanIf_RxConfirmationSemaphore;
    /**< Rx Confirmation semaphore, would be posted when TX completes */
    /* ========================================================================== */
    /*                            External Variables                              */
    /* ========================================================================== */
    extern uint32 CanIf_DrvStatus;
    /**< CAN IF Driver Status, defined in CanIf.c */
    
    /* ========================================================================== */
    /*                          Function Definitions                              */
    /* ========================================================================== */
    
    int main(void)
    {
        Task_Handle task;
        Error_Block eb;
        Task_Params taskParams;
    
    #ifdef UART_ENABLED
        AppUtils_Init();
            AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                    " ------------------AppUtils_Init done !!!\n");
    #endif
        CanApp_Startup();
            AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                    " CanApp_Startup done !!!\n");
        CanApp_PowerAndClkSrc();
            AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                    " CanApp_PowerAndClkSrc done !!!\n");
        /* Initialize dummy CAN IF */
        CanIf_Init(NULL);
            AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                    " CanIf_Init done !!!\n");
        if (CANIF_DRV_INITIALIZED == CanIf_DrvStatus)
        {
            Error_init(&eb);
            AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                    " Error_init done (aitronx)!!!\n");
            /* Initialize the task params */
            Task_Params_init(&taskParams);
            taskParams.instance->name = CAN_PROFILE_DEMO_TASK_NAME;
            /* Set the task priority higher than the default priority (1) */
            taskParams.priority     = 2;
            taskParams.stack        = CanApp_TaskStack;
            taskParams.stackSize    = sizeof (CanApp_TaskStack);
            AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                    " pre Task_create  (aitronx)!!!\n");
            task = Task_create(CanApp_TaskFxn, &taskParams, &eb);
    
            AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                    " Task_create done !!!\n");
            if(NULL == task)
            {
                BIOS_exit(0);
            }
            AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                    "pred BIOS_start  !!!\n");
    
            
            BIOS_start();    /* does not return */
        }
        else
        {
            AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                    " Error : CAN IF not initialized !!!\n");
        }
    
        return(0);
    }
    
    static Void CanApp_TaskFxn(UArg a0, UArg a1)
    {
            AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                    " Enter  CanApp_TaskFxn!!!\n");
        CanApp_PlatformInit();
            AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                    "   CanApp_PlatformInit done!!!\n");
        Utils_prfInit();
            AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                    " Utils_prfInit done!!!\n");
        Utils_prfLoadRegister (TaskP_self(), CAN_PROFILE_DEMO_TASK_NAME);
            AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                    " Utils_prfLoadRegister done!!!\n");
        CanApp_TestPrms.numTxPackets = APP_NUM_MSG_PER_ITERATION;
        CanApp_TestPrms.numIterations = APP_NUM_ITERATION;
    
            AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                    " Pre TaskP_yield !!!\n");
        TaskP_yield();
            AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                    "  TaskP_yield done!!!\n");
    
            AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                    "  pre CanApp_ProfileTest!!!\n");
        CanApp_ProfileTest(&CanApp_TestPrms);
            AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                    "  CanApp_ProfileTest done!!!\n");
        CanApp_Shutdown();
            AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                    "  CanApp_Shutdown done!!!\n");
        Utils_prfLoadUnRegister (TaskP_self());
            AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                    "  Utils_prfLoadUnRegister done!!!\n");
        Utils_prfDeInit();
            AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                    "  +++++++Utils_prfDeInit done!!!\n");
        return;
    }
    
    /** \brief Application tear down functions */
    static void CanApp_Shutdown(void)
    {
        uint32 idx;
            AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                    "  Enter CanApp_Shutdown!!!\n");
        for (idx = 0U; idx < CAN_MAX_CONTROLLER; idx++)
        {
            if (NULL != CanApp_IsrHndls[idx])
            {
                if (HwiP_OK != HwiP_delete(CanApp_IsrHndls[idx]))
                {
                    AppUtils_Printf(MSG_NORMAL, MSG_APP_NAME
                                    " Error!!! Could not De register"
                                    " the ISR for instance %d!!!\n", idx);
                    break;
                }
            }
        }
    
        if (NULL != CanIf_TxConfirmationSemaphore)
        {
            SemaphoreP_delete(CanIf_TxConfirmationSemaphore);
            if (NULL != CanIf_RxConfirmationSemaphore)
            {
                SemaphoreP_delete(CanIf_RxConfirmationSemaphore);
            }
        }
        return;
    }
    

  • Hi,

    I took both your files and tested on my setup and everything works fine. I use SD boot with SBL. See below logs:

    SBL Revision: 01.00.09.02 (Sep  7 2020 - 09:49:56)
    SYSFW  ver: 20.04.1-v2020.04a (Terrific Lla
    CAN Profile App: ------------------AppUtils_Init done !!!
    CAN Profile App:Variant - Pre Compile being used !!!
    CAN Profile App: Can_Init done !!!
    CAN Profile App: Sciclient_init done !!!
    CAN Profile App: CanApp_BuildIntList done !!!
    CAN Profile App: --------CanApp_InterruptConfig done !!!
    CAN Profile App: AppUtils_ProfileInit done !!!
    CAN Profile App: AppUtils_CanSectionInit done !!!
    CAN Profile App: CanApp_Startup done !!!
    CAN Profile App: CanApp_PowerAndClkSrc done !!!
    CAN Profile App: CanIf_Init done !!!
    CAN Profile App: Error_init done (aitronx)!!!
    CAN Profile App: pre Task_create  (aitronx)!!!
    CAN Profile App: Task_create done !!!
    CAN Profile App:pred BIOS_start  !!!
    CAN Profile App: Enter  CanApp_TaskFxn!!!
    CAN Profile App: Successfully Enabled CAN Transceiver MCU MCAN0!!!
    CAN Profile App: Successfully Enabled CAN Transceiver MCU MCAN1!!!
    CAN Profile App:   CanApp_PlatformInit done!!!
    CAN Profile App: Utils_prfInit done!!!
    CAN Profile App: Utils_prfLoadRegister done!!!
    CAN Profile App: Pre TaskP_yield !!!
    CAN Profile App:  TaskP_yield done!!!
    CAN Profile App:  pre CanApp_ProfileTest!!!
    CAN Profile App:Will Transmit & Receive (Internal-loopback) 10000 Messages, 2 times
    CAN Profile App:NOTE : Operating in interrupt mode!
    CAN Profile App:Transmit & Receive (Internal-loopback)  10000 packets 2 times
    CAN Profile App:Average of 86.16846 usecs per packet
    CAN Profile App:Average of 11571 packets in 1 second with CPU Load 5.103194%
    CAN Profile App:Packets sent: 20000, Packets recv: 20000 in total time: 3456846 us
    CAN Profile App:Measured Load: Total CPU: 5.103172%, HWI: 3.859122%, SWI:0.038748% TSK: 1.205325%
    CAN Profile App:Message Id Received 800000c0 Message Length is 64
    CAN Profile App:Test completed for 0 instance
    
    CAN Profile App: 8192 bytes used for stack
    CAN Profile App:Profiling completes sucessfully!!!
    CAN Profile App:  CanApp_ProfileTest done!!!
    CAN Profile App:  Enter CanApp_Shutdown!!!
    CAN Profile App:  CanApp_Shutdown done!!!
    CAN Profile App:  Utils_prfLoadUnRegister done!!!
    CAN Profile App:  +++++++Utils_prfDeInit done!!

    Please try with the attached binaries in the zip. /cfs-file/__key/communityserver-discussions-components-files/791/sd_5F00_card_5F00_boot_5F00_partition.zip

    Can you please give me your detailed steps and we can see where it went wrong.

    Regards,

    Karan

  • Hi. Karan

    Thanks for your help!
    with your mmc sbl, task[CanApp_TaskFxn] was able to be scheduled now .
    however, u-boot and linux hosted on A53 was not booting.

    Is there any way to run RTOS on Integrated MCU and Linux on A53 at the same time ?

  • Hi,

    If you are able to build and run on your setup then can you please resolve this issue and create a new one for the integrated use case? I will be glad to help you there.

    Regards,

    Karan

  • Hi.Karan

       I've created a new  case: https://e2e.ti.com/support/processors/f/791/t/941769