TI中文支持网
TI专业的中文技术问题搜集分享网站

TDA4VM: MCAL CAN发送一段报文后程序崩溃

Part Number:TDA4VM

您好,

    我根据MCAL CAN 例子上关掉了回环测试,来发送100ms/次报文,但每次报文发送到126帧时,代码稳定会跑飞程序崩溃,我用调试器单步调试也解决不了问题,

    请问有什么可能的原因或解决思路提供下么?万分火急十分感谢

Std_ReturnType CAN_transmit_msg(uint8 canHandle,uint32 id,uint8 lenth,uint8 *data)
{CanApp_Pdu.id= id ;CanApp_Pdu.length= lenth;CanApp_Pdu.swPduHandle  = 1U;CanApp_Pdu.sdu= data;uint8  hth = 0;uint32 mask = 0x00000000U;Std_ReturnType status;CanApp_SetupCanFrame(canHandle, &hth, &mask);status = Can_Write(hth, &CanApp_Pdu);while ((CanIf_TxConfirmationCount != 1U)){/* Wait for Tx Confirmation */}CanIf_TxConfirmationCount = 0;if (status != E_OK){AppUtils_Printf(MSG_NORMAL,"Error In Can_Write.\n");}return status;
}
static void CanApp_LoopbackTest(void)
{uint32ctlr_cnt, mask = 0x00000000U, canMaxControllerCnt;uint8loopCnt = 0U, hth = 0U;Std_ReturnTypestatus;const Can_ConfigType *Can_ConfigPtr;Can_ConfigPtr = &CanConfigSet;canMaxControllerCnt = Can_ConfigPtr->CanMaxControllerCount;for (ctlr_cnt = 0U; ctlr_cnt < canMaxControllerCnt;ctlr_cnt++){/* Set Can frame */CanApp_SetupCanFrame(ctlr_cnt, &hth, &mask);/* Set Controller Mode to Start */status = Can_SetControllerMode(CanConfigSet_CanController_List_PC[ctlr_cnt]->ControllerId, CAN_CS_STARTED);if (status != E_OK){CanApp_TestPassed = E_NOT_OK;}}
}
FLEXCAN_init();while (1){CAN_transmit_msg(0,0x550,7,test);Osal_delay(100);}
int FLEXCAN_init()
{CanApp_Startup();CanApp_PowerAndClkSrc();CanApp_PlatformInit();CanApp_LoopbackTest();CanApp_SafetyApiTest();return 0;
}

/*

*

* Copyright (c) 2019 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.

*

*//***************************************************************************Project: CAN_CONFIG_J721EDate: 2022-11-29 01:31:24This file is generated by EB TresosDo not modify this file, otherwise the software may behave in unexpected way.*****************************************************************************/





/********************************************************************************  INCLUDES******************************************************************************/

#include "Can.h"

#include "Can_Cfg.h"



/*Requirements : MCAL-2439, MCAL-2440, MCAL-2441 */



/*  Version checking  */

//  #if ((CAN_SW_MAJOR_VERSION != (3U))||(CAN_SW_MINOR_VERSION != (0U)))

//#error "Version numbers of Can_Cfg.c and Can.h are inconsistent!"

// #endif



/********************************************************************************  GLOBAL DATA******************************************************************************/

#define CAN_START_SEC_CONFIG_DATA

#include "Can_MemMap.h"



/* Baud Rate Structure for all configsets */

CAN_CONFIG_DATA_SECTION_NON_CONST static Can_BaudConfigTypeCanConfigSet_CanController_0_CanControllerBaudrateConfig_0 =

{500U,/* in Kbps */8U,/* Prop Segement value */7U,/* Phase Segment 1 */4U,/* Phase Segment 2 */2U, /* Sync jump width */19U,  /* Sum of all timing parameters  */8U,/* Controller BRP value for Baud *//* Data phase Baudrate */{5000U,/* in Kbps */1U,/* Prop Segement value */1U,/* Phase Segment 1 */1U,/* Phase Segment 2 */2U,  /* Sync jump width */5U,  /* Sum of all timing parameters  */4U,/* Controller BRP value for Baud */180U, /* Specifies the Transceiver Delay Compensation Offset in ns */(boolean)FALSE, /* Specifies if the bit rate switching shall be used */}

};

