MicroPeckerX CAN FD Application Development Library for Windows
Frequently asked questions about the MicroPeckerX CAN FD Application Development Library for Windows.
Product Specifications
・Check that the USB cable is securely connected, and try a different cable or USB port.
・Verify in Device Manager that "MicroPeckerX" is listed.
・If the driver is not installed correctly, reinstall the latest USB driver from the download folder or the website.
If the device is still not recognized, try restarting the PC or unplugging other USB devices.
・This error occurs if the MicroPeckerX hardware is not connected correctly or is already in use by another application.
・Make sure the USB driver is installed properly.
・Confirm that the firmware and library versions match the version of the sample program.
The return value of the MPXOpen function stores the serial number information of all connected MicroPeckerX units in the StMPXDeviceInfo array.
You can select the target device from the array and control it accordingly.
// Sample code
StMPXDeviceInfo devices[4];
unsigned char count;
ER ret = MPXOpen(devices, &count);
if (ret == E_OK && count > 0) {
for (int i = 0; i < count; i++) {
printf("Serial No: %u\n", devices[i].Serial);
// Use devices[i].Serial to identify each unit
}
}
・Use the MPXSetCANParam function to configure communication parameters correctly (baud rate, sample point, CAN FD mode, termination, etc.).
・After setting the parameters, start monitoring with MPXMonitorStart.
・Make sure the communication conditions (baud rate, etc.) match the other CAN devices.
・Check whether termination resistors are enabled as needed.
// Sample code: configuring CAN parameters and starting communication
StMPXCANParam param;
param.Mode = MPX_MODE_CAN_SIM; // or MPX_MODE_MONITOR
param.ArbitrationBaudrate = MPX_CAN_PARAM_ABR_500K;
param.ArbitrationSamplepoint = MPX_CAN_PARAM_SP_80P;
param.DataBaudrate = MPX_CAN_PARAM_DBR_2M;
param.DataSamplepoint = MPX_CAN_PARAM_SP_80P;
param.EnableTerminate = MPX_CAN_TERMINATE_ENABLE;
ER ret = MPXSetCANParam(serial, 1, ¶m); // For CH1
if (ret != E_OK) {
printf("MPXSetCANParam : error\n");
}
ret = MPXMonitorStart(serial, MPX_SYNC_MASTER); // Start monitoring
if (ret != E_OK) {
printf("MonitorStart : error\n");
}
・For slot-based transmission, use MPXSetSlot to configure the StMPXCANSlot structure with the data content, cycle, and other settings before transmitting.
・For direct transmission, use MPXDirectSend to specify the transmission data directly.
Refer to the bundled sample code for more details.
// Sample code: slot-based (periodic) transmission
StMPXCANSlot slot;
memset(&slot, 0, sizeof(slot));
slot.SlotNo = 0;
slot.FrameType.Enabled = MPX_CAN_SLOT_ENABLE;
slot.FrameType.FrameType = MPX_CAN_FRAME_TYPE_PERIODIC;
slot.FrameType.Option.Protocol = MPX_CAN_PROTOCOL_CANFD;
slot.FrameType.Option.BRS = MPX_CAN_BRS_ENABLE;
slot.Frame.ID.IDE = MPX_CAN_IDE_STD;
slot.Frame.ID.RTR = MPX_CAN_RTR_DATA;
slot.Frame.ID.ID = 0x300;
slot.msSendCycle = 10; // Transmit every 10 ms
slot.SendCounter = 0; // Unlimited
slot.Frame.DL = 8;
for (int i = 0; i < 8; i++) slot.Frame.Data[i] = i;
ER ret = MPXSetSlot(serial, 1, &slot, 1); // Configure slot on CH1
// Sample code: direct (single-shot) transmission
StMPXCANDirect frame;
memset(&frame, 0, sizeof(frame));
frame.FrameType.Option.Protocol = MPX_CAN_PROTOCOL_CANFD;
frame.FrameType.Option.BRS = MPX_CAN_BRS_ENABLE;
frame.Frame.ID.IDE = MPX_CAN_IDE_STD;
frame.Frame.ID.RTR = MPX_CAN_RTR_DATA;
frame.Frame.ID.ID = 0x350;
frame.Frame.DL = 8;
for (int i = 0; i < 8; i++) frame.Frame.Data[i] = i + 0x10;
ret = MPXDirectSend(serial, 1, &frame); // Transmit on CH1
・The library supports both CAN FD and Classic CAN. To operate in Classic CAN mode, disable FD features when configuring the communication parameters and set the data baud rate equal to the arbitration baud rate.
// Sample settings for Classic CAN
param.Mode = MPX_MODE_MONITOR; // Classic CAN
param.ArbitrationBaudrate = MPX_CAN_PARAM_ABR_500K;
param.DataBaudrate = MPX_CAN_PARAM_DBR_500K; // Use the same value
param.FrameType.Option.Protocol = MPX_CAN_PROTOCOL_CAN; // Disable CAN FD features
Transmission and slot configuration use the same interface as CAN FD.
After unplugging the USB cable, restart the application or perform MPXClose followed by MPXOpen to reinitialize the connection. Depending on the OS, it may take a few seconds to recognize the device again, so please wait before operating.
Open the provided Visual Studio project (.sln file), select the platform and configuration (Release/Debug, x86/x64) as needed, and build. Also make sure the required DLLs and library files are placed in the execution folder.
// Example build steps in Visual Studio (C++)
1. Open the .sln (solution) file in Visual Studio.
2. Click [Build] → [Build Solution].
3. Switch between the "x86" and "x64" configurations as necessary.
4. The executable will be generated in the Release or Debug folder.
Operation has been confirmed on 64-bit versions of Windows 10 and Windows 11, and on Visual Studio 2017/2019/2022. Other environments may work, but they are outside the scope of official support.