Skip to main content

API Details

This section describes details of each API available in this product.

Legend

This page describes each API in the format below.

Format[Function type] [Function name]([Arguments], ...)
Arguments[Argument type][Argument name][in/out][Argument description]
Return Value[Return type][Return value (error code)][Return value (error code) description]
Function[Function description]
Notes[Notes]

If [Argument type] is a structure, see Structure Definitions (struct) for values to set or values returned.

For [in/out], use in for values set by the caller and out for values set by function processing.

API Details

MPXGetAPIVersion

Gets version information of this API.

FormatER MPXGetAPIVersion(StMPCANVersion * Version)
ArgumentsStMPXAPIVersion *VersionoutAPI version information
Return ValueERE_OKNormal completion
E_PARAMParameter error (such as NULL pointer)
FunctionGets version information of this API.

MPXOpen

Recognizes MicroPeckerX units.

FormatER MPXOpen(StMPXDeviceInfo * Devices, uint8_t * Count)
ArgumentsStMPXDeviceInfo *DevicesoutDevice information of recognized MicroPeckerX units
uint8_t *CountoutNumber of recognized MicroPeckerX units
Return ValueERE_OKNormal completion
E_DEVICEDevice not found
E_COMMCommunication error
E_TIMEOUTCommunication timeout
FunctionRecognizes MicroPeckerX units connected to the PC, and obtains the number of recognized units and their device information.
NotesWhen multiple MicroPeckerX units are connected to the PC, up to four can be recognized simultaneously. However, you cannot arbitrarily specify which units are recognized.

MPXClose

Releases recognition of MicroPeckerX units.

FormatER MPXClose(void)
Return ValueERE_OKNormal completion
FunctionReleases recognition of all currently recognized MicroPeckerX units.

MPXSetLED

Controls LEDs on MicroPeckerX.

FormatER MPXSetLED(uint32_t Serial, uint8_t LEDRed, uint8_t LEDGreen, uint8_t LEDGreenBlink, uint8_t LEDYellow, uint8_t LEDYellowBlink)
Argumentsuint32_tSerialinSerial number of target MicroPeckerX unit
uint8_tLEDRedinRed LED on
(For allowed values, see "LED Settings")
uint8_tLEDGreeninGreen LED on
(For allowed values, see "LED Settings")
uint8_tLEDGreenBlinkinGreen LED blinking
(For allowed values, see "LED Settings")
uint8_tLEDYellowinYellow LED on
(For allowed values, see "LED Settings")
uint8_tLEDYellowBlinkinYellow LED blinking
(For allowed values, see "LED Settings")
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_TIMEOUTCommunication timeout
FunctionControls LEDs on the MicroPeckerX unit specified by Serial.
For the red LED, setting MPX_LED_ON in LEDRed turns it on, and MPX_LED_OFF turns it off.
For the green LED, setting MPX_LED_ON in LEDGreen turns it on, and MPX_LED_OFF turns it off. If MPX_LED_ON is set in LEDGreenBlink, it blinks regardless of LEDGreen.
For the yellow LED, setting MPX_LED_ON in LEDYellow turns it on, and MPX_LED_OFF turns it off. If MPX_LED_ON is set in LEDYellowBlink, it blinks regardless of LEDYellow.

MPXGetStatus

Gets status of the MicroPeckerX unit.

FormatER MPCANGetStatus(uint32_t Serial, uint16_t * StatusCh1, uint16_t * StatusCh2)
Argumentsuint32_tSerialinSerial number of target MicroPeckerX unit
uint16_t *StatusCh1outStatus of CH1
(For set values, see "MicroPeckerX Status")
uint16_t *StatusCh2outStatus of CH2
(For set values, see "MicroPeckerX Status")
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_TIMEOUTCommunication timeout
FunctionGets status of each channel on the MicroPeckerX unit specified by Serial.

MPXMonitorStart

Starts monitoring.

