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.
Hello,
The CAN driver is not working as expected during reception if the separation time between the frames being sent is ~0ms.
The driver drops frames which leads to receiving wrong sequence numbers during the segmentation of the received message.
Attached log from the transmission of the segmented message and a screenshot from a debugging array storing the received PDUs in the CanIf_RxIndication.
As seen from the screenshots the driver always drops a frame and receives the next one: 21 -> 23 -> 25 and so on. Sequence numbers 22, 24, 26, etc. are lost.
Your help is appreciated.
Yours,
Abdelrhman Afifi
Hello,
Here is the configuration:
/* ====================================================================== * Copyright (C) 2022-2023 Texas Instruments Incorporated * * All rights reserved. Property of Texas Instruments Incorporated. * Restricted rights to use, duplicate or disclose this code are * granted through contract. * * The program may not be used without the written permission * of Texas Instruments Incorporated or against the terms and conditions * stipulated in the agreement under which this program has been * supplied. * ==================================================================== */ /*************************************************************************** Project: lgit Date : 2023-11-08 16:26:27 This file is generated by EB Tresos Do not modify this file, otherwise the software may behave in unexpected way. *****************************************************************************/ /* * Module switch */ #define CAN_PBCFG_SOURCE /********************************************************************************************************************** * INCLUDES *********************************************************************************************************************/ #include "Can.h" #include "Can_Cfg.h" /********************************************************************************************************************** * VERSION CHECK *********************************************************************************************************************/ /** \brief Can configuration Major Version */ #define CAN_PBCFG_C_MAJOR_VERSION (9U) /** \brief Can configuration Minor Version */ #define CAN_PBCFG_C_MINOR_VERSION (0U) /** \brief Can configuration Patch Version */ #define CAN_PBCFG_C_PATCH_VERSION (0U) /* Version checking */ #if ( (CAN_SW_MAJOR_VERSION != (9U))||(CAN_SW_MINOR_VERSION != (0U))) #error "Version numbers of Can_PBcfg.c and Can.h are inconsistent!" #endif #if ( (CAN_CFG_MAJOR_VERSION != (9U))||(CAN_CFG_MINOR_VERSION != (0U))) #error "Version numbers of Can_PBcfg.c and Can_Cfg.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_CAN1_CanControllerBaudrateConfig = { 500U, /* in Kbps */ 20U, /* Prop Segement value */ 14U, /* Phase Segment 1 */ 5U, /* Phase Segment 2 */ 1U, /* Sync jump width */ 40U, /* Sum of all timing parameters */ 4U, /* Controller BRP value for Baud */ /* Data phase Baudrate */ { 2000U, /* in Kbps */ 5U, /* Prop Segement value */ 3U, /* Phase Segment 1 */ 1U, /* Phase Segment 2 */ 1U, /* Sync jump width */ 10U, /* Sum of all timing parameters */ 4U, /* Controller BRP value for Baud */ 14U, /* Specifies the Transceiver Delay Compensation Offset */ (boolean)TRUE, /* Specifies if the bit rate switching shall be used */ } }; /*List of the Baudrate structures */ static Can_BaudConfigType *CanConfigSet_CanController_CAN1_BaudRateConfigList[]= { &CanConfigSet_CanController_CAN1_CanControllerBaudrateConfig, }; /* Controller structure defined here for all config sets */ static Can_ControllerType CanConfigSet_CanController_CAN1 = { &CanConfigSet_CanController_CAN1_CanControllerBaudrateConfig, /* pointer to default Baud structure */ CanConfigSet_CanController_CAN1_BaudRateConfigList, /* List of available Baudrate structs */ }; /*List of the Controller structures */ static Can_ControllerType *CanConfigSet_CanController_List[]= { &CanConfigSet_CanController_CAN1, }; static Can_HwFilterType CanConfigSet_CanHardwareObject_FD_Rx_Functional_CAN1_CanHwFilter_0 = { 2047U, /*CanHwFilterCode*/ 2047U, /*Filter Mask*/ }; static Can_HwFilterType CanConfigSet_CanHardwareObject_FD_Rx_Physical_CAN1_CanHwFilter_0 = { 1821U, /*CanHwFilterCode*/ 2047U, /*Filter Mask*/ }; static Can_HwFilterType *CanConfigSet_CanHardwareObject_FD_Rx_Functional_CAN1_HwFilterConfigList[]= { &CanConfigSet_CanHardwareObject_FD_Rx_Functional_CAN1_CanHwFilter_0, }; static Can_HwFilterType *CanConfigSet_CanHardwareObject_FD_Rx_Physical_CAN1_HwFilterConfigList[]= { &CanConfigSet_CanHardwareObject_FD_Rx_Physical_CAN1_CanHwFilter_0, }; /* All the Mailbox objects(MB's) will be defined here for all config sets */ static Can_MailboxType CanConfigSet_CanHardwareObject_FD_Tx_CAN1 = { 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_CAN1, /* Controller */ NULL_PTR, /* List of HW Filter structs */ 0U, /* Hw Filter Count */ 204U, /* Padding value for CAN FD message */ (boolean)FALSE, /* CanHardwareObjectUsesPolling */ (boolean)FALSE, /* CanTriggerTransmitEnable */ }; static Can_MailboxType CanConfigSet_CanHardwareObject_FD_Rx_Functional_CAN1 = { 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_CAN1, /* Controller */ CanConfigSet_CanHardwareObject_FD_Rx_Functional_CAN1_HwFilterConfigList, /* List of HW Filter structs */ 1U, /* Hw Filter Count */ 204U, /* Padding value for CAN FD message */ (boolean)FALSE, /* CanHardwareObjectUsesPolling */ (boolean)FALSE, /* CanTriggerTransmitEnable */ }; static Can_MailboxType CanConfigSet_CanHardwareObject_FD_Rx_Physical_CAN1 = { 0U, /* CanHandleType 0=Full, 1=Basic */ 0U, /* CanIdType 0=standard 1=Extended 2=Mixed*/ 1U, /* 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_CAN1, /* Controller */ CanConfigSet_CanHardwareObject_FD_Rx_Physical_CAN1_HwFilterConfigList, /* List of HW Filter structs */ 1U, /* Hw Filter Count */ 204U, /* Padding value for CAN FD message */ (boolean)FALSE, /* CanHardwareObjectUsesPolling */ (boolean)FALSE, /* CanTriggerTransmitEnable */ }; /* List of the Mailboxes */ static Can_MailboxType *CanConfigSet_CanHardwareObject_List[] = { &CanConfigSet_CanHardwareObject_FD_Tx_CAN1, &CanConfigSet_CanHardwareObject_FD_Rx_Functional_CAN1, &CanConfigSet_CanHardwareObject_FD_Rx_Physical_CAN1, }; #define CAN_STOP_SEC_CONFIG_DATA #include "Can_MemMap.h" #define CAN_START_SEC_CONFIG_DATA #include "Can_MemMap.h" /*Can Config struct */ const struct Can_ConfigType_s CanConfigSet = { CanConfigSet_CanController_List, /* List of all controllers in this config set */ (1U), /* max Controllers */ CanConfigSet_CanHardwareObject_List, (3U), /* total number of mail boxes in this configset */ .MaxBaudConfigID = { [0] = 0U } }; #define CAN_STOP_SEC_CONFIG_DATA #include "Can_MemMap.h" /********************************************************************************************************************* * End of File: Can_PBcfg.c *********************************************************************************************************************/
/* ====================================================================== * Copyright (C) 2022-2023 Texas Instruments Incorporated * * All rights reserved. Property of Texas Instruments Incorporated. * Restricted rights to use, duplicate or disclose this code are * granted through contract. * * The program may not be used without the written permission * of Texas Instruments Incorporated or against the terms and conditions * stipulated in the agreement under which this program has been * supplied. * ==================================================================== */ /*************************************************************************** Project: lgit Date : 2023-11-08 16:26:27 This file is generated by EB Tresos Do not modify this file, otherwise the software may behave in unexpected way. *****************************************************************************/ /* * Module switch */ /********************************************************************************************************************** * INCLUDES *********************************************************************************************************************/ #include "Can.h" #include "Can_Cfg.h" /********************************************************************************************************************** * VERSION CHECK *********************************************************************************************************************/ /** \brief Can configuration Major Version */ #define CAN_CFG_C_MAJOR_VERSION (9U) /** \brief Can configuration Minor Version */ #define CAN_CFG_C_MINOR_VERSION (0U) /** \brief Can configuration Patch Version */ #define CAN_CFG_C_PATCH_VERSION (0U) /* 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 #if ( (CAN_CFG_MAJOR_VERSION != (9U))||(CAN_CFG_MINOR_VERSION != (0U))) #error "Version numbers of Can_Cfg.c and Can_Cfg.h are inconsistent!" #endif /********************************************************************************************************************** * GLOBAL DATA *********************************************************************************************************************/ #define CAN_START_SEC_CONFIG_DATA #include "Can_MemMap.h" /* Controller structure defined here for all config sets */ const struct Can_ControllerStruct_PC CanConfigSet_PC_CanController_CAN1 = { CanConf_CanController_CanController_CAN1, /* Id as provided by GUI */ (boolean)TRUE, /* Contoller is used=1 or not_used=0*/ 0x52600000U, /* Can Controller Base Address */ (boolean)FALSE, /* Automatic wakeup via bus activity */ 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 */ (boolean)TRUE, /* TRUE = Interrupt FALSE = Polling */ (boolean)TRUE, /* Auto retransmission on Tx error Enable/Disable */ NULL_PTR, CAN_CONTROLLER_INSTANCE_MCAN0, /* Controller Instance */ }; const struct Can_ControllerStruct_PC *CanConfigSet_CanController_List_PC[CAN_NUM_CONTROLLER]= { &CanConfigSet_PC_CanController_CAN1, }; /* All the Mailbox objects(MB's) will be defined here for all config sets */ static const struct Can_MailboxStruct_PC CanConfigSet_PC_CanHardwareObject_FD_Tx_CAN1 = { CanConf_CanHardwareObject_CanHardwareObject_FD_Tx_CAN1, /* CanObjectId - Holds handle Id */ }; static const struct Can_MailboxStruct_PC CanConfigSet_PC_CanHardwareObject_FD_Rx_Functional_CAN1 = { CanConf_CanHardwareObject_CanHardwareObject_FD_Rx_Functional_CAN1, /* CanObjectId - Holds handle Id */ }; static const struct Can_MailboxStruct_PC CanConfigSet_PC_CanHardwareObject_FD_Rx_Physical_CAN1 = { CanConf_CanHardwareObject_CanHardwareObject_FD_Rx_Physical_CAN1, /* CanObjectId - Holds handle Id */ }; /* List of the Mailboxes */ const struct Can_MailboxStruct_PC *CanConfigSet_CanHardwareObject_List_PC[CAN_NUM_MAILBOXES] = { &CanConfigSet_PC_CanHardwareObject_FD_Tx_CAN1, &CanConfigSet_PC_CanHardwareObject_FD_Rx_Functional_CAN1, &CanConfigSet_PC_CanHardwareObject_FD_Rx_Physical_CAN1, }; #define CAN_STOP_SEC_CONFIG_DATA #include "Can_MemMap.h" /******************************************************************************* * End of File: Can_Cfg.c ******************************************************************************/
/* ====================================================================== * Copyright (C) 2022-2023 Texas Instruments Incorporated * * All rights reserved. Property of Texas Instruments Incorporated. * Restricted rights to use, duplicate or disclose this code are * granted through contract. * * The program may not be used without the written permission * of Texas Instruments Incorporated or against the terms and conditions * stipulated in the agreement under which this program has been * supplied. * ==================================================================== */ /*************************************************************************** Project: lgit Date : 2023-11-08 16:26:27 This file is generated by EB Tresos Do not modify this file, otherwise the software may behave in unexpected way. *****************************************************************************/ /** * \file Can_Cfg.h * * \brief This file contains generated pre compile configuration file for * CAN MCAL driver * */ /** * ****************************************************************************** * \defgroup MCAL_CAN_CFG Can Configuration * * This files defines CAN MCAL configuration structures * @{ ******************************************************************************/ #ifndef CAN_CFG_H_ #define CAN_CFG_H_ #include "Dem.h" #ifdef __cplusplus extern "C" { #endif /** \brief CAN Config ID */ #define CAN_CFG_ID (CAN_CFG_ID_0) /** * \brief CAN Build Variant. * Build variants.(i.e Pre Compile,Post Build) */ #define CAN_VARIANT_POST_BUILD (STD_ON) /** * \name Can Driver Configuration SW Version Info * * Defines for CAN Driver configuration version * @{ */ /** \brief Can configuration Major Version */ #define CAN_CFG_MAJOR_VERSION (9U) /** \brief Can configuration Minor Version */ #define CAN_CFG_MINOR_VERSION (0U) /** \brief Can configuration Patch Version */ #define CAN_CFG_PATCH_VERSION (0U) /* @} */ /** * \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_OFF) /*!< Enable/Disable DEV error detection */ #define CAN_DEINIT_API (STD_ON) /*!< Enable/Disable Can_DeInit() API */ #define CAN_SET_BAUDRATE_API (STD_ON) /*!< Enable/Disable Can_SetBaudrate() API */ #define CAN_LOOPBACK_ENABLE (STD_OFF) /*!< Enable/Disable Can_TestLoopBackModeEnable() */ #define CAN_WAKEUP_FUNCTIONALITY_API (STD_ON) /*!< Enable/Disable Can_CheckWakeup() */ #define CAN_MULTIPLEXED_TRANSMISSION_ENABLE (STD_OFF) /*!< Enable/Disable Multiplexed Transmission */ #define CAN_TRIGGER_TRANSMIT_ENABLE (STD_OFF) /*!< Enable/Disable CanIf_TriggerTransmit */ /** * \brief CAN Build Variant. * Build Variants.(i.e Pre-compile,Post-Build or Link time) */ /*mixed mode is allowed */ #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_ECC_ENABLE STD_OFF /*!< Enable/Disable single bit ECC logic */ /* @} */ /*!< Maximum number of Config sets */ /*!< Max Baud rate config structs */ #define CAN_NUM_CONTROLLER (1U) /*!< Max number of controllers defined*/ #define CAN_NUM_MAILBOXES (3U) /*!< Max number of mailboxes defined*/ #define CAN_MAX_CONTROLLER (4U) /*!< Max number of mailboxes per controller */ #define CAN_NUM_TX_MAILBOXES (1U) /*!< Total Number of TX mailboxes */ #define CAN_ISR_TYPE (CAN_ISR_CAT1) /*!< Enable/Disable OSEK Category 1 ISR */ /** * \name Can Controller Id names * * Defines for symbolic names for the CanControllerIds * @{ */ #define CanConf_CanController_CanController_CAN1 (0U) /* @} */ /* @} */ #define CAN_CONTROLLER_MCAN0 /** * \name Can HW Object names * * Defines for symbolic names for the CanHardwareObjectIds * @{ */ #define CanConf_CanHardwareObject_CanHardwareObject_FD_Tx_CAN1 (0U) #define CAN_HTRH_0 (CanConf_CanHardwareObject_CanHardwareObject_FD_Tx_CAN1) #define CanConf_CanHardwareObject_CanHardwareObject_FD_Rx_Functional_CAN1 (1U) #define CAN_HTRH_1 (CanConf_CanHardwareObject_CanHardwareObject_FD_Rx_Functional_CAN1) #define CanConf_CanHardwareObject_CanHardwareObject_FD_Rx_Physical_CAN1 (2U) #define CAN_HTRH_2 (CanConf_CanHardwareObject_CanHardwareObject_FD_Rx_Physical_CAN1) /* @} */ /* @} */ /** \brief Counter ID for counter used to count wait ticks */ #define CAN_OS_COUNTER_ID ((CounterType)0U) /** * \brief CAN timeout - used in CAN IFCMD busy wait and Start/Stop busy wait. * Specifies the maximum time for blocking function until a timeout is detected. * Unit is milli seconds. */ #define CAN_TIMEOUT_DURATION (65000U) /* DEM Error Definitions */ /* DEM Error Codes */ /** \brief No event error code */ #define DemConf_DemEventParameter_CAN_DEM_NO_EVENT (0xFFFFU) #define CAN_DEM_NO_EVENT DemConf_DemEventParameter_CAN_DEM_NO_EVENT #ifndef CAN_E_HARDWARE_ERROR /** \brief Hardware failed */ #define CAN_E_HARDWARE_ERROR (CAN_DEM_NO_EVENT) #endif /* ========================================================================== */ /* Structures and Enums */ /* ========================================================================== */ /** * \brief Can Mailbox direction enum */ typedef enum { CAN_CONTROLLER_INSTANCE_MCAN0 = 0x0U, /**< MCAN0 Controller Instance */ CAN_CONTROLLER_INSTANCE_MCAN1 = 0x1U, /**< MCAN1 Controller Instance */ CAN_CONTROLLER_INSTANCE_MCAN2 = 0x2U, /**< MCAN2 Controller Instance */ CAN_CONTROLLER_INSTANCE_MCAN3 = 0x3U /**< MCAN3 Controller Instance */ } Can_ControllerInstance; /** \brief CAN Configuration struct declaration */ extern const struct Can_ConfigType_s CanConfigSet; extern const struct Can_ControllerStruct_PC CanConfigSet_PC_CanController_CAN1; /** \brief CAN Controller Pre Compile Configuration List */ extern const struct Can_ControllerStruct_PC *CanConfigSet_CanController_List_PC[CAN_NUM_CONTROLLER]; /** \brief CAN Mailbox Pre Compile Configuration List */ extern const struct Can_MailboxStruct_PC *CanConfigSet_CanHardwareObject_List_PC[CAN_NUM_MAILBOXES]; #ifdef __cplusplus } #endif #endif /*CAN_CFG_H__*/ /* @} */ /********************************************************************************************************************** * END OF FILE: Can_Cfg.h *********************************************************************************************************************/
Hi Afifi,
As you are using buffer to receive 0x71D message and the frames sent in interval with ~0ms, I suggest you to create 1 more RX mailbox object with HwObjectCount > 1 and point to same HwList CanConfigSet_CanHardwareObject_FD_Rx_Physical_CAN1_HwFilterConfigList.
This will ensure messages will be received in FIFO as well and you will receive all messages.
BR,
Sunil