High Performance, Low Effort – Unlock CAN with SUNCAN API Introduction
High Performance, Low Effort – Unlock CAN with SUNCAN API Introduction
In Windows, there is no unified network interface API like SocketCAN in Linux. Instead, each CAN vendor must provide its own API for users to develop CAN applications. This means that each vendor's CAN provides its own control method through its proprietary API. Therefore, providing a clear, efficient, and easy-to-use library is crucial, as it can significantly reduce the user's development effort and cost.
SDC API
The SDC API is a simple, efficient, easy-to-use, high integration, and versatile library. This library supports the full range of SDC products, including Digital IO and CAN. In this document, we focus on CAN control.
The Advantages of the SUNCAN API
Device de-identification and dynamic enumeration of CAN identities
Most third-party CAN products require a hardware identifier to specify which device to control. SUNCAN de-identifies devices and uses dynamic enumeration to generate CAN indexes. Users do not need to query any device ID; after enumeration, all available CAN indexes in the system are provided, along with information indicating which device each index belongs to.
extern "C" SDCIO_API INT Enumerate_can_info(PCAN_BASIC_INFO_LIST CanBasicInfoListPtr);
typedef struct _CAN_BASIC_INFO {
INT CanIndex;
UCHAR Model;
INT PciNumber;
INT Version;
} CAN_BASIC_INFO, *PCAN_BASIC_INFO;
CAN 2.0 and CAN FD Tx/Rx Function Integration
SUNCAN adds a "CAN Type" (CAN2.0/CAN FD) parameter, allowing users to transmit and receive both CAN2.0 and CAN FD frames using a single TX/RX function. This significantly improves simplicity and code readability.
extern "C" SDCIO_API INT Can_write_data(INT CanIndex, UINT CanType, UINT Id,
UCHAR *Data, UINT DataLen,
UINT MessageTypeFlags, INT Timeout);
extern "C" SDCIO_API INT Can_read_data(INT CanIndex, PCAN_READ_DATA_LIST CanReadDataListPtr);
Easily configure CAN FD arbitration bitrate and data bitrate
Some brands of CAN FD require configuring complex bit timing parameters manually. SUNIX eliminates this burden by pre-calculating the necessary values — users only need to enter the desired arbitration bitrate and data bitrate.
extern "C" SDCIO_API INT Can_set_bitrate_fd(INT CanIndex, UCHAR ArbitBitrate, UCHAR DataBitrate);
extern "C" SDCIO_API INT Can_set_bitrate_with_samplepoint_fd(INT CanIndex,
UCHAR ArbitBitrate, UCHAR DataBitrate, UINT ArbitSamplePoint, UINT DataSamplePoint);
CAN FD hardware filter (32 acceptable IDs)
SUNIX provides direct configuration of 32 acceptable IDs, eliminating the need for users to calculate hardware filter masks themselves.
typedef struct _ID_MESSAGEFILTER_LIST {
INT IdFilterAmount;
ID_MESSAGEFILTER IdMessageFilter[32];
} ID_MESSAGEFILTER_LIST, *PID_MESSAGEFILTER_LIST;
Software-controlled CAN termination
Provides software-controlled CAN termination, eliminating the need for physical jumpers or switches.
extern "C" SDCIO_API INT Can_set_termination(INT CanIndex, UCHAR Termination);
Note: Some SUNIX products still use a hardware termination jumper, in which case software control will be ineffective.
Two types of Rx functions – Polling & Callback
The SUNCAN API supports both polling and event-driven callback mechanisms, allowing developers to choose the best method based on their environment and requirements.
Polling
extern "C" SDCIO_API INT Can_read_data(INT CanIndex, PCAN_READ_DATA_LIST CanReadDataListPtr);
Callback function
typedef void(*CanReadDataCallbackFunc)(INT CanIndex, PCAN_READ_DATA_LIST CanReadDataListPtr);
extern "C" SDCIO_API INT Can_set_read_data_callback(INT CanIndex, CanReadDataCallbackFunc Callback);
High Performance, Low Effort – Unlock CAN with SUNCAN API Introduction
High Performance, Low Effort – Unlock CAN with SUNCAN API Introduction
In Windows, there is no unified network interface API like SocketCAN in Linux. Instead, each CAN vendor must provide its own API for users to develop CAN applications. This means that each vendor's CAN provides its own control method through its proprietary API. Therefore, providing a clear, efficient, and easy-to-use library is crucial, as it can significantly reduce the user's development effort and cost.
SDC API
The SDC API is a simple, efficient, easy-to-use, high integration, and versatile library. This library supports the full range of SDC products, including Digital IO and CAN. In this document, we focus on CAN control.
The Advantages of the SUNCAN API
Device de-identification and dynamic enumeration of CAN identities
Most third-party CAN products require a hardware identifier to specify which device to control. SUNCAN de-identifies devices and uses dynamic enumeration to generate CAN indexes. Users do not need to query any device ID; after enumeration, all available CAN indexes in the system are provided, along with information indicating which device each index belongs to.
extern "C" SDCIO_API INT Enumerate_can_info(PCAN_BASIC_INFO_LIST CanBasicInfoListPtr);
typedef struct _CAN_BASIC_INFO {
INT CanIndex;
UCHAR Model;
INT PciNumber;
INT Version;
} CAN_BASIC_INFO, *PCAN_BASIC_INFO;
CAN 2.0 and CAN FD Tx/Rx Function Integration
SUNCAN adds a "CAN Type" (CAN2.0/CAN FD) parameter, allowing users to transmit and receive both CAN2.0 and CAN FD frames using a single TX/RX function. This significantly improves simplicity and code readability.
extern "C" SDCIO_API INT Can_write_data(INT CanIndex, UINT CanType, UINT Id,
UCHAR *Data, UINT DataLen,
UINT MessageTypeFlags, INT Timeout);
extern "C" SDCIO_API INT Can_read_data(INT CanIndex, PCAN_READ_DATA_LIST CanReadDataListPtr);
Easily configure CAN FD arbitration bitrate and data bitrate
Some brands of CAN FD require configuring complex bit timing parameters manually. SUNIX eliminates this burden by pre-calculating the necessary values — users only need to enter the desired arbitration bitrate and data bitrate.
extern "C" SDCIO_API INT Can_set_bitrate_fd(INT CanIndex, UCHAR ArbitBitrate, UCHAR DataBitrate);
extern "C" SDCIO_API INT Can_set_bitrate_with_samplepoint_fd(INT CanIndex,
UCHAR ArbitBitrate, UCHAR DataBitrate, UINT ArbitSamplePoint, UINT DataSamplePoint);
CAN FD hardware filter (32 acceptable IDs)
SUNIX provides direct configuration of 32 acceptable IDs, eliminating the need for users to calculate hardware filter masks themselves.
typedef struct _ID_MESSAGEFILTER_LIST {
INT IdFilterAmount;
ID_MESSAGEFILTER IdMessageFilter[32];
} ID_MESSAGEFILTER_LIST, *PID_MESSAGEFILTER_LIST;
Software-controlled CAN termination
Provides software-controlled CAN termination, eliminating the need for physical jumpers or switches.
extern "C" SDCIO_API INT Can_set_termination(INT CanIndex, UCHAR Termination);
Note: Some SUNIX products still use a hardware termination jumper, in which case software control will be ineffective.
Two types of Rx functions – Polling & Callback
The SUNCAN API supports both polling and event-driven callback mechanisms, allowing developers to choose the best method based on their environment and requirements.
Polling
extern "C" SDCIO_API INT Can_read_data(INT CanIndex, PCAN_READ_DATA_LIST CanReadDataListPtr);
Callback function
typedef void(*CanReadDataCallbackFunc)(INT CanIndex, PCAN_READ_DATA_LIST CanReadDataListPtr);
extern "C" SDCIO_API INT Can_set_read_data_callback(INT CanIndex, CanReadDataCallbackFunc Callback);
High Performance, Low Effort – Unlock CAN with SUNCAN API Introduction
High Performance, Low Effort – Unlock CAN with SUNCAN API Introduction
In Windows, there is no unified network interface API like SocketCAN in Linux. Instead, each CAN vendor must provide its own API for users to develop CAN applications. This means that each vendor's CAN provides its own control method through its proprietary API. Therefore, providing a clear, efficient, and easy-to-use library is crucial, as it can significantly reduce the user's development effort and cost.
SDC API
The SDC API is a simple, efficient, easy-to-use, high integration, and versatile library. This library supports the full range of SDC products, including Digital IO and CAN. In this document, we focus on CAN control.
The Advantages of the SUNCAN API
Device de-identification and dynamic enumeration of CAN identities
Most third-party CAN products require a hardware identifier to specify which device to control. SUNCAN de-identifies devices and uses dynamic enumeration to generate CAN indexes. Users do not need to query any device ID; after enumeration, all available CAN indexes in the system are provided, along with information indicating which device each index belongs to.
extern "C" SDCIO_API INT Enumerate_can_info(PCAN_BASIC_INFO_LIST CanBasicInfoListPtr);
typedef struct _CAN_BASIC_INFO {
INT CanIndex;
UCHAR Model;
INT PciNumber;
INT Version;
} CAN_BASIC_INFO, *PCAN_BASIC_INFO;
CAN 2.0 and CAN FD Tx/Rx Function Integration
SUNCAN adds a "CAN Type" (CAN2.0/CAN FD) parameter, allowing users to transmit and receive both CAN2.0 and CAN FD frames using a single TX/RX function. This significantly improves simplicity and code readability.
extern "C" SDCIO_API INT Can_write_data(INT CanIndex, UINT CanType, UINT Id,
UCHAR *Data, UINT DataLen,
UINT MessageTypeFlags, INT Timeout);
extern "C" SDCIO_API INT Can_read_data(INT CanIndex, PCAN_READ_DATA_LIST CanReadDataListPtr);
Easily configure CAN FD arbitration bitrate and data bitrate
Some brands of CAN FD require configuring complex bit timing parameters manually. SUNIX eliminates this burden by pre-calculating the necessary values — users only need to enter the desired arbitration bitrate and data bitrate.
extern "C" SDCIO_API INT Can_set_bitrate_fd(INT CanIndex, UCHAR ArbitBitrate, UCHAR DataBitrate);
extern "C" SDCIO_API INT Can_set_bitrate_with_samplepoint_fd(INT CanIndex,
UCHAR ArbitBitrate, UCHAR DataBitrate, UINT ArbitSamplePoint, UINT DataSamplePoint);
CAN FD hardware filter (32 acceptable IDs)
SUNIX provides direct configuration of 32 acceptable IDs, eliminating the need for users to calculate hardware filter masks themselves.
typedef struct _ID_MESSAGEFILTER_LIST {
INT IdFilterAmount;
ID_MESSAGEFILTER IdMessageFilter[32];
} ID_MESSAGEFILTER_LIST, *PID_MESSAGEFILTER_LIST;
Software-controlled CAN termination
Provides software-controlled CAN termination, eliminating the need for physical jumpers or switches.
extern "C" SDCIO_API INT Can_set_termination(INT CanIndex, UCHAR Termination);
Note: Some SUNIX products still use a hardware termination jumper, in which case software control will be ineffective.
Two types of Rx functions – Polling & Callback
The SUNCAN API supports both polling and event-driven callback mechanisms, allowing developers to choose the best method based on their environment and requirements.
Polling
extern "C" SDCIO_API INT Can_read_data(INT CanIndex, PCAN_READ_DATA_LIST CanReadDataListPtr);
Callback function
typedef void(*CanReadDataCallbackFunc)(INT CanIndex, PCAN_READ_DATA_LIST CanReadDataListPtr);
extern "C" SDCIO_API INT Can_set_read_data_callback(INT CanIndex, CanReadDataCallbackFunc Callback);
High Performance, Low Effort – Unlock CAN with SUNCAN API Introduction
High Performance, Low Effort – Unlock CAN with SUNCAN API Introduction
In Windows, there is no unified network interface API like SocketCAN in Linux. Instead, each CAN vendor must provide its own API for users to develop CAN applications. This means that each vendor's CAN provides its own control method through its proprietary API. Therefore, providing a clear, efficient, and easy-to-use library is crucial, as it can significantly reduce the user's development effort and cost.
SDC API
The SDC API is a simple, efficient, easy-to-use, high integration, and versatile library. This library supports the full range of SDC products, including Digital IO and CAN. In this document, we focus on CAN control.
The Advantages of the SUNCAN API
Device de-identification and dynamic enumeration of CAN identities
Most third-party CAN products require a hardware identifier to specify which device to control. SUNCAN de-identifies devices and uses dynamic enumeration to generate CAN indexes. Users do not need to query any device ID; after enumeration, all available CAN indexes in the system are provided, along with information indicating which device each index belongs to.
extern "C" SDCIO_API INT Enumerate_can_info(PCAN_BASIC_INFO_LIST CanBasicInfoListPtr);
typedef struct _CAN_BASIC_INFO {
INT CanIndex;
UCHAR Model;
INT PciNumber;
INT Version;
} CAN_BASIC_INFO, *PCAN_BASIC_INFO;
CAN 2.0 and CAN FD Tx/Rx Function Integration
SUNCAN adds a "CAN Type" (CAN2.0/CAN FD) parameter, allowing users to transmit and receive both CAN2.0 and CAN FD frames using a single TX/RX function. This significantly improves simplicity and code readability.
extern "C" SDCIO_API INT Can_write_data(INT CanIndex, UINT CanType, UINT Id,
UCHAR *Data, UINT DataLen,
UINT MessageTypeFlags, INT Timeout);
extern "C" SDCIO_API INT Can_read_data(INT CanIndex, PCAN_READ_DATA_LIST CanReadDataListPtr);
Easily configure CAN FD arbitration bitrate and data bitrate
Some brands of CAN FD require configuring complex bit timing parameters manually. SUNIX eliminates this burden by pre-calculating the necessary values — users only need to enter the desired arbitration bitrate and data bitrate.
extern "C" SDCIO_API INT Can_set_bitrate_fd(INT CanIndex, UCHAR ArbitBitrate, UCHAR DataBitrate);
extern "C" SDCIO_API INT Can_set_bitrate_with_samplepoint_fd(INT CanIndex,
UCHAR ArbitBitrate, UCHAR DataBitrate, UINT ArbitSamplePoint, UINT DataSamplePoint);
CAN FD hardware filter (32 acceptable IDs)
SUNIX provides direct configuration of 32 acceptable IDs, eliminating the need for users to calculate hardware filter masks themselves.
typedef struct _ID_MESSAGEFILTER_LIST {
INT IdFilterAmount;
ID_MESSAGEFILTER IdMessageFilter[32];
} ID_MESSAGEFILTER_LIST, *PID_MESSAGEFILTER_LIST;
Software-controlled CAN termination
Provides software-controlled CAN termination, eliminating the need for physical jumpers or switches.
extern "C" SDCIO_API INT Can_set_termination(INT CanIndex, UCHAR Termination);
Note: Some SUNIX products still use a hardware termination jumper, in which case software control will be ineffective.
Two types of Rx functions – Polling & Callback
The SUNCAN API supports both polling and event-driven callback mechanisms, allowing developers to choose the best method based on their environment and requirements.
Polling
extern "C" SDCIO_API INT Can_read_data(INT CanIndex, PCAN_READ_DATA_LIST CanReadDataListPtr);
Callback function
typedef void(*CanReadDataCallbackFunc)(INT CanIndex, PCAN_READ_DATA_LIST CanReadDataListPtr);
extern "C" SDCIO_API INT Can_set_read_data_callback(INT CanIndex, CanReadDataCallbackFunc Callback);