Skip to main content
Version: 4.00

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.

Migration Overview​

The following 12 points affect implementation when migrating from SDK3N to ADL2N.

  1. Replace MPLINCtrl*.DLL with MPXCtrlFree*.DLL
  2. Replace MPLINOpen with MPXOpen, and implement Serial management
  3. Replace MPLINSetParam with MPXLINSetParam (StMPXLINParam)
  4. Replace LIN_FRM_* (0-3) with MPX_LIN_FRAME_TYPE_* (3-6)
  5. Apply structure differences for StMPLINFrame / StMPLINMasterSimItem / StMPLINLog
  6. Change log acquisition to MPXLINGetLogEx
  7. In MPXSetGetLogMode, specify MPX_INNERCH_LIN (1) for InnerCh
  8. Split old SetMasterItem / SetSlaveItem logic into Set + Change
  9. Update branches based on old ER codes (E_MODE, E_STS, etc.) to new ER codes
  10. For master simulation start, execute SetMasterSchedule after SetMasterSim
  11. Update type notation for API arguments and structure members used in C/C++ to fixed-width integer types
  12. Replace callback-function-mode log acquisition with API-mode log acquisition

Preconditions to Confirm First​

  • Old DLL: MPLINCtrl.DLL / MPLINCtrl_x64.DLL
  • New DLL: MPXCtrlFree.DLL / MPXCtrlFree_x64.DLL
  • MPXLINSetParam has 2 arguments: (Serial, Param)
  • In MPXSetGetLogMode, specify MPX_INNERCH_LIN (1) for InnerCh

Type Notation Changes​

When implementing in C/C++ using MPXCtrlFree.h, the type notation for ADL2N API arguments and structure members has changed to the following fixed-width integer types.

Previous notationADL2N notation
charint8_t
unsigned charuint8_t
unsigned shortuint16_t
unsigned longuint32_t

When MPXCtrlFree.h is included, use the definitions provided by the header file. If API declarations or structure definitions are written independently without using the header file, update them to use the same type notation as MPXCtrlFree.h.

Do not mix old and new type notation in API declarations, callback functions, or structure members, including pointer types.

API Specification Differences (Old -> New)​

Info

Fixed-width integer type notation changes for ADL2N API arguments are described in Type Notation Changes and are omitted as specification differences in this section.

Basic Control / Common​

SDK3NADL2NChange
MPLINGetVersion(StMPLINVersion*)MPXGetAPIVersion(StMPXAPIVersion*)API/structure name changed
MPLINOpen(long* Serial)MPXOpen(StMPXDeviceInfo* Devices, uint8_t Num, uint8_t* 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, uint16_t* StatusCh1, uint16_t* StatusCh2)changed to per-channel status
MPLINMonitorStart()MPXMonitorStart(Serial, SyncMode)Serial/SyncMode added
MPLINMonitorStop(unsigned long* mSec, unsigned short* uSec)MPXMonitorStop(Serial, uint32_t* mSec, uint16_t* uSec)Serial added
MPLINGetTimeStamp(unsigned long* mSec, unsigned short* uSec)MPXGetTimeStamp(Serial, uint32_t* mSec, uint16_t* uSec)Serial added

Log Acquisition​

SDK3NADL2NChange
MPLINGetLog(StMPLINLog** LogPointer, unsigned long* Count, unsigned char* BufferOver)MPXGetLog(Serial, InnerCh, StMPXLog** Log, uint16_t* Count, uint8_t* 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, uint16_t Num, uint16_t* Count, uint8_t* BufferOver)Serial added, Num/Count type changed
noneMPXSetGetLogMode(Serial, InnerCh, Mode)log acquisition mode setting added (may be omitted)

LIN Settings / Simulation​