FormatER MPXMonitorStart(uint32_t Serial, uint8_t SyncMode)
Argumentsuint32_tSerialinSerial number of target MicroPeckerX unit
uint8_tSyncModeinSynchronization mode
(For allowed values, see "[Synchronization mode](/S810-MX-ADL1L/Definition/define#Synchronization mode)")
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionStarts monitoring on the MicroPeckerX unit specified by Serial.
If MPX_SYNC_MASTER is specified for SyncMode, it operates in master mode; if MPX_SYNC_SLAVE is specified, it operates in slave mode.
If slot information has been set with MPXSetSlot, frame transmission also starts for slots whose frame type is MPX_CAN_FRAME_TYPE_PERIODIC or MPX_CAN_FRAME_TYPE_EVENTPERIODIC.
NotesBefore starting monitoring with this API, call MPXSetCANParam to configure communication parameters.
When operating multiple MicroPeckerX units, start monitoring on all units running in slave mode first, then start monitoring on the unit running in master mode.

MPXMonitorStop

Stops monitoring.

FormatER MPXMonitorStop(uint32_t Serial, uint32_t * mSec, uint16_t * uSec)
Argumentsuint32_tSerialinSerial number of target MicroPeckerX unit
uint32_t *mSecoutTimestamp (milliseconds)
uint16_t *uSecoutTimestamp (microseconds)
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionStops monitoring on the MicroPeckerX unit specified by Serial and obtains the timestamp at that point.
The timestamp set in mSec and uSec indicates that received logs up to that point are guaranteed.
NotesWhen operating multiple MicroPeckerX units, stop monitoring on the master-mode unit first, then sequentially stop monitoring on slave-mode units.

MPXGetTimeStamp

Gets timestamp.

FormatER MPXGetTimeStamp(uint32_t Serial, uint32_t * mSec, uint16_t * uSec)
Argumentsuint32_tSerialinSerial number of target MicroPeckerX unit
uint32_t *mSecoutTimestamp (milliseconds)
uint16_t *uSecoutTimestamp (microseconds)
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionGets the current timestamp of the MicroPeckerX unit specified by Serial.
The acquired timestamp is stored in mSec and uSec.
NotesNote that the timestamp values stored in mSec and uSec may have a time lag from the exact API call timing.

MPXSetGetLogMode

Sets the method for acquiring log information (transmit/receive data) during monitoring.

FormatER MPXSetGetLogMode(uint32_t Serial, uint8_t InnerCh, uint8_t Mode)
Argumentsuint32_tSerialinSerial number of target MicroPeckerX unit
uint8_tInnerChinTarget channel number (1 or 2)
uint8_tModeinLog acquisition mode
(For allowed values, see "Log Acquisition Mode")
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
FunctionSets how log information sent from the channel specified by Serial and InnerCh is received.
If MPX_GETLOG_CALLBACK is specified in Mode, callback function mode is used. If MPX_GETLOG_GETLOGAPI is specified, log acquisition API mode is used.
NotesIf callback function mode is set, call MPXSetLogCallBack to set the callback function used to acquire log information.
If log acquisition API mode is set, call MPXGetLog or MPXGetLogEx periodically to acquire log information.

MPXSetLogCallBack

Sets a callback function for acquiring log information (transmit/receive data) during monitoring.

FormatER MPXSetLogCallBack(uint32_t Serial, uint8_t InnerCh, void * Self, uint8_t ** Log1, uint8_t ** Log2, void (* CallBack) (uint32_t, uint8_t, void *, uint8_t, uint16_t))
Argumentsuint32_tSerialinSerial number of target MicroPeckerX unit
uint8_tInnerChinTarget channel number (1 or 2)
void *SelfinCaller class pointer
uint8_t **Log1inPointer to array storing log information
uint8_t **Log2inPointer to array storing log information
Function pointerCallBackinPointer to callback function
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
FunctionSets a callback function for acquiring log information sent from the channel specified by Serial and InnerCh.
The callback function arguments specified by CallBack are as follows.
[Argument 1: uint32_t] Serial number of the target MicroPeckerX
[Argument 2: uint8_t] Target channel number (1 or 2)
[Argument 3: void *] Caller class pointer
[Argument 4: uint8_t] Log destination (1 for Log1, 2 for Log2)
[Argument 5: uint16_t] Number of valid logs (not size)
NotesThis API is valid only when acquiring logs in callback function mode.

