Skip to main content

Migration Guide from S810-MX-ADL1L (CAN/CAN FD)

This page summarizes implementation differences when migrating from S810-MX-ADL1L (old) to S810-MX-ADL2L (new), focusing on code replacement. Target protocol is CAN/CAN FD.

Migration Overview​

The following five points affect implementation when migrating from ADL1L to ADL2L.

  1. DLL name changes (MPXCANFDCtrlFree* -> MPXCtrlFree*)
  2. MPXOpen argument change (Num added)
  3. CAN API name changes (MPXSetCANParam etc. -> MPXCAN*)
  4. Partial constant name changes (MPX_MODE_*, CAN_ERR*)
  5. MPXGetLog argument type change (StMPXCANLog** -> StMPXLog**)

Preconditions to Confirm First​

  • Old DLL: MPXCANFDCtrlFree.a / MPXCANFDCtrlFree.so
  • New DLL: MPXCtrlFree.a / MPXCtrlFree.so
  • InnerCh remains the target channel number (1 or 2)

API Specification Differences (Old -> New)​

Common APIs​

ADL1LADL2LCompatibility Impact
MPXGetAPIVersion(StMPXAPIVersion*)SameNo change
MPXOpen(StMPXDeviceInfo* Devices, uint8_t* Count)MPXOpen(StMPXDeviceInfo* Devices, uint8_t Num, uint8_t* Count)Num argument added
MPXClose()SameNo change
MPXSetLED(...)SameNo change
MPXGetStatus(...)SameNo change
MPXMonitorStart(...)SameNo change
MPXMonitorStop(...)SameNo change
MPXGetTimeStamp(...)SameNo change
MPXSetLogCallBack(...)DiscontinuedChange to log API mode
MPXSetGetLogMode(...)SameNo change when using log API mode; change callback mode usage to log API mode
Can be omitted
MPXGetLog(uint32_t, uint8_t, StMPXCANLog**, uint16_t*, uint8_t*)MPXGetLog(uint32_t, uint8_t, StMPXLog**, uint16_t*, uint8_t*)3rd argument type changed

CAN/CAN FD APIs​

ADL1LADL2LCompatibility Impact
MPXSetCANParamMPXCANSetParamAPI name changed
MPXGetLogExMPXCANGetLogExAPI name changed
MPXSetSlotMPXCANSetSlotAPI name changed
MPXChangeSlotMPXCANChangeSlotAPI name changed
MPXSendSlotMPXCANSendSlotAPI name changed
MPXDirectSendMPXCANDirectSendAPI name changed

Constants and Structures Migration Points​

Operation Mode Constants (Name Changes)​

ADL1LADL2LValue
MPX_MODE_LISTENMPX_CAN_MODE_LISTEN0
MPX_MODE_MONITORMPX_CAN_MODE_MONITOR1
MPX_MODE_CAN_SIMMPX_CAN_MODE_SIM2
MPX_MODE_NONEMPX_CAN_MODE_NONE0xFF

Values are unchanged, but old constant names are not present in ADL2L headers.

CAN Error Constants (Name Changes)​

Error Flags​

ADL1LADL2LValue
CAN_ERRFLG_FALSEMPX_CAN_ERRFLG_FALSE0
CAN_ERRFLG_TRUEMPX_CAN_ERRFLG_TRUE1

Error Details​

ADL1LADL2LValue
CAN_ERR_NONEMPX_CAN_ERR_NONE0x0000
CAN_ERR_BUSMPX_CAN_ERR_BUS0x0001
CAN_ERR_WARNMPX_CAN_ERR_WARN0x0002
CAN_ERR_PASVMPX_CAN_ERR_PASV0x0004
CAN_ERR_BUSOFFMPX_CAN_ERR_BUSOFF0x0008
CAN_ERR_BUSWAKEMPX_CAN_ERR_BUSWAKE0x0010
CAN_ERR_OVERLOADMPX_CAN_ERR_OVERLOAD0x0020
CAN_ERR_BUSLOCKMPX_CAN_ERR_BUSLOCK0x0040
CAN_ERR_ARBLOSTMPX_CAN_ERR_ARBLOST0x0080
CAN_ERR_STAFFMPX_CAN_ERR_STAFF0x0100
CAN_ERR_FORMMPX_CAN_ERR_FORM0x0200
CAN_ERR_ACKMPX_CAN_ERR_ACK0x0400
CAN_ERR_CRCMPX_CAN_ERR_CRC0x0800
CAN_ERR_RECEIVEMPX_CAN_ERR_RECEIVE0x1000
CAN_ERR_DOMINANTMPX_CAN_ERR_DOMINANT0x2000
CAN_ERR_DELIMITERMPX_CAN_ERR_DELIMITER0x4000

