Hallo Ursula,
hier die CAN-FD Struktur:
Die canfd_types.h liegt im Anhang.
struct tCANFDData
{
/**
* This enum specifies the different kinds of messages
* that may be contained in the union
*/
enum eMessageTag
{
MT_Data = 0, //!< Data
MT_Status = 1, //!< Status
};
/**
* CAN FD message flags
*/
enum eDataFlags
{
DF_NONE = 0 //!< Standard flags
, DF_ERROR_FRAME = 1 //!< Indicates an error frame
, DF_REMOTE_FRAME = 2 //!< Indicates a remote frame
, DF_TX_COMPLETED = 4 //!< Notification for successful message transmission
, DF_EXTENDED_DATA_LENGTH = 8 //!< Indicates FlexibleData-Rate (FDF Flexible Datarate Format Indicator)
, DF_CAN_FD_FORMAT_IDENTIFIER = DF_EXTENDED_DATA_LENGTH //!< same as Extended Data Length
, DF_BAUD_RATE_SWITCH = 16 //!< Indicates that the Message uses Flexible Datarate
, DF_SET_CAN_FD_AND_BRS = DF_CAN_FD_FORMAT_IDENTIFIER | DF_BAUD_RATE_SWITCH //!< Helper to Set Extended Data Length and Baud Rate Switch at once
, DF_ERROR_STATE_INDICATOR = 32 //!< EDI Bit Indicates an Error-active state at the CAN FD Node
};
/**
* CAN FD bus state flags.
*/
enum eBusStatus
{
BS_OFFLINE = 1, //!< Bus is offline
BS_ERROR_PASSIVE = 2, //!< One of the error counters has reached the error level.
BS_ERROR_WARNING = 4, //!< One of the error counters has reached the warning level.
BS_ERROR_ACTIVE = 8 //!< Bus is online
};
/**
* CAN FD message id masks. These masks should be used to check for extended or standard messages
* and to get the correct identifier from ui32Id in tData.
*/
enum eMsgId
{
MSG_IDMASK_BASE = 0x000007FF //!< Message IDs for base frame format use 11 bit identifiers
, MSG_IDMASK_EXTENDED = 0x1FFFFFFF //!< Message IDs for extended frame format use 29 bit identifiers
, MSG_EXTENDED_FLAG = 0x80000000 //!< Extended CAN messages are marked by bit 31
};
/**
* CAN FD message header structure
*/
struct tMessageHeader
{
tUInt8 ui8Tag; //!< Type of contained message (see eMessageTag)
tUInt8 ui8Channel; //!< Channel that received this message
tTimeStamp tmTimeStamp; //!< Hardware timestamp in micro seconds
};
/**
* CAN FD message data structure
*/
struct tData
{
tUInt32 ui32Id; //!< id of can message. For extended CAN messages bit 31 is set. Use the members of the enum eMsgId to get the identifier and check for extended messages.
tUInt8 ui8Length; //!< length of data [0..8,12,16,20,24,32,48,64] @attention DLC on Physical layer is coded differently
tUInt8 ui8Reserved; //!< reserved, should be zero
tUInt16 ui16Flags; //!< Flags @see eDataFlags
tUInt16 ui16Reserved; //!< reserved, should be zero
tUInt32 ui32Reserved; //!< reserved, should be zero
tUInt8 aui8Data[64]; //!< data field
};
/**
* CAN FD bus status structure
*/
struct tStatus
{
tUInt32 ui32BitRate; //!< Arbitration or nominal CAN FD bus bitrate
tUInt32 ui32RxBitCount; //!< Count of received bits
tUInt32 ui32TxBitCount; //!< Count of transmitted bits
tUInt16 ui16RxErrorCounter; //!< Error counter for the receive section of the CAN controller.
tUInt16 ui16TxErrorCounter; //!< Error counter for the transmit section of the CAN controller.
tUInt8 ui8BusStatus; //!< Flags @see eBusStatus
tUInt8 ui8Reserved; //!< reserved, should be zero
tUInt32 ui32DataBitRate; //!< alternate Bitrate used for Data in CAN FD messages with BRS flag set.
tUInt8 aui8Reserved[56]; //!< reserved, should be Zero
};
tMessageHeader sHeader; //!< CAN message header structure
union
{
tData sData; //!< used when ui8Tag == MT_Data
tStatus sStatus; //!< used when ui8Tag == MT_Status
};
};
Damit sollte das Supportticket abgeschlossen sein.
Gibt es noch Fragen dazu, ansonsten bitte ein kurzes Feedback, damit wir es schließen können.