CAN_CONFIG_DATA_SECTION_NON_CONST static Can_BaudConfigTypeCanConfigSet_CanController_1_CanControllerBaudrateConfig_0 =

{500U,/* in Kbps */8U,/* Prop Segement value */7U,/* Phase Segment 1 */4U,/* Phase Segment 2 */2U, /* Sync jump width */19U,  /* Sum of all timing parameters  */8U,/* Controller BRP value for Baud *//* Data phase Baudrate */{500U,/* in Kbps */2U,/* Prop Segement value */2U,/* Phase Segment 1 */3U,/* Phase Segment 2 */1U,  /* Sync jump width */8U,  /* Sum of all timing parameters  */4U,/* Controller BRP value for Baud */180U, /* Specifies the Transceiver Delay Compensation Offset in ns */(boolean)FALSE, /* Specifies if the bit rate switching shall be used */}

};

CAN_CONFIG_DATA_SECTION_NON_CONST static Can_BaudConfigTypeCanConfigSet_CanController_2_CanControllerBaudrateConfig_0 =

{500U,/* in Kbps */8U,/* Prop Segement value */7U,/* Phase Segment 1 */4U,/* Phase Segment 2 */2U, /* Sync jump width */19U,  /* Sum of all timing parameters  */8U,/* Controller BRP value for Baud *//* Data phase Baudrate */{5000U,/* in Kbps */1U,/* Prop Segement value */1U,/* Phase Segment 1 */1U,/* Phase Segment 2 */2U,  /* Sync jump width */5U,  /* Sum of all timing parameters  */4U,/* Controller BRP value for Baud */180U, /* Specifies the Transceiver Delay Compensation Offset in ns */(boolean)FALSE, /* Specifies if the bit rate switching shall be used */}

};



/*List of the Baudrate structures */

CAN_CONFIG_DATA_SECTION_NON_CONST static Can_BaudConfigType*CanConfigSet_CanController_0_BaudRateConfigList[]=

{&CanConfigSet_CanController_0_CanControllerBaudrateConfig_0,

};



CAN_CONFIG_DATA_SECTION_NON_CONST static Can_BaudConfigType*CanConfigSet_CanController_1_BaudRateConfigList[]=

{&CanConfigSet_CanController_1_CanControllerBaudrateConfig_0,

};



CAN_CONFIG_DATA_SECTION_NON_CONST static Can_BaudConfigType*CanConfigSet_CanController_2_BaudRateConfigList[]=

{&CanConfigSet_CanController_2_CanControllerBaudrateConfig_0,

};





/* Controller structure defined here for all config sets */

CAN_CONFIG_DATA_SECTION_NON_CONST static Can_ControllerTypeCanConfigSet_CanController_0 =

{&CanConfigSet_CanController_0_CanControllerBaudrateConfig_0,  /* pointer to default Baud structure */CanConfigSet_CanController_0_BaudRateConfigList,  /* List of available Baudrate structs */

};

CAN_CONFIG_DATA_SECTION_NON_CONST static Can_ControllerTypeCanConfigSet_CanController_1 =

{&CanConfigSet_CanController_1_CanControllerBaudrateConfig_0,  /* pointer to default Baud structure */CanConfigSet_CanController_1_BaudRateConfigList,  /* List of available Baudrate structs */

};

CAN_CONFIG_DATA_SECTION_NON_CONST static Can_ControllerTypeCanConfigSet_CanController_2 =

{&CanConfigSet_CanController_2_CanControllerBaudrateConfig_0,  /* pointer to default Baud structure */CanConfigSet_CanController_2_BaudRateConfigList,  /* List of available Baudrate structs */

};





/* Controller structure defined here for all config sets */



CAN_CONFIG_DATA_SECTION_CONST const struct Can_ControllerStruct_PCCanConfigSet_PC_CanController_0 =

