MX Foundation 4
|
CAN bus Transmit / Receive (Acquisition) Record. More...
#include <mxf_class_canbus.h>
Data Fields | |
uint64 | timeTag |
uint32 | control |
uint32 | dataSize |
uint32 | repeatCount |
uint32 | errorInj |
uint32 | id |
uint32 | info |
uint8 | data [72] |
This CAN bus record structure is needed when sending (transmission) and receiving (acquisition).
uint64 MXF_CANBUS_DATAREC::timeTag |
Acquisition mode: Specifies the time when the data record has been received by the device. It is an absolute time expressed on the time base set for the device. The time tag may also be disabled with the KMXF_CANBUS_RX_TIMETAG_ENABLE attribute.
Transmission Mode: For transmit operation, the time tag allows the application to specify the time when the data is to be transmitted. Depending on the usage the time tag can be optional.
uint32 MXF_CANBUS_DATAREC::control |
Acquisition mode: For receive operation, the control field defines the condition under which the related record data was received.
The control bits are defined as follow:
Bit Constant | Meaning |
---|---|
MXF_CANBUS_RX_REC_CTRL_CRC_ERROR | A CRC error was detected in the incoming frame |
MXF_CANBUS_RX_REC_CTRL_ERROR_SEGMENT | Mask that specifies where the error has been detected. Goes with MXF_CANBUS_RX_REC_CTRL_ERROR_SEGMENT_ below. |
MXF_CANBUS_RX_REC_CTRL_ERROR_SEGMENT_SOF | Error detected in segment SOF |
MXF_CANBUS_RX_REC_CTRL_ERROR_SEGMENT_ID28_ID21 | Error detected in segment ID[28-21] |
MXF_CANBUS_RX_REC_CTRL_ERROR_SEGMENT_ID20_ID18 | Error detected in segment ID[20-18] |
MXF_CANBUS_RX_REC_CTRL_ERROR_SEGMENT_SRTR | Error detected in segment SRTR |
MXF_CANBUS_RX_REC_CTRL_ERROR_SEGMENT_IDE | Error detected in segment IDE |
MXF_CANBUS_RX_REC_CTRL_ERROR_SEGMENT_ID17_ID13 | Error detected in segment ID[17-13] |
MXF_CANBUS_RX_REC_CTRL_ERROR_SEGMENT_ID12_ID5 | Error detected in segment ID[12-5] |
MXF_CANBUS_RX_REC_CTRL_ERROR_SEGMENT_ID4_ID0 | Error detected in segment ID[4-0] |
MXF_CANBUS_RX_REC_CTRL_ERROR_SEGMENT_RTR | Error detected in segment RTR |
MXF_CANBUS_RX_REC_CTRL_ERROR_SEGMENT_RESERVED1 | Error detected in segment Reserved1 |
MXF_CANBUS_RX_REC_CTRL_ERROR_SEGMENT_RESERVED0 | Error detected in segment Reserved0 |
MXF_CANBUS_RX_REC_CTRL_ERROR_SEGMENT_LEN_CODE | Error detected in segment DLC |
MXF_CANBUS_RX_REC_CTRL_ERROR_SEGMENT_DATA | Error detected in segment Data |
MXF_CANBUS_RX_REC_CTRL_ERROR_SEGMENT_CRC_SEQ | Error detected in segment CRC sequence |
MXF_CANBUS_RX_REC_CTRL_ERROR_SEGMENT_CRC_DEL | Error detected in segment CRC delimiter |
MXF_CANBUS_RX_REC_CTRL_ERROR_SEGMENT_ACK_SLOT | Error detected in segment ACK slot |
MXF_CANBUS_RX_REC_CTRL_ERROR_SEGMENT_ACK_DEL | Error detected in segment ACK delimiter |
MXF_CANBUS_RX_REC_CTRL_ERROR_SEGMENT_EOF | Error detected in segment EOF |
MXF_CANBUS_RX_REC_CTRL_ERROR_SEGMENT_INTER | Error detected in segment intermission |
MXF_CANBUS_RX_REC_CTRL_ERROR_SEGMENT_ACTIVE_ERR_FLAG | Error detected in segment active error flag |
MXF_CANBUS_RX_REC_CTRL_ERROR_SEGMENT_PASSIVE_ERR_FLAG | Error detected in segment passive error flag |
MXF_CANBUS_RX_REC_CTRL_ERROR_SEGMENT_TOLERATE_DOMINANT_BIT | Error detected in segment tolerate dominant bits |
MXF_CANBUS_RX_REC_CTRL_ERROR_SEGMENT_ERR_DEL | Error detected in segment error delimiter |
MXF_CANBUS_RX_REC_CTRL_ERROR_SEGMENT_OVERLOAD_FLAG | Error detected in segment overload flag |
MXF_CANBUS_RX_REC_CTRL_ERROR_SEGMENT_FD_CTRL | Error detected in segment FD flag (FDF, BRS, ESI) |
MXF_CANBUS_RX_REC_CTRL_ERROR_CODE | Mask that specifies the type of error that has been detected. Goes with MXF_CANBUS_RX_REC_CTRL_ERROR_CODE_ below. |
MXF_CANBUS_RX_REC_CTRL_ERROR_CODE_BIT | Bit monitoring error type |
MXF_CANBUS_RX_REC_CTRL_ERROR_CODE_FORM | Form error type. Invalid value in fixed bit-field. |
MXF_CANBUS_RX_REC_CTRL_ERROR_CODE_STUFF | Bit-stuffing error type. Message contains a sequence of six or more equivalent bits. |
MXF_CANBUS_RX_REC_CTRL_ERROR_CODE_OTHER | Other error type. Other type of error than Bit, Form or Stuff error. |
MXF_CANBUS_RX_REC_CTRL_ERROR_DIR | Mask that specifies the direction. Goes with MXF_CANBUS_RX_REC_CTRL_ERROR_DIR_ below. |
MXF_CANBUS_RX_REC_CTRL_ERROR_DIR_TX | Direction TX |
MXF_CANBUS_RX_REC_CTRL_ERROR_DIR_RX | Direction RX |
MXF_CANBUS_RX_REC_CTRL_ERROR_ID | An ID error was detected in the incoming frame |
MXF_CANBUS_RX_REC_CTRL_ERROR_DLC | A DLC error was detected in the incoming frame |
MXF_CANBUS_RX_REC_CTRL_ERROR_LEN | A data length error was detected in the incoming frame |
A control of zero indicates that no errors was found while receiving data.
Transmission Mode: For transmission, the control field allows the user to inject transmit error.
A control of zero instructs the transmit process to send the data using the current transmitter settings.
The control bits are defined as follow:
Bit Constant | Meaning |
---|---|
MXF_CANBUS_TX_REC_CTRL_SINGLE_SHOT | No retry will be done |
MXF_CANBUS_TX_REC_CTRL_ACK_NOT_NEEDED | Data does not need an ACK (similar to the selftest mode) |
MXF_CANBUS_TX_REC_CTRL_ERROR_INJ | Use errorInj field to inject an error |
uint32 MXF_CANBUS_DATAREC::dataSize |
Acquisition mode: Number of bytes received in data array. The number of bytes include the CRC following the data.
Transmission Mode: Number of bytes to transmit from data array. If dataSize field does not match the DLC, dataSize bytes will be transmitted regardless of the DLC value, which might cause an error to be detected on the bus.
uint32 MXF_CANBUS_DATAREC::repeatCount |
Acquisition mode: Not used.
Transmission Mode: Not used, must be set to 1.
uint32 MXF_CANBUS_DATAREC::errorInj |
Acquisition mode: Not used.
Transmission Mode: Used when MXF_CANBUS_TX_REC_CTRL_ERROR_INJ is set in control field. Use the mxfCanBusErrorInjectionSet() function to build the field with the error Id and parameter.
The error Ids are defined as follow:
Constant | Meaning | Parameter |
---|---|---|
MXF_CANBUS_ERRORID_STUFF | Invert the first stuff bit from the specified index. | Bit index [0-511] |
MXF_CANBUS_ERRORID_FIX_STUFF | Invert the first fixed stuff bit from the specified index. | Bit index [0-24]) |
MXF_CANBUS_ERRORID_GAP | Insert the specified bit time gap after the transmission. | Bit time [1-7]) |
MXF_CANBUS_ERRORID_OVERLOAD | Send an overload flag at intermission phase. | None |
MXF_CANBUS_ERRORID_CRC | Add 1 to the computed CRC. | None |
MXF_CANBUS_ERRORID_CRC_STUFF_CNT | Add 1 to the stuff count. | None |
MXF_CANBUS_ERRORID_CRC_STUFF_PAR | Invert the stuff count parity. | None |
MXF_CANBUS_ERRORID_BIT_INV | Invert bit at the specified index. | Bit index [1-576]) |
MXF_CANBUS_ERRORID_CRC_USER | Replace the CRC with the specified one. | None (the CRC is specified in the data field). |
MXF_CANBUS_ERRORID_CRC_NOT_SENT | Do not send the CRC. | None |
uint32 MXF_CANBUS_DATAREC::id |
Acquisition mode:
Received ID from the transmitter.
Transmission Mode:
Transmit ID:
Define a base frame format message using an 11 bits identifier or a extended frame format message using a 29 bits identifier.
Use MXF_CANBUS_REC_INFO_EXTENDED in info field to specify an extended frame format.
uint32 MXF_CANBUS_DATAREC::info |
Acquisition mode:
Receive bits values of the arbitration field of the CAN frame.
Bit Constant | Bosch Meaning | ISO Meaning |
---|---|---|
MXF_CANBUS_REC_INFO_DLC | 4-bit LSB mask for received DLC | |
MXF_CANBUS_REC_INFO_EXTENDED | Set to one if IDE bit is received recessive (Extended frame format) [CEFF and FEFF] | |
MXF_CANBUS_REC_INFO_RTR | Set to one if RTR bit is received recessive (RTR Frame) [CBFF and CEFF] | |
MXF_CANBUS_REC_INFO_R0 | Set to one if r0 bit is received recessive | Set to one if r0 bit is received recessive [CBFF and CEFF] or if res bit is received recessive [FDFF and FEFF] |
MXF_CANBUS_REC_INFO_R1 | Set to one if r1 bit is received recessive [CEFF, FBFF and FEFF] | Set to one if RRS bit is received recessive [FBFF and FEFF] or if r1 bit is received recessive [CEFF] |
MXF_CANBUS_REC_INFO_FD | Set to one if EDL bit is received recessive [FBFF and FEFF] | Set to one if FDF bit is received recessive (FD frame format) [FBFF and FEFF] |
MXF_CANBUS_REC_INFO_FD_BRS | Set to one if BRS bit is received recessive [FBFF and FEFF] | |
MXF_CANBUS_REC_INFO_FD_ESI | Set to one if ESI bit is received recessive (error passive) [FBFF and FEFF] | |
MXF_CANBUS_REC_INFO_SRR_DOM | Set to one if SRR bit is received dominant [CEFF and FEFF] |
Transmission Mode:
Transmission bits of the arbitration field for the CAN frame to send.
Bit Constant | Bosch Meaning | ISO Meaning |
---|---|---|
MXF_CANBUS_REC_INFO_DLC | 4-bit LSB mask for transmitted DLC | |
MXF_CANBUS_REC_INFO_EXTENDED | Set to one if IDE bit is transmitted recessive (Extended frame format) [CEFF and FEFF] | |
MXF_CANBUS_REC_INFO_RTR | Set to one if RTR bit is transmitted recessive (RTR Frame) [CBFF and CEFF] | |
MXF_CANBUS_REC_INFO_R0 | Set to one if r0 bit is transmitted recessive | Set to one if r0 bit is transmitted recessive [CBFF and CEFF] or if res bit is transmitted recessive [FDFF and FEFF] |
MXF_CANBUS_REC_INFO_R1 | Set to one if r1 bit is transmitted recessive [CEFF, FBFF and FEFF] | Set to one if RRS bit is transmitted recessive [FBFF and FEFF] or if r1 bit is transmitted recessive [CEFF] |
MXF_CANBUS_REC_INFO_FD | Set to one if EDL bit is transmitted recessive [FBFF and FEFF] | Set to one if FDF bit is transmitted recessive (FD frame format) [FBFF and FEFF] |
MXF_CANBUS_REC_INFO_FD_BRS | Set to one if BRS bit is transmitted recessive [FBFF and FEFF] | |
MXF_CANBUS_REC_INFO_FD_ESI | Set to one if ESI bit is transmitted recessive (error passive) [FBFF and FEFF] | |
MXF_CANBUS_REC_INFO_SRR_DOM | Set to one if SRR bit is transmitted dominant [CEFF and FEFF] |
uint8 MXF_CANBUS_DATAREC::data[72] |
Acquisition mode: Data received + CRC.
Transmission Mode: Data to transmit. If errorInj field is set to MXF_CANBUS_ERRORID_CRC_USER, data must include the CRC to send.