MPXGetLog

Acquires log information (transmit/receive data) during monitoring from the log-structure buffer allocated in the DLL.

FormatER MPXGetLog(uint32_t Serial, uint8_t InnerCh, StMPXCANLog ** Log, uint16_t * Count, uint8_t * BufferOver)
Argumentsuint32_tSerialinSerial number of target MicroPeckerX unit
uint8_tInnerChinTarget channel number (1 or 2)
StMPXCANLog **LogoutPointer to log information structure array
uint16_t *CountoutNumber of acquired log entries
uint8_t *BufferOveroutBuffer overrun
(For set values, see "Buffer Overrun Flag")
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
FunctionAcquires log information sent from the channel specified by Serial and InnerCh.
For acquired logs, the head pointer of the log-structure buffer allocated in the DLL is set to Log, and the number of logs is set to Count.
If a buffer overrun occurs, MPX_LOG_BUFOVER_TRUE is set to BufferOver.
NotesThis API is valid only when acquiring logs in log acquisition API mode.
With this API, the caller does not need to prepare a structure array for storing acquired logs.

MPXGetLogEx

Acquires log information (transmit/receive data) during monitoring into a log-structure array prepared by the caller.

FormatER MPXGetLog(uint32_t Serial, uint8_t InnerCh, StMPXCANLog * Log, uint16_t Num, uint16_t * Count, uint8_t * BufferOver)
Argumentsuint32_tSerialinSerial number of target MicroPeckerX unit
uint8_tInnerChinTarget channel number (1 or 2)
StMPXCANLog *Login/outLog information structure array
uint16_tNuminNumber of elements in the log information structure array
uint16_t *CountoutNumber of acquired log entries
uint8_t *BufferOveroutBuffer overrun
(For set values, see "Buffer Overrun Flag")
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
FunctionAcquires log information sent from the channel specified by Serial and InnerCh.
Specify in Log a structure array for storing acquired logs, and in Num the number of elements in that array.
The number of acquired logs is set to Count.
If Count is greater than Num, a buffer overrun occurs and MPX_LOG_BUFOVER_TRUE is set to BufferOver.
NotesThis API is valid only when acquiring logs in log acquisition API mode.
With this API, the caller must prepare a structure array to store acquired logs.

MPXSetCANParam

Sets CAN or CAN FD communication parameters from predefined options.

FormatER MPXSetCANParam(uint32_t Serial, uint8_t InnerCh, StMPXCANParam * Param)
Argumentsuint32_tSerialinSerial number of target MicroPeckerX unit
uint8_tInnerChinTarget channel number (1 or 2)
StMPXCANParam *ParaminPointer to parameter configuration structure
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionFor the channel specified by Serial and InnerCh, sets CAN or CAN FD communication parameters to the values specified in Param.
NotesCalling this API changes MicroPeckerX status to MPX_STATUS_PARAM (waiting for parameter configuration).

MPXSetSlot

Sets CAN or CAN FD slot information before monitoring starts.

FormatER MPXSetSlot(uint32_t Serial, uint8_t InnerCh, StMPXCANSlot * Slots, uint8_t SlotCount)
Argumentsuint32_tSerialinSerial number of target MicroPeckerX unit
uint8_tInnerChinTarget channel number (1 or 2)
StMPXCANSlot *SlotsinSlot information
uint8_tSlotCountinNumber of configured slots
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionFor the channel specified by Serial and InnerCh, sets CAN or CAN FD slot information.
Set in Slots a slot-information structure array for the number of slots to configure, and set in SlotCount the number of elements in that array.
NotesThis API is for setting slot information before monitoring starts.
To set slot information during monitoring, call MPXChangeSlot.

MPXChangeSlot

Sets CAN or CAN FD slot information during monitoring.