{CanConf_CanController_CanController_0,/* Id as provided by GUI */(boolean)TRUE,/* Contoller is used=1 or not_used=0*/0x40500000U, /* Can Controller Base Address */CAN_TX_RX_PROCESSING_INTERRUPT,  /* Can Rx Processing Type */CAN_TX_RX_PROCESSING_INTERRUPT,  /* Can Tx Processing Type */(boolean)TRUE,/* BusOff  TRUE = Interrupt FALSE = Polling */

	CAN_CONTROLLER_INSTANCE_MCU_MCAN0,  /* Controller Instance */





	(boolean)TRUE,  /* CAN FD Mode Enable */

};

CAN_CONFIG_DATA_SECTION_CONST const struct Can_ControllerStruct_PCCanConfigSet_PC_CanController_1 =

{CanConf_CanController_CanController_1,/* Id as provided by GUI */(boolean)TRUE,/* Contoller is used=1 or not_used=0*/0x40540000U, /* Can Controller Base Address */CAN_TX_RX_PROCESSING_INTERRUPT,  /* Can Rx Processing Type */CAN_TX_RX_PROCESSING_INTERRUPT,  /* Can Tx Processing Type */(boolean)TRUE,/* BusOff  TRUE = Interrupt FALSE = Polling */

	CAN_CONTROLLER_INSTANCE_MCU_MCAN1,  /* Controller Instance */





	(boolean)FALSE,  /* CAN FD Mode Enable */

};

CAN_CONFIG_DATA_SECTION_CONST const struct Can_ControllerStruct_PCCanConfigSet_PC_CanController_2 =

{CanConf_CanController_CanController_2,/* Id as provided by GUI */(boolean)TRUE,/* Contoller is used=1 or not_used=0*/0x2708000U, /* Can Controller Base Address */CAN_TX_RX_PROCESSING_INTERRUPT,  /* Can Rx Processing Type */CAN_TX_RX_PROCESSING_INTERRUPT,  /* Can Tx Processing Type */(boolean)TRUE,/* BusOff  TRUE = Interrupt FALSE = Polling */

	CAN_CONTROLLER_INSTANCE_MCAN0,  /* Controller Instance */





	(boolean)FALSE,  /* CAN FD Mode Enable */

};





/*List of the Controller structures */

CAN_CONFIG_DATA_SECTION_NON_CONST static Can_ControllerType*CanConfigSet_CanController_List[]=

{&CanConfigSet_CanController_0,&CanConfigSet_CanController_1,&CanConfigSet_CanController_2,

};



CAN_CONFIG_DATA_SECTION_CONST const struct Can_ControllerStruct_PC*CanConfigSet_CanController_List_PC[CAN_NUM_CONTROLLER]=

{&CanConfigSet_PC_CanController_0,&CanConfigSet_PC_CanController_1,&CanConfigSet_PC_CanController_2,

};



/* HW Filter structure for all configsets */

CAN_CONFIG_DATA_SECTION_NON_CONST static Can_HwFilterTypeCanConfigSet_CanHardwareObject_3_CanHwFilter_0 =

{177U,  /*CanHwFilterCode*/4294967295U,  /*Filter Mask*/

};

CAN_CONFIG_DATA_SECTION_NON_CONST static Can_HwFilterTypeCanConfigSet_CanHardwareObject_4_CanHwFilter_0 =

{176U,  /*CanHwFilterCode*/4294967295U,  /*Filter Mask*/

};

CAN_CONFIG_DATA_SECTION_NON_CONST static Can_HwFilterTypeCanConfigSet_CanHardwareObject_5_CanHwFilter_0 =

{160U,  /*CanHwFilterCode*/4294967295U,  /*Filter Mask*/

};

CAN_CONFIG_DATA_SECTION_NON_CONST static Can_HwFilterTypeCanConfigSet_CanHardwareObject_6_CanHwFilter_0 =

{193U,  /*CanHwFilterCode*/4294967295U,  /*Filter Mask*/

};

