Migration Guide from S810-MP-SDK3N (LIN)
This page is an implementation guide for migrating applications created with old LIN-only library S810-MP-SDK3N to S810-MX-ADL2N.
It summarizes API-level differences from the viewpoint of replacing existing code.
Related Links
- Troubleshooting during migration: Common Issues and Solutions
- Migration from other products: Migration from ADL1N, Migration from SDK2N
Migration Overview
The following 10 points affect implementation when migrating from SDK3N to ADL2N.
- Replace
MPLINCtrl*.DLLwithMPXCtrlFree*.DLL - Replace
MPLINOpenwithMPXOpen, and implementSerialmanagement - Replace
MPLINSetParamwithMPXLINSetParam(StMPXLINParam) - Replace
LIN_FRM_*(0-3) withMPX_LIN_FRAME_TYPE_*(3-6) - Apply structure differences for
StMPLINFrame/StMPLINMasterSimItem/StMPLINLog - Change log flow to
MPXSetGetLogMode+MPXLINGetLogEx - In
MPXSetGetLogMode, specifyMPX_INNERCH_LIN(1) forInnerCh - Split old
SetMasterItem/SetSlaveItemlogic intoSet+Change - Update branches based on old ER codes (
E_MODE,E_STS, etc.) to new ER codes - For master simulation start, execute
SetMasterScheduleafterSetMasterSim
Preconditions to Confirm First
- Old DLL:
MPLINCtrl.DLL/MPLINCtrl_x64.DLL - New DLL:
MPXCtrlFree.DLL/MPXCtrlFree_x64.DLL MPXLINSetParamhas 2 arguments:(Serial, Param)- In
MPXSetGetLogMode, specifyMPX_INNERCH_LIN(1) forInnerCh
API Specification Differences (Old -> New)
Basic Control / Common
| SDK3N | ADL2N | Change |
|---|---|---|
MPLINGetVersion(StMPLINVersion*) | MPXGetAPIVersion(StMPXAPIVersion*) | API/structure name changed |
MPLINOpen(long* Serial) | MPXOpen(StMPXDeviceInfo* Devices, unsigned char Num, unsigned char* Count) | changed from single-open to enumeration |
MPLINClose() | MPXClose() | API name changed |
MPLINSetLED(Red, Green, GreenBlink) | MPXSetLED(Serial, LEDRed, LEDGreen, LEDGreenBlink, LEDYellow, LEDYellowBlink) | Serial added, args extended |
MPLINGetStatus(unsigned short* Status) | MPXGetStatus(Serial, unsigned short* StatusCh1, unsigned short* StatusCh2) | changed to per-channel status |
MPLINMonitorStart() | MPXMonitorStart(Serial, SyncMode) | Serial/SyncMode added |
MPLINMonitorStop(unsigned long* mSec, unsigned short* uSec) | MPXMonitorStop(Serial, unsigned long* mSec, unsigned short* uSec) | Serial added |
MPLINGetTimeStamp(unsigned long* mSec, unsigned short* uSec) | MPXGetTimeStamp(Serial, unsigned long* mSec, unsigned short* uSec) | Serial added |
Log Acquisition
| SDK3N | ADL2N | Change |
|---|---|---|
MPLINGetLog(StMPLINLog** LogPointer, unsigned long* Count, unsigned char* BufferOver) | MPXGetLog(Serial, InnerCh, StMPXLog** Log, unsigned short* Count, unsigned char* BufferOver) | common-log model, Serial/InnerCh added, Count type changed |
MPLINGetLogEx(StMPLINLog* Log, unsigned long* Num, unsigned long* Count, unsigned char* BufferOver) | MPXLINGetLogEx(Serial, StMPXLINLog* Log, unsigned short Num, unsigned short* Count, unsigned char* BufferOver) | Serial added, Num/Count type changed |
| none | MPXSetGetLogMode(Serial, InnerCh, Mode) | log mode setting is now required |
LIN Settings / Simulation
| SDK3N | ADL2N | Change |
|---|---|---|
MPLINSetParam(Mode, Baudrate, SyncBreak, Delimiter, HeaderSpace, ResponseSpace, ByteSpace, WakeupWidth, SleepTime, LINIDSetting, LINRev) | MPXLINSetParam(Serial, StMPXLINParam* Param) | many args consolidated into one structure |
MPLINSetLINStatus(Status) | MPXLINSetStatus(Serial, Status) | Serial added |
MPLINSetMasterSim(SchNo, Ena, OneTime, MasterSim, Num) | MPXLINSetMasterSim(Serial, SchNo, MasterSim, Num) | Ena/OneTime responsibility split to another API |
MPLINSetSchedule(SchNo, Ena, OneTime) | MPXLINSetMasterSchedule(Serial, SchNo, Ena, OneTime) | API name/signature changed |
MPLINChangeSchedule(SchNo) | MPXLINChangeMasterSchedule(Serial, SchNo) | API name/signature changed |
| none | MPXLINPauseMasterSchedule(Serial, Ena) | new pause/resume API |
MPLINSetMasterItem(SchNo, ItemNo, MasterSimItem) | MPXLINSetMasterItem(Serial, SchNo, ItemNo, Ena) + MPXLINChangeMasterItem(Serial, SchNo, ItemNo, MasterSimItem) | split enable/disable and content change |
MPLINSetSlaveSim(SlaveSim) | MPXLINSetSlaveSim(Serial, SlaveSim) | Serial added |
MPLINSetSlaveItem(SlaveSimItem) | MPXLINSetSlaveItem(Serial, ResponseID, Ena) + MPXLINChangeSlaveItem(Serial, ResponseID, SlaveSimItem) | explicit target ID + split enable/disable and content change |
MPLINSendMasterInterrupt(MasterSimItem) | MPXLINMasterInterrupt(Serial, MasterSimItem) | API name/signature changed |
MPLINSendSlaveWakeup() | MPXLINSlaveWakeup(Serial) | API name/signature changed |
Structure and Constant Migration Points
Change from MPLINOpen to MPXOpen
- Old SDK3N:
MPLINOpen(long* Serial) - ADL2N:
MPXOpen(StMPXDeviceInfo* Devices, unsigned char Num, unsigned char* Count)
ADL2N enumerates devices first, then caller selects target Serial and passes it to APIs.
Argument Model Change of MPLINSetParam
Old SDK3N sets parameters via individual arguments; ADL2N sets them as one StMPXLINParam structure.
Mode->Param.ModeLINRev->Param.RevisionBaudrate(enum) ->Param.Baudrate(actual bps)SyncBreak/Delimiter/HeaderSpace/ResponseSpace/ByteSpace-> same-name fieldsWakeupWidth/SleepTime-> same-name fields- Added:
WakeupWait LINIDSetting->Param.IDSetting[64]
Baudrate Conversion (Enum -> Actual bps)
| SDK3N Constant | ADL2N Param.Baudrate |
|---|---|
LIN_PARAM_BR_500 | 500 |
LIN_PARAM_BR_1K | 1000 |
LIN_PARAM_BR_5K | 5000 |
LIN_PARAM_BR_10K | 10000 |
LIN_PARAM_BR_15K | 15000 |
LIN_PARAM_BR_20K | 20000 |
LIN_PARAM_BR_25K | 25000 |
LIN_PARAM_BR_600 | 600 |
LIN_PARAM_BR_1200 | 1200 |
LIN_PARAM_BR_2400 | 2400 |
LIN_PARAM_BR_4800 | 4800 |
LIN_PARAM_BR_9600 | 9600 |
LIN_PARAM_BR_10417 | 10417 |
LIN_PARAM_BR_14400 | 14400 |
LIN_PARAM_BR_19200 | 19200 |
LIN Revision
- SDK3N:
LIN_PARAM_REV_13/LIN_PARAM_REV_20/LIN_PARAM_REV_21 - ADL2N:
MPX_LIN_REV_13/MPX_LIN_REV_20/MPX_LIN_REV_21/MPX_LIN_REV_22
MPX_LIN_REV_22 (LIN 2.2) is newly added.
StMPLINIDSettingItem -> StMPXLINIDSetting
SDK3N (StMPLINIDSettingItem) | ADL2N (StMPXLINIDSetting) | Notes |
|---|---|---|
Id | none | In ADL2N, array index represents ID |
Dlc | DL | Name changed |
CheckSumType | CheckSumType | Equivalent |
Reserved | none | Removed |
StMPLINIDSettingItem is 4 bytes, while StMPXLINIDSetting is 2 bytes.
Frame-Type Constant Value Change (Important)
| SDK3N | Value | ADL2N | Value |
|---|---|---|---|
LIN_FRM_WAKEUP | 0 | MPX_LIN_FRAME_TYPE_WAKEUP | 3 |
LIN_FRM_SLEEP | 1 | MPX_LIN_FRAME_TYPE_SLEEP | 4 |
LIN_FRM_TX | 2 | MPX_LIN_FRAME_TYPE_TX | 5 |
LIN_FRM_RX | 3 | MPX_LIN_FRAME_TYPE_RX | 6 |
If values are hard-coded numerically, be sure to update them.
Even if constant names are used, remapping is still required when numeric values are stored in custom config files.
StMPLINFrame -> StMPXLINFrame
SDK3N (StMPLINFrame) | ADL2N (StMPXLINFrame) | Notes |
|---|---|---|
Id | ID | Name changed |
Dlc | DL | Name changed |
Data[8] | Data[8] | Position changed |
CheckSum | none | Removed |
ErrorCode | ErrorCode | Position changed |
| none | Reserved | Added |
Old: Id, Dlc, Data[8], CheckSum, ErrorCode
New: ID, DL, ErrorCode, Reserved, Data[8]
Replacement example:
// SDK3N
item.Frame.Id = 0x12;
item.Frame.Dlc = 8;
item.Frame.Data[0] = 0x55;
// ADL2N
item.Frame.ID = 0x12;
item.Frame.DL = 8;
item.Frame.Data[0] = 0x55;
// CheckSum is not set explicitly
StMPLINMasterSimItem -> StMPXLINMasterSimItem
| SDK3N | ADL2N | Notes |
|---|---|---|
Enabled | Enabled | Equivalent |
OneTime | OneTime | Equivalent |
Delay (unsigned short) | Delay (unsigned long) | Type expanded + position changed |
FrameKind | FrameType | Name changed + value system changed |
Reserved[3] | Reserved | Size changed |
Frame (StMPLINFrame) | Frame (StMPXLINFrame) | Internal layout changed |
Because Delay type is expanded, review variables/casts assuming unsigned short.
Replacement example:
// SDK3N
unsigned short delay = 1000;
item.Delay = delay;
// ADL2N
unsigned long delay = 1000;
item.Delay = delay;
Simulation Update API Responsibility Split
SDK3N SetMasterItem / SetSlaveItem changed settings in one API.
ADL2N splits them as follows:
- Enable/disable only:
MPXLINSetMasterItem/MPXLINSetSlaveItem - Content update:
MPXLINChangeMasterItem/MPXLINChangeSlaveItem
Schedule Number Range
- SDK3N implementation:
SchNomax 15 (DDLL_LIN_SCHNO_MAX) - ADL2N document:
SchNorange 0 to 31
If existing app hard-codes old max, review it.
Log Acquisition Flow and Log Structure Change
In ADL2N, set MPXSetGetLogMode before log acquisition.
- API mode: acquire with
MPXLINGetLogEx - Callback mode: use
MPXSetLogCallBack - Set
InnerChtoMPX_INNERCH_LIN(1)
StMPLINLog -> StMPXLINLog
SDK3N (StMPLINLog) | ADL2N (StMPXLINLog) | Notes |
|---|---|---|
mSec | mSec | Equivalent |
uSec | uSec | Equivalent |
Dir | Dir | Position changed |
LogKind | Type | Name changed |
Frame.Id | ID | Flattened |
Frame.Dlc | DL | Name changed |
Frame.Data[8] | Data[64] | Size expanded |
Frame.CheckSum | none | Removed |
Frame.ErrorCode | ErrorCode | Flattened |
| none | Protocol, SBLen, WakeupWidth | Added |
Estimated size increases from 20 bytes to 84 bytes.
Review fixed-length buffers, file format, and IPC shared-memory definitions.
Implementation Procedure (Existing App Replacement Flow)
- Replace DLL references from
MPLINCtrl*toMPXCtrlFree*. - Replace
MPLINOpenwithMPXOpen, and implementSerialmanagement. - Replace
MPLINSetParamwithMPXLINSetParamand migrate to structure-based settings. - Standardize log acquisition to
MPXSetGetLogMode + MPXLINGetLogEx. - Update LIN simulation APIs to follow the
Set/Changesplit. - Replace ER numeric comparisons with the new definitions.
Language-Specific Replacement Examples
LIN Master Simulation Migration Sequence
In SDK3N, MPLINSetMasterSim could set both content and enable (Ena/OneTime) together.
In ADL2N responsibilities are split, so initial startup requires two steps:
- Set schedule contents with
MPXLINSetMasterSim - Enable schedule and OneTime settings with
MPXLINSetMasterSchedule
// SDK3N (set + enable in one call)
MPLINSetMasterSim(schNo, LIN_SIM_ENA, oneTime, &masterSim, num);
// ADL2N (two steps)
MPXLINSetMasterSim(serial, schNo, &masterSim, num); // set content
MPXLINSetMasterSchedule(serial, schNo, MPX_LIN_SIM_ENA, oneTime); // enable
If SetMasterSchedule is omitted, schedule does not start even if content is configured.
How to Use Master Simulation Update APIs
- Content update only:
MPXLINChangeMasterItem - Enable/disable only:
MPXLINSetMasterItem - Update both content and enable state:
MPXLINChangeMasterItem->MPXLINSetMasterItem - Switch schedule:
MPXLINChangeMasterSchedule - Pause/resume:
MPXLINPauseMasterSchedule
Implementation Replacement Examples
C/C++
// SDK3N
long serial = 0;
ER er = MPLINOpen(&serial);
er = MPLINSetParam(LIN_MODE_MONITOR, LIN_PARAM_BR_20K, 13, 1, 0, 0, 1, 250, 1000, &idSetting, LIN_PARAM_REV_21);
// ADL2N
StMPXDeviceInfo devices[8] = {};
unsigned char count = 0;
ER er = MPXOpen(devices, 8, &count);
unsigned long serial = (count > 0) ? devices[0].Serial : 0;
StMPXLINParam param = {};
param.Mode = MPX_LIN_MODE_MONITOR;
param.Revision = MPX_LIN_REV_21;
param.Baudrate = 20000;
param.SyncBreak = 13;
param.Delimiter = 1;
param.HeaderSpace = 0;
param.ResponseSpace = 0;
param.ByteSpace = 1;
param.WakeupWidth = 250;
param.WakeupWait = 10;
param.SleepTime = 1000;
// reflect ID-based settings in param.IDSetting[...]
er = MPXLINSetParam(serial, ¶m);
er = MPXSetGetLogMode(serial, MPX_INNERCH_LIN, MPX_GETLOGMODE_GETLOGAPI);
StMPXLINLog logs[128] = {};
unsigned short got = 0;
unsigned char over = 0;
er = MPXLINGetLogEx(serial, logs, 128, &got, &over);
C/C++: LIN Master Simulation Replacement Example (Initialize -> Run -> Update)
// SDK3N
// 1) Register master sim + 2) enable in one API
ER er = MPLINSetMasterSim(0, LIN_SIM_ENA, LIN_SIM_DIS, &masterSim, 2);
// 3) change schedule
er = MPLINChangeSchedule(0);
// 4) update item (content + enable/disable)
er = MPLINSetMasterItem(0, 0, &item);
// ADL2N
ER er = MPXLINSetMasterSim(serial, 0, &masterSim, 2); // 1) set content
er = MPXLINSetMasterSchedule(serial, 0, MPX_LIN_SIM_ENA, MPX_LIN_SIM_DIS); // 2) enable
er = MPXLINChangeMasterSchedule(serial, 0); // 3) change schedule
er = MPXLINChangeMasterItem(serial, 0, 0, &item); // 4-1) content update
er = MPXLINSetMasterItem(serial, 0, 0, MPX_LIN_SIM_ENA); // 4-2) enable update
C# (P/Invoke)
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct StMPXDeviceInfo
{
public uint Serial;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public byte[] Model;
}
[DllImport("MPXCtrlFree.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int MPXOpen(
[In, Out] StMPXDeviceInfo[] devices,
byte num,
ref byte count);
[DllImport("MPXCtrlFree.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int MPXLINSetParam(
uint serial,
ref StMPXLINParam param);
[DllImport("MPXCtrlFree.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int MPXSetGetLogMode(
uint serial,
byte innerCh,
byte mode);
[DllImport("MPXCtrlFree.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int MPXLINGetLogEx(
uint serial,
[In, Out] StMPXLINLog[] log,
ushort num,
ref ushort count,
ref byte bufferOver);
var devices = new StMPXDeviceInfo[8];
byte count = 0;
int er = MPXOpen(devices, (byte)devices.Length, ref count);
uint serial = count > 0 ? devices[0].Serial : 0;
er = MPXSetGetLogMode(serial, MPX_INNERCH_LIN, MPX_GETLOGMODE_GETLOGAPI);
C# (P/Invoke): LIN Master Simulation Replacement Example
[DllImport("MPXCtrlFree.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int MPXLINSetMasterSim(uint serial, byte schNo, ref StMPXLINMasterSim sim, byte num);
[DllImport("MPXCtrlFree.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int MPXLINSetMasterSchedule(uint serial, byte schNo, byte ena, byte oneTime);
[DllImport("MPXCtrlFree.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int MPXLINChangeMasterSchedule(uint serial, byte schNo);
[DllImport("MPXCtrlFree.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int MPXLINChangeMasterItem(uint serial, byte schNo, byte itemNo, ref StMPXLINMasterSimItem item);
[DllImport("MPXCtrlFree.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int MPXLINSetMasterItem(uint serial, byte schNo, byte itemNo, byte ena);
int er = MPXLINSetMasterSim(serial, 0, ref sim, 2);
er = MPXLINSetMasterSchedule(serial, 0, MPX_LIN_SIM_ENA, MPX_LIN_SIM_DIS);
er = MPXLINChangeMasterSchedule(serial, 0);
er = MPXLINChangeMasterItem(serial, 0, 0, ref item);
er = MPXLINSetMasterItem(serial, 0, 0, MPX_LIN_SIM_ENA);
Excel VBA
' SDK3N
Declare PtrSafe Function MPLINOpen Lib "MPLINCtrl_x64.DLL" (ByRef Serial As Long) As Long
Declare PtrSafe Function MPLINSetParam Lib "MPLINCtrl_x64.DLL" (...) As Long
' ADL2N
Declare PtrSafe Function MPXOpen Lib "MPXCtrlFree_x64.DLL" (ByRef Devices As StMPXDeviceInfo, ByVal Num As Byte, ByRef Count As Byte) As Long
Declare PtrSafe Function MPXLINSetParam Lib "MPXCtrlFree_x64.DLL" (ByVal Serial As Long, ByRef Param As StMPXLINParam) As Long
Declare PtrSafe Function MPXSetGetLogMode Lib "MPXCtrlFree_x64.DLL" (ByVal Serial As Long, ByVal InnerCh As Byte, ByVal Mode As Byte) As Long
Declare PtrSafe Function MPXLINGetLogEx Lib "MPXCtrlFree_x64.DLL" (ByVal Serial As Long, ByRef Log As StMPXLINLog, ByVal Num As Integer, ByRef Count As Integer, ByRef BufferOver As Byte) As Long
Declare PtrSafe Function MPXLINSetMasterSim Lib "MPXCtrlFree_x64.DLL" (ByVal Serial As Long, ByVal SchNo As Byte, ByRef MasterSim As StMPXLINMasterSim, ByVal Num As Byte) As Long
Declare PtrSafe Function MPXLINSetMasterSchedule Lib "MPXCtrlFree_x64.DLL" (ByVal Serial As Long, ByVal SchNo As Byte, ByVal Ena As Byte, ByVal OneTime As Byte) As Long
Declare PtrSafe Function MPXLINChangeMasterSchedule Lib "MPXCtrlFree_x64.DLL" (ByVal Serial As Long, ByVal SchNo As Byte) As Long
Declare PtrSafe Function MPXLINChangeMasterItem Lib "MPXCtrlFree_x64.DLL" (ByVal Serial As Long, ByVal SchNo As Byte, ByVal ItemNo As Byte, ByRef MasterSimItem As StMPXLINMasterSimItem) As Long
Declare PtrSafe Function MPXLINSetMasterItem Lib "MPXCtrlFree_x64.DLL" (ByVal Serial As Long, ByVal SchNo As Byte, ByVal ItemNo As Byte, ByVal Ena As Byte) As Long
For VBA, using MPXLINGetLogEx as primary log acquisition path is practical in ADL2N as well.
Excel VBA: LIN Master Simulation Replacement Example
' SDK3N (set + enable in one call)
Ret = MPLINSetMasterSim(SchNo, LIN_SIM_ENA, LIN_SIM_DIS, MasterSim, Num)
' ADL2N (two steps)
Ret = MPXLINSetMasterSim(Serial, SchNo, MasterSim, Num)
Ret = MPXLINSetMasterSchedule(Serial, SchNo, MPX_LIN_SIM_ENA, MPX_LIN_SIM_DIS)
Ret = MPXLINChangeMasterSchedule(Serial, SchNo)
Ret = MPXLINChangeMasterItem(Serial, SchNo, 0, MasterSimItem)
Ret = MPXLINSetMasterItem(Serial, SchNo, 0, MPX_LIN_SIM_ENA)
Return Code (ER) Differences
| SDK3N | ADL2N | Notes |
|---|---|---|
E_OK=0 | E_OK=0 | same |
E_PARAM=1 | E_PARAM=1 | same |
E_DEVICE=2 | E_DEVICE=2 | same |
E_COMM=3 | E_COMM=3 | same |
E_TGT=4 | E_TGT=4 | same |
E_TRG_BUSY=5 | E_TRG_BUSY=11 | value changed |
E_MODE=6 | (none) | review branch logic |
E_STS=7 | E_STATUS=105 | value/name changed |
E_OTHER=8 | E_OTHER=255 | value changed |
| (none) | E_TIMEOUT=202 | added |
If implementation compares numeric values directly, be sure to replace them with new definitions.
Migration Checklist
- DLL references changed from
MPLINCtrl*toMPXCtrlFree* -
MPLINOpenreplaced withMPXOpenandSerialmanagement added - LIN parameter setting migrated to
StMPXLINParam -
LIN_FRM_*replaced withMPX_LIN_FRAME_TYPE_*(including hard-coded numerics) - Applied differences for
StMPLINFrame/StMPLINMasterSimItem/StMPLINIDSettingItem/StMPLINLog - Changed master-simulation initial start to two steps:
SetMasterSim -> SetMasterSchedule - Added
MPXSetGetLogModewithInnerCh=MPX_INNERCH_LIN, and callsMPXLINGetLogEx - Split
SetMasterItem/SetSlaveItemprocessing intoSetandChange - Reviewed hard-coded schedule upper limit (15)
- Updated ER numeric-dependent branches
Related Pages
- Common API details: /S810-MX-ADL2N/Common/api_detail_common
- LIN API list: /S810-MX-ADL2N/LIN/api_list_lin
- LIN API details: /S810-MX-ADL2N/LIN/api_detail_lin
- LIN structure definitions: /S810-MX-ADL2N/LIN/struct_lin
- LIN constant definitions: /S810-MX-ADL2N/LIN/define_lin