Skip to main content

API Details (CAN)

This page describes details of CAN-specific APIs available in this product.

Read This First​

API Quick Reference (Constants / Structures / Preconditions / Minimal Examples)​

APIConstants used by this APIStructures used by this APICallable precondition statusMinimal code examples (C++/C#/VBA)
MPXCANSetParamCAN Operation Mode, CAN Arbitration BaudrateStMPXCANParamRUNCAN Monitor Sample (G++), CAN Simulation (G++), CAN Simulation (Python)
MPXCANGetLogExBuffer Overrun PresenceStMPXCANLogNONE/MON/SIMCAN Monitor Sample (G++)
MPXCANSetSlotCAN Frame Type, CAN Transmission Trigger TypeStMPXCANSlotPARAM/SYNCCAN Simulation (G++)
MPXCANChangeSlotCAN Slot Enable/Disable, CAN Slot Change Request InfoStMPXCANFrameSIMCAN Simulation (G++)
MPXCANSendSlotCAN Frame Type-SIMCAN Simulation (G++)
MPXCANDirectSendCAN ID Format, CAN Remote Transmission RequestStMPXCANDirectSIMCAN Simulation (G++), CAN Simulation (Python)

Notation​

On this page, each API is described in the following format.

Format[Function type] [Function name]([argument], ...)
Argument[Argument type][Argument name][in/out][Argument description]
Return value[Return type][Return value (error code)][Description of return value (error code)]
Function[Function behavior]
Note[Supplementary information]

If an argument type is a structure, refer to Structure Definitions (struct) (CAN) and Structure Definitions (struct) (common) for values to set or values that are set.

For [in/out], in means set by caller before invocation, and out means set by the function during processing.

API Details​

MPXCANSetParam​

Sets CAN or CAN FD communication parameters from predefined options.

FormatER MPXCANSetParam(uint32_t Serial, uint8_t InnerCh, StMPXCANParam * Param)
Argumentuint32_tSerialinSerial number of target MicroPeckerX device
uint8_tInnerChinTarget CH number (1 or 2)
StMPXCANParam *ParaminPointer to parameter setting structure
Return valueERE_OKSuccess
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionSets CAN or CAN FD communication parameters on the CH specified by Serial and InnerCh, using values in Param.
NoteCalling this API changes MicroPeckerX status to MPX_STATUS_PARAM (waiting for parameter configuration).

MPXCANGetLogEx​

Gets log information (TX/RX data) during monitoring into a caller-provided CAN log structure array.

FormatER MPXCANGetLogEx(uint32_t Serial, uint8_t InnerCh, StMPXCANLog * Log, uint16_t Num, uint16_t * Count, uint8_t * BufferOver)
Argumentuint32_tSerialinSerial number of target MicroPeckerX device
uint8_tInnerChinTarget CH number (1 or 2)
StMPXCANLog *Login/outLog information structure array
uint16_tNuminNumber of elements in log structure array
uint16_t *CountoutNumber of acquired logs
uint8_t *BufferOveroutBuffer overrun
(see Buffer Overrun Presence)
Return valueERE_OKSuccess
E_PARAMParameter error
E_DEVICEDevice not found
FunctionAcquires CAN log information from the CH specified by Serial and InnerCh.
Set Log to an array for storing acquired CAN logs, and set Num to the array length.
The number of acquired logs is returned in Count.
If Count exceeds Num, buffer overrun occurs and BufferOver is set to MPX_LOG_BUFOVER_TRUE.
NoteThe caller must prepare the destination structure array for acquired logs.

MPXCANSetSlot​

Sets CAN or CAN FD slot information before monitoring starts.

FormatER MPXCANSetSlot(uint32_t Serial, uint8_t InnerCh, StMPXCANSlot * Slots, uint8_t SlotCount)
Argumentuint32_tSerialinSerial number of target MicroPeckerX device
uint8_tInnerChinTarget CH number (1 or 2)
StMPXCANSlot *SlotsinSlot information
uint8_tSlotCountinNumber of slots to configure
Return valueERE_OKSuccess
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionSets CAN or CAN FD slot information on the CH specified by Serial and InnerCh.
Set Slots to an array of slot structures and SlotCount to the array length.
NoteThis API is for setting slot information before monitoring starts.
To change slot information during monitoring, call MPXCANChangeSlot.

MPXCANChangeSlot​

Changes CAN or CAN FD slot information during monitoring.

FormatER MPXCANChangeSlot(uint32_t Serial, uint8_t InnerCh, uint8_t SlotNo, uint8_t SlotEnabled, uint8_t ReqInfo, StMPXCANFrame * Frame)
Argumentuint32_tSerialinSerial number of target MicroPeckerX device
uint8_tInnerChinTarget CH number (1 or 2)
uint8_tSlotNoinTarget slot number (1 to 28)
uint8_tSlotEnabledinSlot enable/disable
(see CAN Slot Enable/Disable)
uint8_tReqInfoinRequest information for slot change
(see CAN Slot Change Request Info)
StMPXCANFrame *FrameinPointer to frame attribute structure
Return valueERE_OKSuccess
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_TRG_BUSYTrigger configuration failed
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionChanges CAN or CAN FD slot information specified by SlotNo on the CH specified by Serial and InnerCh.
NoteThis API changes slot enable/disable and CAN/CAN FD frame settings during monitoring.
To set slot information before monitoring starts, call MPXCANSetSlot.

MPXCANSendSlot​

Issues a send request to a CAN or CAN FD slot.

FormatER MPXCANSendSlot(uint32_t Serial, uint8_t InnerCh, uint8_t SlotNo)
Argumentuint32_tSerialinSerial number of target MicroPeckerX device
uint8_tInnerChinTarget CH number (1 or 2)
uint8_tSlotNoinTarget slot number (1 to 28)
Return valueERE_OKSuccess
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_TRG_BUSYTrigger configuration failed
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionIssues a send request to the slot specified by SlotNo on the CH specified by Serial and InnerCh.
NoteThis API is valid only when the slot frame type set by MPXCANSetSlot is MPX_CAN_FRAME_TYPE_EVENT or MPX_CAN_FRAME_TYPE_EVENTPERIODIC.

MPXCANDirectSend​

Sends a CAN or CAN FD frame directly without using slots.

FormatER MPXCANDirectSend(uint32_t Serial, uint8_t InnerCh, StMPXCANDirect * Frame)
Argumentuint32_tSerialinSerial number of target MicroPeckerX device
uint8_tInnerChinTarget CH number (1 or 2)
StMPXCANDirect *FrameinTransmit frame
Return valueERE_OKSuccess
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_DCT_FULLNo free buffer for direct transmission
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionIssues a direct transmission request for the frame specified by Frame on the CH specified by Serial and InnerCh, without using slots.