Major Constants with No Change​

The following definitions are unchanged between ADL1L and ADL2L.

  • MPX_CAN_PARAM_ABR_*
  • MPX_CAN_PARAM_SP_*
  • MPX_CAN_PARAM_DBR_*
  • MPX_CAN_FRAME_TYPE_*
  • MPX_CAN_SLOT_*
  • MPX_CAN_PROTOCOL_*
  • MPX_CAN_BRS_*
  • MPX_CAN_IDE_*
  • MPX_CAN_RTR_*
  • MPX_CAN_SIM_INC_*

CAN Structure Compatibility​

CAN-related structures are compatible between ADL1L and ADL2L (same names and layouts).

  • StMPXCANParam
  • StMPXCANID
  • StMPXCANFrameOption
  • StMPXCANFrameType
  • StMPXCANFrame
  • StMPXCANSlot
  • StMPXCANDirect
  • StMPXCANLog

MPXGetLog Type Change​

MPXGetLog keeps the same function name but return pointer type changed.

  • ADL1L: StMPXCANLog**
  • ADL2L: StMPXLog**

When migrating, use one of the following.

  1. Standardize to MPXCANGetLogEx (recommended)
  2. Keep using MPXGetLog and access CAN data via Misc.CAN in StMPXLog

Return Code (ER) Differences​

ER codes are the same in ADL1L and ADL2L.

ConstantValue
E_OK0
E_PARAM1
E_DEVICE2
E_COMM3
E_TGT4
E_TRG_BUSY11
E_DCT_FULL12
E_STATUS105
E_TIMEOUT202
E_OTHER255

Implementation Procedure (Replacement Flow)​

  1. Replace DLL references from MPXCANFDCtrlFree* to MPXCtrlFree*
  2. Update MPXOpen calls to 3-argument version
  3. Replace CAN API names to MPXCAN*
  4. Replace MPX_MODE_* and CAN_ERR* with new constant names
  5. Standardize log acquisition to MPXCANGetLogEx (or handle MPXGetLog type change)

Language-Specific Replacement Examples​

C/C++ Replacement Example​

// ADL1L
StMPXDeviceInfo devs[8] = {};
uint8_t count = 0;
ER er = MPXOpen(devs, &count);
uint32_t serial = (count > 0) ? devs[0].Serial : 0;
er = MPXSetCANParam(serial, innerCh, &param);
er = MPXGetLogEx(serial, innerCh, logs, num, &got, &over);

// ADL2L
StMPXDeviceInfo devs[8] = {};
uint8_t count = 0;
ER er = MPXOpen(devs, 8, &count);
uint32_t serial = (count > 0) ? devs[0].Serial : 0;
er = MPXCANSetParam(serial, innerCh, &param);
er = MPXCANGetLogEx(serial, innerCh, logs, num, &got, &over);

C/C++ CAN/CAN FD Simulation Replacement Example​

// ADL1L
param.Mode = MPX_MODE_CAN_SIM;
MPXSetCANParam(serial, innerCh, &param);
MPXSetSlot(serial, innerCh, slots, 2);
MPXMonitorStart(serial, MPX_SYNC_MASTER);

// ADL2L
param.Mode = MPX_CAN_MODE_SIM;
MPXCANSetParam(serial, innerCh, &param);
MPXCANSetSlot(serial, innerCh, slots, 2);
MPXMonitorStart(serial, MPX_SYNC_MASTER);

Replacement Guidance for APIs with Large Differences​

Notes When Continuing to Use MPXGetLog​

In ADL2L, MPXGetLog returns StMPXLog**. When accessing CAN logs, refer to Misc.CAN.

Existing code using MPXGetLogEx can migrate by replacing API name only. Therefore standardizing to MPXCANGetLogEx is the safest approach.

Migration Checklist​

  • DLL names changed from MPXCANFDCtrlFree* to MPXCtrlFree*
  • MPXOpen updated to 3-argument version
  • CAN APIs such as MPXSetCANParam replaced with MPXCAN*
  • MPX_MODE_* replaced with MPX_CAN_MODE_*
  • CAN_ERR* / CAN_ERRFLG_* replaced with MPX_CAN_ERR* / MPX_CAN_ERRFLG_*
  • MPXGetLogEx replaced with MPXCANGetLogEx
  • If using MPXGetLog, pointer type changed to StMPXLog**
  • Basic operation of Open/Param/Monitor/Slot/GetLog verified after replacement