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.
Related Links
- Troubleshooting during migration: Common Issues and Solutions
Migration Overview
The following five points affect implementation when migrating from ADL1L to ADL2L.
- DLL name changes (
MPXCANFDCtrlFree*->MPXCtrlFree*) MPXOpenargument change (Numadded)- CAN API name changes (
MPXSetCANParametc. ->MPXCAN*) - Partial constant name changes (
MPX_MODE_*,CAN_ERR*) MPXGetLogargument type change (StMPXCANLog**->StMPXLog**)
Preconditions to Confirm First
- Old DLL:
MPXCANFDCtrlFree.a/MPXCANFDCtrlFree.so - New DLL:
MPXCtrlFree.a/MPXCtrlFree.so InnerChremains the target channel number (1 or 2)
API Specification Differences (Old -> New)
Common APIs
| ADL1L | ADL2L | Compatibility Impact |
|---|---|---|
MPXGetAPIVersion(StMPXAPIVersion*) | Same | No change |
MPXOpen(StMPXDeviceInfo* Devices, uint8_t* Count) | MPXOpen(StMPXDeviceInfo* Devices, uint8_t Num, uint8_t* Count) | Num argument added |
MPXClose() | Same | No change |
MPXSetLED(...) | Same | No change |
MPXGetStatus(...) | Same | No change |
MPXMonitorStart(...) | Same | No change |
MPXMonitorStop(...) | Same | No change |
MPXGetTimeStamp(...) | Same | No change |
MPXSetLogCallBack(...) | Discontinued | Change to log API mode |
MPXSetGetLogMode(...) | Same | No 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
| ADL1L | ADL2L | Compatibility Impact |
|---|---|---|
MPXSetCANParam | MPXCANSetParam | API name changed |
MPXGetLogEx | MPXCANGetLogEx | API name changed |
MPXSetSlot | MPXCANSetSlot | API name changed |
MPXChangeSlot | MPXCANChangeSlot | API name changed |
MPXSendSlot | MPXCANSendSlot | API name changed |
MPXDirectSend | MPXCANDirectSend | API name changed |
Constants and Structures Migration Points
Operation Mode Constants (Name Changes)
| ADL1L | ADL2L | Value |
|---|---|---|
MPX_MODE_LISTEN | MPX_CAN_MODE_LISTEN | 0 |
MPX_MODE_MONITOR | MPX_CAN_MODE_MONITOR | 1 |
MPX_MODE_CAN_SIM | MPX_CAN_MODE_SIM | 2 |
MPX_MODE_NONE | MPX_CAN_MODE_NONE | 0xFF |
Values are unchanged, but old constant names are not present in ADL2L headers.
CAN Error Constants (Name Changes)
Error Flags
| ADL1L | ADL2L | Value |
|---|---|---|
CAN_ERRFLG_FALSE | MPX_CAN_ERRFLG_FALSE | 0 |
CAN_ERRFLG_TRUE | MPX_CAN_ERRFLG_TRUE | 1 |
Error Details
| ADL1L | ADL2L | Value |
|---|---|---|
CAN_ERR_NONE | MPX_CAN_ERR_NONE | 0x0000 |
CAN_ERR_BUS | MPX_CAN_ERR_BUS | 0x0001 |
CAN_ERR_WARN | MPX_CAN_ERR_WARN | 0x0002 |
CAN_ERR_PASV | MPX_CAN_ERR_PASV | 0x0004 |
CAN_ERR_BUSOFF | MPX_CAN_ERR_BUSOFF | 0x0008 |
CAN_ERR_BUSWAKE | MPX_CAN_ERR_BUSWAKE | 0x0010 |
CAN_ERR_OVERLOAD | MPX_CAN_ERR_OVERLOAD | 0x0020 |
CAN_ERR_BUSLOCK | MPX_CAN_ERR_BUSLOCK | 0x0040 |
CAN_ERR_ARBLOST | MPX_CAN_ERR_ARBLOST | 0x0080 |
CAN_ERR_STAFF | MPX_CAN_ERR_STAFF | 0x0100 |
CAN_ERR_FORM | MPX_CAN_ERR_FORM | 0x0200 |
CAN_ERR_ACK | MPX_CAN_ERR_ACK | 0x0400 |
CAN_ERR_CRC | MPX_CAN_ERR_CRC | 0x0800 |
CAN_ERR_RECEIVE | MPX_CAN_ERR_RECEIVE | 0x1000 |
CAN_ERR_DOMINANT | MPX_CAN_ERR_DOMINANT | 0x2000 |
CAN_ERR_DELIMITER | MPX_CAN_ERR_DELIMITER | 0x4000 |
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).
StMPXCANParamStMPXCANIDStMPXCANFrameOptionStMPXCANFrameTypeStMPXCANFrameStMPXCANSlotStMPXCANDirectStMPXCANLog
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.
- Standardize to
MPXCANGetLogEx(recommended) - Keep using
MPXGetLogand access CAN data viaMisc.CANinStMPXLog
Return Code (ER) Differences
ER codes are the same in ADL1L and ADL2L.
| Constant | Value |
|---|---|
E_OK | 0 |
E_PARAM | 1 |
E_DEVICE | 2 |
E_COMM | 3 |
E_TGT | 4 |
E_TRG_BUSY | 11 |
E_DCT_FULL | 12 |
E_STATUS | 105 |
E_TIMEOUT | 202 |
E_OTHER | 255 |
Implementation Procedure (Replacement Flow)
- Replace DLL references from
MPXCANFDCtrlFree*toMPXCtrlFree* - Update
MPXOpencalls to 3-argument version - Replace CAN API names to
MPXCAN* - Replace
MPX_MODE_*andCAN_ERR*with new constant names - Standardize log acquisition to
MPXCANGetLogEx(or handleMPXGetLogtype 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, ¶m);
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, ¶m);
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, ¶m);
MPXSetSlot(serial, innerCh, slots, 2);
MPXMonitorStart(serial, MPX_SYNC_MASTER);
// ADL2L
param.Mode = MPX_CAN_MODE_SIM;
MPXCANSetParam(serial, innerCh, ¶m);
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.
Standardizing to MPXCANGetLogEx is Recommended
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*toMPXCtrlFree* -
MPXOpenupdated to 3-argument version - CAN APIs such as
MPXSetCANParamreplaced withMPXCAN* -
MPX_MODE_*replaced withMPX_CAN_MODE_* -
CAN_ERR*/CAN_ERRFLG_*replaced withMPX_CAN_ERR*/MPX_CAN_ERRFLG_* -
MPXGetLogExreplaced withMPXCANGetLogEx - If using
MPXGetLog, pointer type changed toStMPXLog** - Basic operation of Open/Param/Monitor/Slot/GetLog verified after replacement
Related Pages
- Common API list: /S810-MX-ADL2L/Common/api_list_common
- Common API details: /S810-MX-ADL2L/Common/api_detail_common
- CAN API list: /S810-MX-ADL2L/CAN/api_list_can
- CAN API details: /S810-MX-ADL2L/CAN/api_detail_can
- CAN structure definitions: /S810-MX-ADL2L/CAN/struct_can