CAN_CONFIG_DATA_SECTION_NON_CONST static Can_HwFilterTypeCanConfigSet_CanHardwareObject_8_CanHwFilter_0 =

{192U,  /*CanHwFilterCode*/4294967295U,  /*Filter Mask*/

};



/*List of the HW Filter structures */

CAN_CONFIG_DATA_SECTION_NON_CONST static Can_HwFilterType*CanConfigSet_CanHardwareObject_3_HwFilterConfigList[]=

{&CanConfigSet_CanHardwareObject_3_CanHwFilter_0,

};

CAN_CONFIG_DATA_SECTION_NON_CONST static Can_HwFilterType*CanConfigSet_CanHardwareObject_4_HwFilterConfigList[]=

{&CanConfigSet_CanHardwareObject_4_CanHwFilter_0,

};

CAN_CONFIG_DATA_SECTION_NON_CONST static Can_HwFilterType*CanConfigSet_CanHardwareObject_5_HwFilterConfigList[]=

{&CanConfigSet_CanHardwareObject_5_CanHwFilter_0,

};

CAN_CONFIG_DATA_SECTION_NON_CONST static Can_HwFilterType*CanConfigSet_CanHardwareObject_6_HwFilterConfigList[]=

{&CanConfigSet_CanHardwareObject_6_CanHwFilter_0,

};

CAN_CONFIG_DATA_SECTION_NON_CONST static Can_HwFilterType*CanConfigSet_CanHardwareObject_8_HwFilterConfigList[]=

{&CanConfigSet_CanHardwareObject_8_CanHwFilter_0,

};





/* All the Mailbox objects(MB's) will be defined here for all config sets */





CAN_CONFIG_DATA_SECTION_NON_CONST static Can_MailboxTypeCanConfigSet_CanHardwareObject_0 =

{0U,  /*  CanHandleType 0=Full, 1=Basic */0U,  /* CanIdType 0=standard 1=Extended 2=Mixed*/

	0U,  /* HwHandle i.e Mailbox - Hw object in the controller */1U,/* Length of the Mailbox */CAN_MAILBOX_DIRECTION_TX,  /* CanObjectType - Direction of Mailbox*/&CanConfigSet_PC_CanController_0,  /* Controller */

	NULL_PTR,  /* List of HW Filter structs */0U,/* Hw Filter Count */204U,/* Padding value for CAN FD message */

	(boolean)FALSE,/* CanHardwareObjectUsesPolling */

};



CAN_CONFIG_DATA_SECTION_NON_CONST static Can_MailboxTypeCanConfigSet_CanHardwareObject_1 =

{0U,  /*  CanHandleType 0=Full, 1=Basic */1U,  /* CanIdType 0=standard 1=Extended 2=Mixed*/

	0U,  /* HwHandle i.e Mailbox - Hw object in the controller */3U,/* Length of the Mailbox */CAN_MAILBOX_DIRECTION_TX,  /* CanObjectType - Direction of Mailbox*/&CanConfigSet_PC_CanController_0,  /* Controller */

	NULL_PTR,  /* List of HW Filter structs */0U,/* Hw Filter Count */204U,/* Padding value for CAN FD message */

	(boolean)FALSE,/* CanHardwareObjectUsesPolling */

};



CAN_CONFIG_DATA_SECTION_NON_CONST static Can_MailboxTypeCanConfigSet_CanHardwareObject_2 =

{0U,  /*  CanHandleType 0=Full, 1=Basic */1U,  /* CanIdType 0=standard 1=Extended 2=Mixed*/

	0U,  /* HwHandle i.e Mailbox - Hw object in the controller */1U,/* Length of the Mailbox */CAN_MAILBOX_DIRECTION_TX,  /* CanObjectType - Direction of Mailbox*/&CanConfigSet_PC_CanController_1,  /* Controller */

	NULL_PTR,  /* List of HW Filter structs */0U,/* Hw Filter Count */204U,/* Padding value for CAN FD message */

	(boolean)FALSE,/* CanHardwareObjectUsesPolling */

};