FormatER MPCANChangeSlotData(uint32_t Serial, uint8_t InnerCh, uint8_t SlotNo, uint8_t SlotEnabled, uint8_t ReqInfo, StMPXCANFrame * Frame)
Argumentsuint32_tSerialinSerial number of target MicroPeckerX unit
uint8_tInnerChinTarget channel number (1 or 2)
uint8_tSlotNoinTarget slot number (1 to 28)
uint8_tSlotEnabledinSlot enable/disable
(For allowed values, see "Slot Enable/Disable")
uint8_tReqInfoinSlot change request information
(For allowed values, see "[Slot change request information](/S810-MX-ADL1L/Definition/define#Slot change request information)")
StMPXCANFrame *FrameinPointer to frame-attribute structure
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_TRG_BUSYTrigger setting failed
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionFor the channel specified by Serial and InnerCh, sets CAN or CAN FD slot information specified by SlotNo during monitoring.
NotesThis API is for changing slot enable/disable and CAN/CAN FD frame information settings during monitoring.
To set slot information before monitoring starts, call MPXSetSlot.

MPXSendSlot

Requests transmission using a CAN or CAN FD slot.

FormatER MPXSendSlot(uint32_t Serial, uint8_t Inner_Ch, uint8_t SlotNo)
Argumentsuint32_tSerialinSerial number of target MicroPeckerX unit
uint8_tInnerChinTarget channel number (1 or 2)
uint8_tSlotNoinTarget slot number (1 to 28)
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_TRG_BUSYTrigger setting failed
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionFor the channel specified by Serial and InnerCh, requests transmission using the CAN or CAN FD slot specified by SlotNo.
NotesThis API is valid only when, in slot information set by MPXSetSlot, the frame type of the slot specified by SlotNo is MPX_CAN_FRAME_TYPE_PERIODIC or MPX_CAN_FRAME_TYPE_EVENTPERIODIC.

MPXDirectSend

Directly transmits a CAN or CAN FD frame without using a slot.

FormatER MPXDirectSend(uint32_t Serial, uint8_t InnerCh, StMPXCANDirect Frame)
Argumentsuint32_tSerialinSerial number of target MicroPeckerX unit
uint8_tInnerChinTarget channel number (1 or 2)
StMPXCANDirectFrameinTransmission frame
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_DCT_FULLNo free space in direct transmission buffer
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionFor the channel specified by Serial and InnerCh, requests transmission of the frame specified in Frame without using a slot.

MPXSetLogRequestCallBack

Sets a callback function used when the MicroPeckerX unit requests log replay data during operation in log replay mode or burst transfer mode (log replay).

FormatER MPXSetLogRequestCallBack(uint32_t Serial, uint8_t InnerCh, void * Self, void (* CallBack ) (uint32_t, uint8_t, void *, uint8_t, uint16_t))
Argumentsuint32_tSerialinSerial number of target MicroPeckerX unit
uint8_tInnerChinTarget channel number (1 or 2)
void *SelfinCaller class pointer
Function pointerCallBackinPointer to callback function
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
FunctionSets a callback function invoked when transmission of log replay data is requested by the channel specified by Serial and InnerCh on a MicroPeckerX unit.
Callback function arguments are as follows.
[Argument 1: uint32_t] Serial number of the target MicroPeckerX
[Argument 2: uint8_t] Target channel number (1 or 2)
[Argument 3: void *] Caller class pointer
[Argument 4: uint8_t] Log depletion flag
[Argument 5: uint16_t] Acceptable log size (bytes)
NotesThis API is valid only when operation mode is MPX_MODE_CAN_LOGREPLAY or MPX_MODE_CAN_BURST_LOG in communication parameters configured by MPXSetCANParam.

MPXSetLogReplayData

Sends log replay data used in log replay mode or burst transfer mode (log replay) to the MicroPeckerX unit.

