1.运行核(Operating core):mcu1_0
2.通过EB配置的文件Can_Cfg.h(files generated by EB):
#ifndef CAN_CFG_H_ #define CAN_CFG_H_ #include "Dem.h" #ifdef __cplusplus extern "C" { #endif /** * \brief CAN Build Variant. * Build variants.(i.e Pre Compile,Post Build) */ #define CAN_VARIANT_PRE_COMPILE (STD_ON) /** * \name Can Driver Configuration SW Version Info * * Pre-compile switches for enabling/disabling CAN MCAL APIs * @{ */ #define CAN_VERSION_INFO_API (STD_ON) /*!< Enable/Disable Can_GetVersionInfo() */ #define CAN_DEV_ERROR_DETECT (STD_ON) /*!< Enable/Disable DEV error detection */ #define CAN_SAFETY_DIAGNOSTIC (STD_ON) /*!< Enable/Disable Can Safety Diagnostic */ //#define CAN_LOOPBACK_ENABLE (STD_ON) #define CAN_LOOPBACK_ENABLE (STD_OFF) /*!< Enable/Disable Can_TestLoopBackModeEnable() */ #define CAN_REGISTER_READBACK_API (STD_ON) /*!< Enable/Disable Can_ConfigRegReadBack() */ #define CAN_WAKEUP_FUNCTIONALITY_API (STD_OFF) /*!< Enable/Disable Can_CheckWakeup() */ #define CAN_MULTIPLEXED_TRANSMISSION_ENABLE (STD_ON) /*!< Enable/Disable Multiplexed Transmission */ /** * \brief Pre Compile config macro name. */ #define CAN_INIT_CONFIG_PC CanConfigSet /* * Design: MCAL-6116 */ #define CAN_TX_POLLING (STD_OFF) /*!< Enable/Disable Can_MainFunction_Write */ #define CAN_RX_POLLING (STD_OFF) /*!< Enable/Disable Can_MainFunction_Read */ #define CAN_BUSOFF_POLLING (STD_OFF) /*!< Enable/Disable Can_MainFunction_BusOff */ #define CAN_WAKEUP_POLLING (STD_OFF) /*!< Enable/Disable Can_MainFunction_Wakeup */ /* @} */ #define CAN_NUM_CONTROLLER (10U) /*!< Number of controllers defined*/ #define CAN_NUM_MAILBOXES (10U) /*!< Number of mailboxes defined*/ /*!< Max number of controller instances per SOC */ #define CAN_MAX_CONTROLLER (20U) #define CAN_MAX_MAILBOXES (64U) /*!< Max number of mailboxes per controller */ #define CAN_ISR_TYPE (CAN_ISR_CAT1) /*!< OSEK Category 1 ISR Type */ #define CLK_CAN_FD_FREQ (80U) /*!< Clock source frequency CAN FD */ /** * \name Can Controller Id names * * Defines for symbolic names for the CanControllerIds * @{ */ #define CanConf_CanController_CanController_0 (0U) #define CanConf_CanController_CanController_1 (1U) #define CanConf_CanController_CanController_2 (2U) #define CanConf_CanController_CanController_3 (3U) #define CanConf_CanController_CanController_4 (4U) #define CanConf_CanController_CanController_5 (5U) #define CanConf_CanController_CanController_6 (6U) #define CanConf_CanController_CanController_7 (7U) #define CanConf_CanController_CanController_8 (8U) #define CanConf_CanController_CanController_9 (9U) /* @} */ /* @} */ #define CAN_CONTROLLER_MCU_MCAN0 /*!< MCU_MCAN0 CONTROLLER INSTANCE */ #define CAN_CONTROLLER_MCAN1 /*!< MCAN1 CONTROLLER INSTANCE */ #define CAN_CONTROLLER_MCU_MCAN1 /*!< MCU_MCAN1 CONTROLLER INSTANCE */ #define CAN_CONTROLLER_MCAN10 /*!< MCAN10 CONTROLLER INSTANCE */ #define CAN_CONTROLLER_MCAN3 /*!< MCAN3 CONTROLLER INSTANCE */ #define CAN_CONTROLLER_MCAN4 /*!< MCAN4 CONTROLLER INSTANCE */ #define CAN_CONTROLLER_MCAN11 /*!< MCAN11 CONTROLLER INSTANCE */ #define CAN_CONTROLLER_MCAN12 /*!< MCAN12 CONTROLLER INSTANCE */ #define CAN_CONTROLLER_MCAN14 /*!< MCAN14 CONTROLLER INSTANCE */ #define CAN_CONTROLLER_MCAN16 /*!< MCAN16 CONTROLLER INSTANCE */ /** \brief MCAN16 Controller Instance ISR */ FUNC(void, CAN_CODE) Can_18_Int0ISR(void); #ifdef __cplusplus } #endif #endif /*CAN_CFG_H__*/
Can_Cfg.c:
/* * * Copyright (c) 2023 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: IDC_V1_EB24_Prj Date : 2023-12-08 10:14:21 This file is generated by EB Tresos Do not modify this file, otherwise the software may behave in unexpected way. *****************************************************************************/ /******************************************************************************* * INCLUDES ******************************************************************************/ #include "Can.h" #include "Can_Cfg.h" /* * Design: MCAL-6077,MCAL-6079,MCAL-5907 */ /* Version checking */ #if ((CAN_SW_MAJOR_VERSION != (9U))||(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 */ static Can_BaudConfigType CanConfigSet_CanController_0_CanControllerBaudrateConfig_0 = { 500U, /* in Kbps */ 4U, /* Prop Segement value */ 8U, /* Phase Segment 1 */ 3U, /* Phase Segment 2 */ 3U, /* Sync jump width */ 18U, /* Sum of all timing parameters */ 10U, /* Controller BRP value for Baud */ /* Data phase Baudrate */ { 2000U, /* in Kbps */ 6U, /* Prop Segement value */ 8U, /* Phase Segment 1 */ 5U, /* Phase Segment 2 */ 1U, /* Sync jump width */ 20U, /* Sum of all timing parameters */ 2U, /* Controller BRP value for Baud */ 180U, /* Specifies the Transceiver Delay Compensation Offset in ns */ (boolean)TRUE, /* Specifies if the bit rate switching shall be used */ } }; static Can_BaudConfigType CanConfigSet_CanController_1_CanControllerBaudrateConfig_0 = { 500U, /* in Kbps */ 4U, /* Prop Segement value */ 8U, /* Phase Segment 1 */ 3U, /* Phase Segment 2 */ 3U, /* Sync jump width */ 18U, /* Sum of all timing parameters */ 10U, /* Controller BRP value for Baud */ /* Data phase Baudrate */ { 2000U, /* in Kbps */ 6U, /* Prop Segement value */ 8U, /* Phase Segment 1 */ 5U, /* Phase Segment 2 */ 1U, /* Sync jump width */ 20U, /* Sum of all timing parameters */ 2U, /* Controller BRP value for Baud */ 180U, /* Specifies the Transceiver Delay Compensation Offset in ns */ (boolean)TRUE, /* Specifies if the bit rate switching shall be used */ } }; static Can_BaudConfigType CanConfigSet_CanController_2_CanControllerBaudrateConfig_0 = { 500U, /* in Kbps */ 4U, /* Prop Segement value */ 8U, /* Phase Segment 1 */ 3U, /* Phase Segment 2 */ 3U, /* Sync jump width */ 18U, /* Sum of all timing parameters */ 10U, /* Controller BRP value for Baud */ /* Data phase Baudrate */ { 2000U, /* in Kbps */ 6U, /* Prop Segement value */ 8U, /* Phase Segment 1 */ 5U, /* Phase Segment 2 */ 1U, /* Sync jump width */ 20U, /* Sum of all timing parameters */ 2U, /* Controller BRP value for Baud */ 180U, /* Specifies the Transceiver Delay Compensation Offset in ns */ (boolean)TRUE, /* Specifies if the bit rate switching shall be used */ } }; static Can_BaudConfigType CanConfigSet_CanController_3_CanControllerBaudrateConfig_0 = { 500U, /* in Kbps */ 4U, /* Prop Segement value */ 8U, /* Phase Segment 1 */ 3U, /* Phase Segment 2 */ 3U, /* Sync jump width */ 18U, /* Sum of all timing parameters */ 10U, /* Controller BRP value for Baud */ /* Data phase Baudrate */ { 2000U, /* in Kbps */ 6U, /* Prop Segement value */ 8U, /* Phase Segment 1 */ 5U, /* Phase Segment 2 */ 1U, /* Sync jump width */ 20U, /* Sum of all timing parameters */ 2U, /* Controller BRP value for Baud */ 180U, /* Specifies the Transceiver Delay Compensation Offset in ns */ (boolean)TRUE, /* Specifies if the bit rate switching shall be used */ } }; static Can_BaudConfigType CanConfigSet_CanController_4_CanControllerBaudrateConfig_0 = { 500U, /* in Kbps */ 4U, /* Prop Segement value */ 8U, /* Phase Segment 1 */ 3U, /* Phase Segment 2 */ 3U, /* Sync jump width */ 18U, /* Sum of all timing parameters */ 10U, /* Controller BRP value for Baud */ /* Data phase Baudrate */ { 2000U, /* in Kbps */ 6U, /* Prop Segement value */ 8U, /* Phase Segment 1 */ 5U, /* Phase Segment 2 */ 1U, /* Sync jump width */ 20U, /* Sum of all timing parameters */ 2U, /* Controller BRP value for Baud */ 180U, /* Specifies the Transceiver Delay Compensation Offset in ns */ (boolean)TRUE, /* Specifies if the bit rate switching shall be used */ } }; static Can_BaudConfigType CanConfigSet_CanController_5_CanControllerBaudrateConfig_0 = { 500U, /* in Kbps */ 4U, /* Prop Segement value */ 8U, /* Phase Segment 1 */ 3U, /* Phase Segment 2 */ 3U, /* Sync jump width */ 18U, /* Sum of all timing parameters */ 10U, /* Controller BRP value for Baud */ /* Data phase Baudrate */ { 2000U, /* in Kbps */ 6U, /* Prop Segement value */ 8U, /* Phase Segment 1 */ 5U, /* Phase Segment 2 */ 1U, /* Sync jump width */ 20U, /* Sum of all timing parameters */ 2U, /* Controller BRP value for Baud */ 180U, /* Specifies the Transceiver Delay Compensation Offset in ns */ (boolean)TRUE, /* Specifies if the bit rate switching shall be used */ } }; static Can_BaudConfigType CanConfigSet_CanController_6_CanControllerBaudrateConfig_0 = { 500U, /* in Kbps */ 4U, /* Prop Segement value */ 8U, /* Phase Segment 1 */ 3U, /* Phase Segment 2 */ 3U, /* Sync jump width */ 18U, /* Sum of all timing parameters */ 10U, /* Controller BRP value for Baud */ /* Data phase Baudrate */ { 2000U, /* in Kbps */ 6U, /* Prop Segement value */ 8U, /* Phase Segment 1 */ 5U, /* Phase Segment 2 */ 1U, /* Sync jump width */ 20U, /* Sum of all timing parameters */ 2U, /* Controller BRP value for Baud */ 180U, /* Specifies the Transceiver Delay Compensation Offset in ns */ (boolean)TRUE, /* Specifies if the bit rate switching shall be used */ } }; static Can_BaudConfigType CanConfigSet_CanController_7_CanControllerBaudrateConfig_0 = { 500U, /* in Kbps */ 4U, /* Prop Segement value */ 8U, /* Phase Segment 1 */ 3U, /* Phase Segment 2 */ 3U, /* Sync jump width */ 18U, /* Sum of all timing parameters */ 10U, /* Controller BRP value for Baud */ /* Data phase Baudrate */ { 2000U, /* in Kbps */ 6U, /* Prop Segement value */ 8U, /* Phase Segment 1 */ 5U, /* Phase Segment 2 */ 1U, /* Sync jump width */ 20U, /* Sum of all timing parameters */ 2U, /* Controller BRP value for Baud */ 180U, /* Specifies the Transceiver Delay Compensation Offset in ns */ (boolean)TRUE, /* Specifies if the bit rate switching shall be used */ } }; static Can_BaudConfigType CanConfigSet_CanController_8_CanControllerBaudrateConfig_0 = { 500U, /* in Kbps */ 4U, /* Prop Segement value */ 8U, /* Phase Segment 1 */ 3U, /* Phase Segment 2 */ 3U, /* Sync jump width */ 18U, /* Sum of all timing parameters */ 10U, /* Controller BRP value for Baud */ /* Data phase Baudrate */ { 2000U, /* in Kbps */ 6U, /* Prop Segement value */ 8U, /* Phase Segment 1 */ 5U, /* Phase Segment 2 */ 1U, /* Sync jump width */ 20U, /* Sum of all timing parameters */ 2U, /* Controller BRP value for Baud */ 180U, /* Specifies the Transceiver Delay Compensation Offset in ns */ (boolean)TRUE, /* Specifies if the bit rate switching shall be used */ } }; static Can_BaudConfigType CanConfigSet_CanController_9_CanControllerBaudrateConfig_0 = { 500U, /* in Kbps */ 4U, /* Prop Segement value */ 8U, /* Phase Segment 1 */ 3U, /* Phase Segment 2 */ 3U, /* Sync jump width */ 18U, /* Sum of all timing parameters */ 10U, /* Controller BRP value for Baud */ /* Data phase Baudrate */ { 2000U, /* in Kbps */ 6U, /* Prop Segement value */ 8U, /* Phase Segment 1 */ 5U, /* Phase Segment 2 */ 1U, /* Sync jump width */ 20U, /* Sum of all timing parameters */ 2U, /* Controller BRP value for Baud */ 180U, /* Specifies the Transceiver Delay Compensation Offset in ns */ (boolean)TRUE, /* Specifies if the bit rate switching shall be used */ } }; /*List of the Baudrate structures */ static Can_BaudConfigType *CanConfigSet_CanController_0_BaudRateConfigList[]= { &CanConfigSet_CanController_0_CanControllerBaudrateConfig_0, }; static Can_BaudConfigType *CanConfigSet_CanController_1_BaudRateConfigList[]= { &CanConfigSet_CanController_1_CanControllerBaudrateConfig_0, }; static Can_BaudConfigType *CanConfigSet_CanController_2_BaudRateConfigList[]= { &CanConfigSet_CanController_2_CanControllerBaudrateConfig_0, }; static Can_BaudConfigType *CanConfigSet_CanController_3_BaudRateConfigList[]= { &CanConfigSet_CanController_3_CanControllerBaudrateConfig_0, }; static Can_BaudConfigType *CanConfigSet_CanController_4_BaudRateConfigList[]= { &CanConfigSet_CanController_4_CanControllerBaudrateConfig_0, }; static Can_BaudConfigType *CanConfigSet_CanController_5_BaudRateConfigList[]= { &CanConfigSet_CanController_5_CanControllerBaudrateConfig_0, }; static Can_BaudConfigType *CanConfigSet_CanController_6_BaudRateConfigList[]= { &CanConfigSet_CanController_6_CanControllerBaudrateConfig_0, }; static Can_BaudConfigType *CanConfigSet_CanController_7_BaudRateConfigList[]= { &CanConfigSet_CanController_7_CanControllerBaudrateConfig_0, }; static Can_BaudConfigType *CanConfigSet_CanController_8_BaudRateConfigList[]= { &CanConfigSet_CanController_8_CanControllerBaudrateConfig_0, }; static Can_BaudConfigType *CanConfigSet_CanController_9_BaudRateConfigList[]= { &CanConfigSet_CanController_9_CanControllerBaudrateConfig_0, }; /* Controller structure defined here for all config sets */ static Can_ControllerType CanConfigSet_CanController_0 = { &CanConfigSet_CanController_0_CanControllerBaudrateConfig_0, /* pointer to default Baud structure */ CanConfigSet_CanController_0_BaudRateConfigList, /* List of available Baudrate structs */ }; static Can_ControllerType CanConfigSet_CanController_1 = { &CanConfigSet_CanController_1_CanControllerBaudrateConfig_0, /* pointer to default Baud structure */ CanConfigSet_CanController_1_BaudRateConfigList, /* List of available Baudrate structs */ }; static Can_ControllerType CanConfigSet_CanController_2 = { &CanConfigSet_CanController_2_CanControllerBaudrateConfig_0, /* pointer to default Baud structure */ CanConfigSet_CanController_2_BaudRateConfigList, /* List of available Baudrate structs */ }; static Can_ControllerType CanConfigSet_CanController_3 = { &CanConfigSet_CanController_3_CanControllerBaudrateConfig_0, /* pointer to default Baud structure */ CanConfigSet_CanController_3_BaudRateConfigList, /* List of available Baudrate structs */ }; static Can_ControllerType CanConfigSet_CanController_4 = { &CanConfigSet_CanController_4_CanControllerBaudrateConfig_0, /* pointer to default Baud structure */ CanConfigSet_CanController_4_BaudRateConfigList, /* List of available Baudrate structs */ }; static Can_ControllerType CanConfigSet_CanController_5 = { &CanConfigSet_CanController_5_CanControllerBaudrateConfig_0, /* pointer to default Baud structure */ CanConfigSet_CanController_5_BaudRateConfigList, /* List of available Baudrate structs */ }; static Can_ControllerType CanConfigSet_CanController_6 = { &CanConfigSet_CanController_6_CanControllerBaudrateConfig_0, /* pointer to default Baud structure */ CanConfigSet_CanController_6_BaudRateConfigList, /* List of available Baudrate structs */ }; static Can_ControllerType CanConfigSet_CanController_7 = { &CanConfigSet_CanController_7_CanControllerBaudrateConfig_0, /* pointer to default Baud structure */ CanConfigSet_CanController_7_BaudRateConfigList, /* List of available Baudrate structs */ }; static Can_ControllerType CanConfigSet_CanController_8 = { &CanConfigSet_CanController_8_CanControllerBaudrateConfig_0, /* pointer to default Baud structure */ CanConfigSet_CanController_8_BaudRateConfigList, /* List of available Baudrate structs */ }; static Can_ControllerType CanConfigSet_CanController_9 = { &CanConfigSet_CanController_9_CanControllerBaudrateConfig_0, /* pointer to default Baud structure */ CanConfigSet_CanController_9_BaudRateConfigList, /* List of available Baudrate structs */ }; /* Controller structure defined here for all config sets */ const struct Can_ControllerStruct_PC CanConfigSet_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 */ }; const struct Can_ControllerStruct_PC CanConfigSet_PC_CanController_1 = { CanConf_CanController_CanController_1, /* Id as provided by GUI */ (boolean)TRUE, /* Contoller is used=1 or not_used=0*/ 0x2718000U, /* 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_MCAN1, /* Controller Instance */ (boolean)TRUE, /* CAN FD Mode Enable */ }; const struct Can_ControllerStruct_PC CanConfigSet_PC_CanController_2 = { CanConf_CanController_CanController_2, /* 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)TRUE, /* CAN FD Mode Enable */ }; const struct Can_ControllerStruct_PC CanConfigSet_PC_CanController_3 = { CanConf_CanController_CanController_3, /* Id as provided by GUI */ (boolean)TRUE, /* Contoller is used=1 or not_used=0*/ 0x27a8000U, /* 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_MCAN10, /* Controller Instance */ (boolean)TRUE, /* CAN FD Mode Enable */ }; const struct Can_ControllerStruct_PC CanConfigSet_PC_CanController_4 = { CanConf_CanController_CanController_4, /* Id as provided by GUI */ (boolean)TRUE, /* Contoller is used=1 or not_used=0*/ 0x2738000U, /* 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_MCAN3, /* Controller Instance */ (boolean)TRUE, /* CAN FD Mode Enable */ }; const struct Can_ControllerStruct_PC CanConfigSet_PC_CanController_5 = { CanConf_CanController_CanController_5, /* Id as provided by GUI */ (boolean)TRUE, /* Contoller is used=1 or not_used=0*/ 0x2748000U, /* 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_MCAN4, /* Controller Instance */ (boolean)TRUE, /* CAN FD Mode Enable */ }; const struct Can_ControllerStruct_PC CanConfigSet_PC_CanController_6 = { CanConf_CanController_CanController_6, /* Id as provided by GUI */ (boolean)TRUE, /* Contoller is used=1 or not_used=0*/ 0x27b8000U, /* 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_MCAN11, /* Controller Instance */ (boolean)TRUE, /* CAN FD Mode Enable */ }; const struct Can_ControllerStruct_PC CanConfigSet_PC_CanController_7 = { CanConf_CanController_CanController_7, /* Id as provided by GUI */ (boolean)TRUE, /* Contoller is used=1 or not_used=0*/ 0x27c8000U, /* 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_MCAN12, /* Controller Instance */ (boolean)TRUE, /* CAN FD Mode Enable */ }; const struct Can_ControllerStruct_PC CanConfigSet_PC_CanController_8 = { CanConf_CanController_CanController_8, /* Id as provided by GUI */ (boolean)TRUE, /* Contoller is used=1 or not_used=0*/ 0x2688000U, /* 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_MCAN14, /* Controller Instance */ (boolean)TRUE, /* CAN FD Mode Enable */ }; const struct Can_ControllerStruct_PC CanConfigSet_PC_CanController_9 = { CanConf_CanController_CanController_9, /* Id as provided by GUI */ (boolean)TRUE, /* Contoller is used=1 or not_used=0*/ 0x26a8000U, /* 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_MCAN16, /* Controller Instance */ (boolean)TRUE, /* CAN FD Mode Enable */ }; /*List of the Controller structures */ static Can_ControllerType *CanConfigSet_CanController_List[]= { &CanConfigSet_CanController_0, &CanConfigSet_CanController_1, &CanConfigSet_CanController_2, &CanConfigSet_CanController_3, &CanConfigSet_CanController_4, &CanConfigSet_CanController_5, &CanConfigSet_CanController_6, &CanConfigSet_CanController_7, &CanConfigSet_CanController_8, &CanConfigSet_CanController_9, }; const struct Can_ControllerStruct_PC *CanConfigSet_CanController_List_PC[CAN_NUM_CONTROLLER]= { &CanConfigSet_PC_CanController_0, &CanConfigSet_PC_CanController_1, &CanConfigSet_PC_CanController_2, &CanConfigSet_PC_CanController_3, &CanConfigSet_PC_CanController_4, &CanConfigSet_PC_CanController_5, &CanConfigSet_PC_CanController_6, &CanConfigSet_PC_CanController_7, &CanConfigSet_PC_CanController_8, &CanConfigSet_PC_CanController_9, }; /* HW Filter structure for all configsets */ /*List of the HW Filter structures */ /* All the Mailbox objects(MB's) will be defined here for all config sets */ static Can_MailboxType CanConfigSet_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 */ }; static Can_MailboxType CanConfigSet_CanHardwareObject_1 = { 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_1, /* Controller */ NULL_PTR, /* List of HW Filter structs */ 0U, /* Hw Filter Count */ 204U, /* Padding value for CAN FD message */ (boolean)FALSE, /* CanHardwareObjectUsesPolling */ }; static Can_MailboxType CanConfigSet_CanHardwareObject_2 = { 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 */ 204U, /* Padding value for CAN FD message */ (boolean)FALSE, /* CanHardwareObjectUsesPolling */ }; static Can_MailboxType CanConfigSet_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_TX, /* CanObjectType - Direction of Mailbox*/ &CanConfigSet_PC_CanController_3, /* Controller */ NULL_PTR, /* List of HW Filter structs */ 0U, /* Hw Filter Count */ 204U, /* Padding value for CAN FD message */ (boolean)FALSE, /* CanHardwareObjectUsesPolling */ }; static Can_MailboxType CanConfigSet_CanHardwareObject_4 = { 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_4, /* Controller */ NULL_PTR, /* List of HW Filter structs */ 0U, /* Hw Filter Count */ 204U, /* Padding value for CAN FD message */ (boolean)FALSE, /* CanHardwareObjectUsesPolling */ }; static Can_MailboxType CanConfigSet_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 */ 1U, /* Length of the Mailbox */ CAN_MAILBOX_DIRECTION_TX, /* CanObjectType - Direction of Mailbox*/ &CanConfigSet_PC_CanController_5, /* Controller */ NULL_PTR, /* List of HW Filter structs */ 0U, /* Hw Filter Count */ 204U, /* Padding value for CAN FD message */ (boolean)FALSE, /* CanHardwareObjectUsesPolling */ }; static Can_MailboxType CanConfigSet_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 */ 1U, /* Length of the Mailbox */ CAN_MAILBOX_DIRECTION_TX, /* CanObjectType - Direction of Mailbox*/ &CanConfigSet_PC_CanController_6, /* Controller */ NULL_PTR, /* List of HW Filter structs */ 0U, /* Hw Filter Count */ 204U, /* Padding value for CAN FD message */ (boolean)FALSE, /* CanHardwareObjectUsesPolling */ }; static Can_MailboxType CanConfigSet_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_7, /* Controller */ NULL_PTR, /* List of HW Filter structs */ 0U, /* Hw Filter Count */ 204U, /* Padding value for CAN FD message */ (boolean)FALSE, /* CanHardwareObjectUsesPolling */ }; static Can_MailboxType CanConfigSet_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_TX, /* CanObjectType - Direction of Mailbox*/ &CanConfigSet_PC_CanController_8, /* Controller */ NULL_PTR, /* List of HW Filter structs */ 0U, /* Hw Filter Count */ 204U, /* Padding value for CAN FD message */ (boolean)FALSE, /* CanHardwareObjectUsesPolling */ }; static Can_MailboxType CanConfigSet_CanHardwareObject_9 = { 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_9, /* Controller */ NULL_PTR, /* List of HW Filter structs */ 0U, /* Hw Filter Count */ 204U, /* Padding value for CAN FD message */ (boolean)FALSE, /* CanHardwareObjectUsesPolling */ }; /* All the Mailbox objects(MB's) will be defined here for all config sets */ static const struct Can_MailboxStruct_PC CanConfigSet_PC_CanHardwareObject_0 = { CanConf_CanHardwareObject_CanHardwareObject_0, /* CanObjectId - Holds handle Id */ }; static const struct Can_MailboxStruct_PC CanConfigSet_PC_CanHardwareObject_1 = { CanConf_CanHardwareObject_CanHardwareObject_1, /* CanObjectId - Holds handle Id */ }; static const struct Can_MailboxStruct_PC CanConfigSet_PC_CanHardwareObject_2 = { CanConf_CanHardwareObject_CanHardwareObject_2, /* CanObjectId - Holds handle Id */ }; static const struct Can_MailboxStruct_PC CanConfigSet_PC_CanHardwareObject_3 = { CanConf_CanHardwareObject_CanHardwareObject_3, /* CanObjectId - Holds handle Id */ }; static const struct Can_MailboxStruct_PC CanConfigSet_PC_CanHardwareObject_4 = { CanConf_CanHardwareObject_CanHardwareObject_4, /* CanObjectId - Holds handle Id */ }; static const struct Can_MailboxStruct_PC CanConfigSet_PC_CanHardwareObject_5 = { CanConf_CanHardwareObject_CanHardwareObject_5, /* CanObjectId - Holds handle Id */ }; static const struct Can_MailboxStruct_PC CanConfigSet_PC_CanHardwareObject_6 = { CanConf_CanHardwareObject_CanHardwareObject_6, /* CanObjectId - Holds handle Id */ }; static const struct Can_MailboxStruct_PC CanConfigSet_PC_CanHardwareObject_7 = { CanConf_CanHardwareObject_CanHardwareObject_7, /* CanObjectId - Holds handle Id */ }; static const struct Can_MailboxStruct_PC CanConfigSet_PC_CanHardwareObject_8 = { CanConf_CanHardwareObject_CanHardwareObject_8, /* CanObjectId - Holds handle Id */ }; static const struct Can_MailboxStruct_PC CanConfigSet_PC_CanHardwareObject_9 = { CanConf_CanHardwareObject_CanHardwareObject_9, /* CanObjectId - Holds handle Id */ }; /* List of the Mailboxes */ 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, &CanConfigSet_CanHardwareObject_9, }; /* List of the Mailboxes */ 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, &CanConfigSet_PC_CanHardwareObject_9, }; /*Can Config struct */ const struct Can_ConfigType_s CanConfigSet = { CanConfigSet_CanController_List, /* Controller List Pointer */ (10U), /* max Controllers */ CanConfigSet_CanHardwareObject_List, /* Mailbox List Pointer */ (10U),/* total number of mail boxes in this configset */ .MaxBaudConfigID = { [0] = 0U, [1] = 0U, [2] = 0U, [3] = 0U, [4] = 0U, [5] = 0U, [6] = 0U, [7] = 0U, [8] = 0U, [9] = 0U }, /* Baud rate structure id */ NULL_PTR, /* Reserved Param used for future use */ }; 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 */ 0x2688000U, /* Main MCAN14 */ 0x2698000U, /* Main MCAN15 */ 0x26a8000U, /* Main MCAN16 */ 0x26b8000U, /* Main MCAN17 */ }; 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 */ 0x2680000U, /* MCAN14_SS */ 0x2690000U, /* MCAN15_SS */ 0x26a0000U, /* MCAN16_SS */ 0x26b0000U, /* MCAN17_SS */ }; 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 */ 0x2681000U, /* MCAN14_SS */ 0x2691000U, /* MCAN15_SS */ 0x26a1000U, /* MCAN16_SS */ 0x26b1000U, /* MCAN17_SS */ }; 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*/ 0x2A46000U, /* MCAN14_ECC_AGGR */ 0x2A47000U, /* MCAN15_ECC_AGGR */ 0x2A48000U, /* MCAN16_ECC_AGGR */ 0x2A49000U, /* MCAN17_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 MCAN1 Controller Instance ISR */ FUNC(void, CAN_CODE) Can_3_Int0ISR(void) { Can_IntISR_Function(CAN_CONTROLLER_INSTANCE_MCAN1, 0x2718000U); } /** \brief MCU_MCAN1 Controller Instance ISR */ FUNC(void, CAN_CODE) Can_1_Int0ISR(void) { Can_IntISR_Function(CAN_CONTROLLER_INSTANCE_MCU_MCAN1,0x40540000U); } /** \brief MCAN10 Controller Instance ISR */ FUNC(void, CAN_CODE) Can_12_Int0ISR(void) { Can_IntISR_Function(CAN_CONTROLLER_INSTANCE_MCAN10, 0x27a8000U); } /** \brief MCAN3 Controller Instance ISR */ FUNC(void, CAN_CODE) Can_5_Int0ISR(void) { Can_IntISR_Function(CAN_CONTROLLER_INSTANCE_MCAN3, 0x2738000U); } /** \brief MCAN4 Controller Instance ISR */ FUNC(void, CAN_CODE) Can_6_Int0ISR(void) { Can_IntISR_Function(CAN_CONTROLLER_INSTANCE_MCAN4, 0x2748000U); } /** \brief MCAN11 Controller Instance ISR */ FUNC(void, CAN_CODE) Can_13_Int0ISR(void) { Can_IntISR_Function(CAN_CONTROLLER_INSTANCE_MCAN11, 0x27b8000U); } /** \brief MCAN12 Controller Instance ISR */ FUNC(void, CAN_CODE) Can_14_Int0ISR(void) { Can_IntISR_Function(CAN_CONTROLLER_INSTANCE_MCAN12, 0x27c8000U); } /** \brief MCAN14 Controller Instance ISR */ FUNC(void, CAN_CODE) Can_16_Int0ISR(void) { Can_IntISR_Function(CAN_CONTROLLER_INSTANCE_MCAN14, 0x2688000U); } /** \brief MCAN16 Controller Instance ISR */ FUNC(void, CAN_CODE) Can_18_Int0ISR(void) { Can_IntISR_Function(CAN_CONTROLLER_INSTANCE_MCAN16, 0x26a8000U); } #define CAN_STOP_SEC_ISR_CODE #include "Can_MemMap.h" /******************************************************************************* * End of File: Can_Cfg.c ******************************************************************************/
3.关键信息(important informations)
CanApp_Priv.h:
can_profile.h:
main_rtos.c:
结果根据日志显示(Log print as below):
接CAN盒只收到一帧报文(only one message sent by main_can1 ,but mcu_can1 can send one message per 300ms )