CAN_CONFIG_DATA_SECTION_NON_CONST static Can_MailboxTypeCanConfigSet_CanHardwareObject_3 =

{0U,  /*  CanHandleType 0=Full, 1=Basic */0U,  /* CanIdType 0=standard 1=Extended 2=Mixed*/

	0U,  /* HwHandle i.e Mailbox - Hw object in the controller */1U,/* Length of the Mailbox */CAN_MAILBOX_DIRECTION_RX,  /* CanObjectType - Direction of Mailbox*/&CanConfigSet_PC_CanController_0,  /* Controller */CanConfigSet_CanHardwareObject_3_HwFilterConfigList,  /* List of HW Filter structs */1U, /* Hw Filter Count */0U,/* Padding value for CAN FD message */

	(boolean)FALSE,/* CanHardwareObjectUsesPolling */

};



CAN_CONFIG_DATA_SECTION_NON_CONST static Can_MailboxTypeCanConfigSet_CanHardwareObject_4 =

{0U,  /*  CanHandleType 0=Full, 1=Basic */1U,  /* CanIdType 0=standard 1=Extended 2=Mixed*/

	0U,  /* HwHandle i.e Mailbox - Hw object in the controller */1U,/* Length of the Mailbox */CAN_MAILBOX_DIRECTION_RX,  /* CanObjectType - Direction of Mailbox*/&CanConfigSet_PC_CanController_1,  /* Controller */CanConfigSet_CanHardwareObject_4_HwFilterConfigList,  /* List of HW Filter structs */1U, /* Hw Filter Count */0U,/* Padding value for CAN FD message */

	(boolean)FALSE,/* CanHardwareObjectUsesPolling */

};



CAN_CONFIG_DATA_SECTION_NON_CONST static Can_MailboxTypeCanConfigSet_CanHardwareObject_5 =

{0U,  /*  CanHandleType 0=Full, 1=Basic */0U,  /* CanIdType 0=standard 1=Extended 2=Mixed*/

	0U,  /* HwHandle i.e Mailbox - Hw object in the controller */3U,/* Length of the Mailbox */CAN_MAILBOX_DIRECTION_RX,  /* CanObjectType - Direction of Mailbox*/&CanConfigSet_PC_CanController_0,  /* Controller */CanConfigSet_CanHardwareObject_5_HwFilterConfigList,  /* List of HW Filter structs */1U, /* Hw Filter Count */0U,/* Padding value for CAN FD message */

	(boolean)FALSE,/* CanHardwareObjectUsesPolling */

};



CAN_CONFIG_DATA_SECTION_NON_CONST static Can_MailboxTypeCanConfigSet_CanHardwareObject_6 =

{0U,  /*  CanHandleType 0=Full, 1=Basic */0U,  /* CanIdType 0=standard 1=Extended 2=Mixed*/

	0U,  /* HwHandle i.e Mailbox - Hw object in the controller */2U,/* Length of the Mailbox */CAN_MAILBOX_DIRECTION_RX,  /* CanObjectType - Direction of Mailbox*/&CanConfigSet_PC_CanController_1,  /* Controller */CanConfigSet_CanHardwareObject_6_HwFilterConfigList,  /* List of HW Filter structs */1U, /* Hw Filter Count */0U,/* Padding value for CAN FD message */

	(boolean)FALSE,/* CanHardwareObjectUsesPolling */

};



CAN_CONFIG_DATA_SECTION_NON_CONST static Can_MailboxTypeCanConfigSet_CanHardwareObject_7 =

{0U,  /*  CanHandleType 0=Full, 1=Basic */0U,  /* CanIdType 0=standard 1=Extended 2=Mixed*/

	0U,  /* HwHandle i.e Mailbox - Hw object in the controller */1U,/* Length of the Mailbox */CAN_MAILBOX_DIRECTION_TX,  /* CanObjectType - Direction of Mailbox*/&CanConfigSet_PC_CanController_2,  /* Controller */

	NULL_PTR,  /* List of HW Filter structs */0U,/* Hw Filter Count */0U,/* Padding value for CAN FD message */

	(boolean)FALSE,/* CanHardwareObjectUsesPolling */

};