SDK3NADL2NChange
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
noneMPXLINPauseMasterSchedule(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​

  • SDK3N: MPLINOpen(long* Serial)
  • ADL2N: MPXOpen(StMPXDeviceInfo* Devices, uint8_t Num, uint8_t* Count)

ADL2N enumerates devices first, then caller selects target Serial and passes it to APIs.

Argument Model Change of MPLINSetParam​

SDK3N sets parameters via individual arguments, while ADL2N sets them as one StMPXLINParam structure.

  • Mode -> Param.Mode
  • LINRev -> Param.Revision
  • Baudrate (enum) -> Param.Baudrate (actual bps)
  • SyncBreak/Delimiter/HeaderSpace/ResponseSpace/ByteSpace -> same-name fields
  • WakeupWidth/SleepTime -> same-name fields
  • Added: WakeupWait
  • LINIDSetting -> Param.IDSetting[64]

Baudrate Conversion (Enum -> Actual bps)​

SDK3N ConstantADL2N Param.Baudrate
LIN_PARAM_BR_500500
LIN_PARAM_BR_1K1000
LIN_PARAM_BR_5K5000
LIN_PARAM_BR_10K10000
LIN_PARAM_BR_15K15000
LIN_PARAM_BR_20K20000
LIN_PARAM_BR_25K25000
LIN_PARAM_BR_600600
LIN_PARAM_BR_12001200
LIN_PARAM_BR_24002400
LIN_PARAM_BR_48004800
LIN_PARAM_BR_96009600
LIN_PARAM_BR_1041710417
LIN_PARAM_BR_1440014400
LIN_PARAM_BR_1920019200

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
IdnoneIn ADL2N, array index represents ID
DlcDLName changed
CheckSumTypeCheckSumTypeEquivalent
ReservednoneRemoved

StMPLINIDSettingItem is 4 bytes, while StMPXLINIDSetting is 2 bytes.

Frame-Type Constant Value Change (Important)​

SDK3NValueADL2NValue
LIN_FRM_WAKEUP0MPX_LIN_FRAME_TYPE_WAKEUP3
LIN_FRM_SLEEP1MPX_LIN_FRAME_TYPE_SLEEP4
LIN_FRM_TX2MPX_LIN_FRAME_TYPE_TX5
LIN_FRM_RX3MPX_LIN_FRAME_TYPE_RX6

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
IdIDName changed
DlcDLName changed
Data[8]Data[8]Position changed
CheckSumnoneRemoved
ErrorCodeErrorCodePosition changed
noneReservedAdded
  • SDK3N: Id, Dlc, Data[8], CheckSum, ErrorCode
  • ADL2N: 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​

SDK3NADL2NNotes
EnabledEnabledEquivalent
OneTimeOneTimeEquivalent
Delay (unsigned short)Delay (uint32_t)Type expanded + position changed
FrameKindFrameTypeName changed + value system changed
Reserved[3]ReservedSize 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
uint32_t 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: SchNo max 15 (DDLL_LIN_SCHNO_MAX)
  • ADL2N: SchNo range 0 to 31

If existing app hard-codes old max, review it.

Log Acquisition Flow and Log Structure Change​

ADL2N no longer supports callback-function mode for log acquisition. If the existing application uses callback-function mode, replace it with API mode.
Although log acquisition mode can be set with MPXSetGetLogMode, it is fixed to API mode; calling MPXSetGetLogMode can therefore be omitted.

Log Structure (StMPLINLog -> StMPXLINLog)​

SDK3N (StMPLINLog)ADL2N (StMPXLINLog)Notes
mSecmSecEquivalent
uSecuSecEquivalent
DirDirPosition changed
LogKindTypeName changed
Frame.IdIDFlattened
Frame.DlcDLName changed
Frame.Data[8]Data[64]Size expanded
Frame.CheckSumnoneRemoved
Frame.ErrorCodeErrorCodeFlattened
noneProtocol, SBLen, WakeupWidthAdded

Estimated size increases from 20 bytes to 84 bytes.
Review fixed-length buffers, file format, and IPC shared-memory definitions.

Return Code (ER) Differences​

SDK3NADL2NNotes
E_OK=0E_OK=0same
E_PARAM=1E_PARAM=1same
E_DEVICE=2E_DEVICE=2same
E_COMM=3E_COMM=3same
E_TGT=4E_TGT=4same
E_TRG_BUSY=5E_TRG_BUSY=11value changed
E_MODE=6(none)review branch logic
E_STS=7E_STATUS=105value/name changed
E_OTHER=8E_OTHER=255value changed
(none)E_TIMEOUT=202added

If implementation compares numeric values directly, be sure to replace them with new definitions.

Implementation Procedure (Existing App Replacement Flow)​

  1. Replace DLL references from MPLINCtrl* to MPXCtrlFree*.
  2. Replace MPLINOpen with MPXOpen, and implement Serial management.
  3. Replace MPLINSetParam with MPXLINSetParam and migrate to structure-based settings.
  4. Change log acquisition to MPXLINGetLogEx.
  5. Update LIN simulation APIs to follow the Set/Change split.
  6. 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:

  1. Set schedule contents with MPXLINSetMasterSim
  2. 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++: Device Open and Parameter Setting Replacement Example​

// 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] = {};
uint8_t count = 0;
ER er = MPXOpen(devices, 8, &count);
uint32_t 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;
// Apply per-ID settings to param.IDSetting[...]
for (int i = 0; i < 0x40; i++)
{
if (i < 0x20)
{
param.IDSetting[i].DL = 2;
}
else if (i < 0x30)
{
param.IDSetting[i].DL = 4;
}
else
{
param.IDSetting[i].DL = 8;
}
param.IDSetting[i].CheckSumType = MPX_LIN_PARAM_CS_CLASSIC;
}

er = MPXLINSetParam(serial, &param);

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 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;
var param = new StMPXLINParam();
param.Mode = MPX_LIN_MODE_MONITOR;
param.Revision = MPX_LIN_REV_21;
param.Baudrate = 19200;
param.SyncBreak = 13;
param.Delimiter = 1;
param.HeaderSpace = 1;
param.ResponseSpace = 1;
param.ByteSpace = 1;
param.WakeupWidth = 250;
param.WakeupWait = 0;
param.SleepTime = 4000;

param.IDSetting = new StMPXLINIDSetting[64];
for (int i = 0; i < 0x40; i++)
{
if (i < 0x20)
{
param.IDSetting[i].DL = 2;
}
else if (i < 0x30)
{
param.IDSetting[i].DL = 4;
}
else
{
param.IDSetting[i].DL = 8;
}
param.IDSetting[i].CheckSumType = MPX_LIN_PARAM_CS_CLASSIC;
}

er = MPXCtrl.LINSetParam(serial, ref param);

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 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)

Migration Checklist​

  • DLL references changed from MPLINCtrl* to MPXCtrlFree*
  • MPLINOpen replaced with MPXOpen and Serial management added
  • LIN parameter setting migrated to StMPXLINParam
  • LIN_FRM_* replaced with MPX_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 MPXSetGetLogMode with InnerCh=MPX_INNERCH_LIN, and calls MPXLINGetLogEx
  • Split SetMasterItem / SetSlaveItem processing into Set and Change
  • Reviewed hard-coded schedule upper limit (15)
  • Updated ER numeric-dependent branches
  • Type notation in C/C++ API declarations, callback functions, structure definitions, and related variables updated to fixed-width integer types
  • Log acquisition mode changed from callback-function mode to API mode