FormatER MPXSetLogReplayData (uint32_t Serial, uint8_t InnerCh, uint8_t * Log, uint32_t LogCount)
Argumentsuint32_tSerialinSerial number of target MicroPeckerX unit
uint8_tInnerChinTarget channel number (1 or 2)
uint8_t *LoginLog replay data
uint32_tLogCountinSize of log replay data (bytes)
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_LOG_OVERLog replay data count exceeded
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionFor the channel specified by Serial and InnerCh, sends log replay data.
Set in Log the start address of the log replay data array to send, and set in LogCount the array size.
NotesLog replay data is an array consisting of consecutive frame information entries.For the frame-information structure, see StMPXCANReplayLog. Data (D1 to D64) is variable length.
For each frame information entry, if data length is odd, 1 byte of padding is required after the final data byte (padding value may be arbitrary).
The maximum size of log replay data that can be sent at once is 16,384 bytes.
This API is valid only when operation mode is MPX_MODE_CAN_LOGREPLAY or MPX_MODE_CAN_BURST_LOG in communication parameters configured by MPXSetCANParam.

MPXSetBurstLog

Sets frame information used in burst transfer mode (single frame).

FormatER MPXSetBurstLog(uint32_t Serial, uint8_t InnerCh, StMPXCANSlot * Frame)
Argumentsuint32_tSerialinSerial number of target MicroPeckerX unit
uint8_tInnerChinTarget channel number (1 or 2)
StMPXCANSlot *FrameinFrame information
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionFor the channel specified by Serial and InnerCh, sets burst transfer mode (single frame) frame information specified by Frame.
NotesThis API is valid only when operation mode is MPX_MODE_CAN_BURST_FRM in communication parameters configured by MPXSetCANParam.

MPXSetLogReplayTrigger

Sets trigger conditions for starting log replay data transmission in log replay mode or burst transfer mode (log replay).

FormatER MPXSetLogReplayTrigger(uint32_t Serial, uint8_t InnerCh, uint8_t TriggerType, StMPXCANId TriggerID)
Argumentsuint32_tSerialinSerial number of target MicroPeckerX unit
uint8_tInnerChinTarget channel number (1 or 2)
uint8_tTriggerTypeinTrigger type
(For allowed values, see "[Trigger type](/S810-MX-ADL1L/Definition/define#Trigger type)")
StMPXCANIdTriggerIDinTrigger ID
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionFor the channel specified by Serial and InnerCh, sets trigger conditions for starting transmission of log replay data.
NotesThis API is valid only when operation mode is MPX_MODE_CAN_LOGREPLAY or MPX_MODE_CAN_BURST_LOG in communication parameters configured by MPXSetCANParam.
Do not call this API when operation mode is MPX_MODE_CAN_BURST_FRM.

MPXLogReplayStart

Starts transmission in log replay mode or burst transfer mode.

FormatER MPXLogReplayStart(uint32_t Serial, uint8_t InnerCh)
Argumentsuint32_tSerialinSerial number of target MicroPeckerX unit
uint8_tInnerChinTarget channel number (1 or 2)
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_TRG_BUSYTrigger setting failed
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionFor the channel specified by Serial and InnerCh, starts transmission of log replay data or burst-transfer-mode frames.
NotesIf you want transmission to start immediately after monitoring starts, call this API first and then start monitoring.
This API is valid only when operation mode is one of MPX_MODE_CAN_LOGREPLAY, MPX_MODE_CAN_BURST_FRM, or MPX_MODE_CAN_BURST_LOG in communication parameters configured by MPXSetCANParam.

MPXLogReplayStop

Stops transmission in log replay mode or burst transfer mode.

FormatER MPXLogReplayStop(uint32_t Serial, uint8_t InnerCh)
Argumentsuint32_tSerialinSerial number of target MicroPeckerX unit
uint8_tInnerChinTarget channel number (1 or 2)
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionFor the channel specified by Serial and InnerCh, stops transmission of log replay data or burst-transfer-mode frames.
NotesThis API is valid only when operation mode is one of MPX_MODE_CAN_LOGREPLAY, MPX_MODE_CAN_BURST_FRM, or MPX_MODE_CAN_BURST_LOG in communication parameters configured by MPXSetCANParam.