CAN_CONFIG_DATA_SECTION_NON_CONST static Can_MailboxTypeCanConfigSet_CanHardwareObject_8 =

{0U,  /*  CanHandleType 0=Full, 1=Basic */0U,  /* CanIdType 0=standard 1=Extended 2=Mixed*/

	0U,  /* HwHandle i.e Mailbox - Hw object in the controller */1U,/* Length of the Mailbox */CAN_MAILBOX_DIRECTION_RX,  /* CanObjectType - Direction of Mailbox*/&CanConfigSet_PC_CanController_2,  /* Controller */CanConfigSet_CanHardwareObject_8_HwFilterConfigList,  /* List of HW Filter structs */1U, /* Hw Filter Count */0U,/* Padding value for CAN FD message */

	(boolean)FALSE,/* CanHardwareObjectUsesPolling */

};





/* All the Mailbox objects(MB's) will be defined here for all config sets */

CAN_CONFIG_DATA_SECTION_CONST static const struct Can_MailboxStruct_PCCanConfigSet_PC_CanHardwareObject_0 =

{CanConf_CanHardwareObject_CanHardwareObject_0,  /* CanObjectId - Holds handle Id */

};

CAN_CONFIG_DATA_SECTION_CONST static const struct Can_MailboxStruct_PCCanConfigSet_PC_CanHardwareObject_1 =

{CanConf_CanHardwareObject_CanHardwareObject_1,  /* CanObjectId - Holds handle Id */

};

CAN_CONFIG_DATA_SECTION_CONST static const struct Can_MailboxStruct_PCCanConfigSet_PC_CanHardwareObject_2 =

{CanConf_CanHardwareObject_CanHardwareObject_2,  /* CanObjectId - Holds handle Id */

};

CAN_CONFIG_DATA_SECTION_CONST static const struct Can_MailboxStruct_PCCanConfigSet_PC_CanHardwareObject_3 =

{CanConf_CanHardwareObject_CanHardwareObject_3,  /* CanObjectId - Holds handle Id */

};

CAN_CONFIG_DATA_SECTION_CONST static const struct Can_MailboxStruct_PCCanConfigSet_PC_CanHardwareObject_4 =

{CanConf_CanHardwareObject_CanHardwareObject_4,  /* CanObjectId - Holds handle Id */

};

CAN_CONFIG_DATA_SECTION_CONST static const struct Can_MailboxStruct_PCCanConfigSet_PC_CanHardwareObject_5 =

{CanConf_CanHardwareObject_CanHardwareObject_5,  /* CanObjectId - Holds handle Id */

};

CAN_CONFIG_DATA_SECTION_CONST static const struct Can_MailboxStruct_PCCanConfigSet_PC_CanHardwareObject_6 =

{CanConf_CanHardwareObject_CanHardwareObject_6,  /* CanObjectId - Holds handle Id */

};

CAN_CONFIG_DATA_SECTION_CONST static const struct Can_MailboxStruct_PCCanConfigSet_PC_CanHardwareObject_7 =

{CanConf_CanHardwareObject_CanHardwareObject_7,  /* CanObjectId - Holds handle Id */

};

CAN_CONFIG_DATA_SECTION_CONST static const struct Can_MailboxStruct_PCCanConfigSet_PC_CanHardwareObject_8 =

{CanConf_CanHardwareObject_CanHardwareObject_8,  /* CanObjectId - Holds handle Id */

};



/* List of the Mailboxes */

CAN_CONFIG_DATA_SECTION_NON_CONST static Can_MailboxType*CanConfigSet_CanHardwareObject_List[] =

{&CanConfigSet_CanHardwareObject_0,&CanConfigSet_CanHardwareObject_1,&CanConfigSet_CanHardwareObject_2,&CanConfigSet_CanHardwareObject_3,&CanConfigSet_CanHardwareObject_4,&CanConfigSet_CanHardwareObject_5,&CanConfigSet_CanHardwareObject_6,&CanConfigSet_CanHardwareObject_7,&CanConfigSet_CanHardwareObject_8,

};



/* List of the Mailboxes */

CAN_CONFIG_DATA_SECTION_CONST const struct Can_MailboxStruct_PC*CanConfigSet_CanHardwareObject_List_PC[CAN_NUM_MAILBOXES] =

{&CanConfigSet_PC_CanHardwareObject_0,&CanConfigSet_PC_CanHardwareObject_1,&CanConfigSet_PC_CanHardwareObject_2,&CanConfigSet_PC_CanHardwareObject_3,&CanConfigSet_PC_CanHardwareObject_4,&CanConfigSet_PC_CanHardwareObject_5,&CanConfigSet_PC_CanHardwareObject_6,&CanConfigSet_PC_CanHardwareObject_7,&CanConfigSet_PC_CanHardwareObject_8,

};



/*Can Config struct */

CAN_CONFIG_DATA_SECTION_CONST const struct Can_ConfigType_s CanConfigSet =

{CanConfigSet_CanController_List, /* Controller List Pointer */(3U),  /* max Controllers */CanConfigSet_CanHardwareObject_List, /* Mailbox List Pointer */(9U),/* total number of mail boxes in this configset */.MaxBaudConfigID ={[0] = 0U,[1] = 0U,[2] = 0U}, /* Baud rate structure id */NULL_PTR,  /* Reserved Param used for future use */

};



CAN_VAR_CONST_32_SECTION extern CONST(uint32, CAN_CONST)Can_MsgmemRAMBaseAddr[CAN_MAX_CONTROLLER] =

{0x40500000U, /* MCU MCAN0 */0x40540000U, /* MCU MCAN1 */0x2708000U, /* Main MCAN0 */0x2718000U, /* Main MCAN1 */0x2728000U, /* Main MCAN2 */0x2738000U, /* Main MCAN3 */0x2748000U, /* Main MCAN4 */0x2758000U, /* Main MCAN5 */0x2768000U, /* Main MCAN6 */0x2778000U, /* Main MCAN7 */0x2788000U, /* Main MCAN8 */0x2798000U, /* Main MCAN9 */0x27a8000U, /* Main MCAN10 */0x27b8000U, /* Main MCAN11 */0x27c8000U, /* Main MCAN12 */0x27d8000U, /* Main MCAN13 */

};



CAN_VAR_CONST_32_SECTION extern CONST(uint32, CAN_CONST)Can_MCANSSBaseAddr[CAN_MAX_CONTROLLER] =

{0x40520000U, /* MCU_MCAN0_SS */0x40560000U, /* MCU_MCAN1_SS*/0x2700000U, /* MCAN0_SS */0x2710000U, /* MCAN1_SS*/0x2720000U, /* MCAN2_SS */0x2730000U, /* MCAN3_SS */0x2740000U, /* MCAN4_SS */0x2750000U, /* MCAN5_SS */0x2760000U, /* MCAN6_SS */0x2770000U, /* MCAN7_SS */0x2780000U, /* MCAN8_SS*/0x2790000U, /* MCAN9_SS*/0x27a0000U, /* MCAN10_SS */0x27b0000U, /* MCAN11_SS */0x27c0000U, /* MCAN12_SS*/0x27d0000U, /* MCAN13_SS */

};



CAN_VAR_CONST_32_SECTION extern CONST(uint32, CAN_CONST)Can_MCANCoreRegBaseAddr[CAN_MAX_CONTROLLER] =

{0x40528000U, /* MCU_MCAN0_CFG */0x40568000U, /* MCU_MCAN1_CFG*/0x2701000U, /* MCAN0_CFG */0x2711000U, /* MCAN1_CFG*/0x2721000U, /* MCAN2_CFG */0x2731000U, /* MCAN3_CFG */0x2741000U, /* MCAN4_CFG */0x2751000U, /* MCAN5_CFG */0x2761000U, /* MCAN6_CFG */0x2771000U, /* MCAN7_CFG */0x2781000U, /* MCAN8_CFG*/0x2791000U, /* MCAN9_CFG*/0x27a1000U, /* MCAN10_CFG */0x27b1000U, /* MCAN11_CFG */0x27c1000U, /* MCAN12_CFG*/0x27d1000U, /* MCAN13_CFG */

};



CAN_VAR_CONST_32_SECTION extern CONST(uint32, CAN_CONST)Can_MCANECCAggrRegBaseAddr[CAN_MAX_CONTROLLER] =

{0x40700000U, /* MCU_MCAN0_ECC_AGGR */0x40701000U, /* MCU_MCAN1_ECC_AGGR*/0x2A78000U, /* MCAN0_ECC_AGGR */0x2A79000U, /* MCAN1_ECC_AGGR */0x2A7A000U, /* MCAN2_ECC_AGGR*/0x2A7B000U, /* MCAN3_ECC_AGGR */0x2A7C000U, /* MCAN4_ECC_AGGR */0x2A7D000U, /* MCAN5_ECC_AGGR */0x2A7E000U, /* MCAN6_ECC_AGGR */0x2A7F000U, /* MCAN7_ECC_AGGR */0x2A40000U, /* MCAN8_ECC_AGGR */0x2A41000U, /* MCAN9_ECC_AGGR*/0x2A42000U, /* MCAN10_ECC_AGGR*/0x2A43000U, /* MCAN11_ECC_AGGR */0x2A44000U, /* MCAN12_ECC_AGGR */0x2A45000U, /* MCAN13_ECC_AGGR*/

};



#define  CAN_STOP_SEC_CONFIG_DATA

#include "Can_MemMap.h"



/* ========================================================================== */

/*Function Definitions*/

/* ========================================================================== */

#define CAN_START_SEC_ISR_CODE

#include "Can_MemMap.h"



/** \brief MCU_MCAN0 Controller Instance ISR */

FUNC(void, CAN_CODE) Can_0_Int0ISR(void)

{

Can_IntISR_Function(CAN_CONTROLLER_INSTANCE_MCU_MCAN0, 0x40500000U);

}



/** \brief MCU_MCAN1 Controller Instance ISR */

FUNC(void, CAN_CODE) Can_1_Int0ISR(void)

{

Can_IntISR_Function(CAN_CONTROLLER_INSTANCE_MCU_MCAN1, 0x40540000U);

}



/** \brief MCAN0 Controller Instance ISR */

FUNC(void, CAN_CODE) Can_2_Int0ISR(void)

{

Can_IntISR_Function(CAN_CONTROLLER_INSTANCE_MCAN0, 0x2708000U);

}





#define CAN_STOP_SEC_ISR_CODE

#include "Can_MemMap.h"



/********************************************************************************  End of File: Can_Cfg.c******************************************************************************/

Cherry Zhou:

Hi,

您的问题我们需要升级到英文论坛寻求帮助,链接如下,有答复尽快给到您:

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1286766/tda4vm-mcal-can-program-cannot-function-after-transmitting-a-message

,

maxuezhao ma:

void CanIf_TxConfirmation(PduIdType CanTxPduId)
{CanIf_TxConfirmationCount++;CanIf_CanTxPduId = CanTxPduId;CanIf_GblTxPduIdStore[CanIf_TxCounter++] = CanIf_CanTxPduId;
}

我找到问题原因了。在canlf的发送回调里有一个 CanIf_GblTxPduIdStore 数组越界,这个数组没有被SDK的任何地方引用或清除,我觉得这比较容易误导使用者,很不合理

,

Cherry Zhou:

您好,

感谢您的反馈,我们看到您在英文论坛中正在跟进该问题,您可以等待下工程师的更新(由于这几天是国外的假期,可能会延迟给到您答复)。

如果有其他问题您可以随时reopen该贴。

赞(0)
未经允许不得转载:TI中文支持网 » TDA4VM: MCAL CAN发送一段报文后程序崩溃
分享到: 更多 (0)