Page 1
1 Port Ethernet to CAN Bus Adapter w/ 16kV ESD Surge Protection Model Number: NCAN-1 Product Manual Coolgear, Inc. Version: 1 Date: 2024-02-19...
Enabling the +5V 100mA power for external devices ..........11 Termination Resistors ....................11 Hardware Reset Button ..................... 11 Changing CAN Port Operation Mode in NCAN-1 ............12 LED Indicators ......................14 CONFIGURING NCAN-1 FOR THE FIRST TIME ................15 Configuring Static IP Address ..................
Page 3
Manually Edit Existing Virtual Serial COM Ports for NCAN ........47 Manually Remove Existing Virtual Serial COM Ports for NCAN ......... 48 Refreshing Virtual Serial Port Information ..............49 Automatically Search for NCAN CAN to Ethernet Gateway ........50 8.6.1 Selecting an NCOM Device to Read Parameters ............
Page 4
11.9 Using the API in Python.................... 138 11.10 Using the API in LabVIEW ..................139 11.10.1 CAN_Main.vi ......................139 11.10.2 CAN_Open.vi ......................140 11.10.3 CAN_Close.vi ......................141 11.10.4 CAN_Write.vi ......................142 11.10.5 CAN_Read.vi ......................143...
Page 5
The computer programs provided with the hardware are supplied under a license. The software provided should be used only with the NCOM series hardware designed and manufactured by TITAN Electronics Inc. Trademarks TITAN, NCAN and the logos are registered trademarks of TITAN Electronics Inc. in Taiwan.
CAN to Ethernet Gateway in your network. This manual covers three different models of two-port serial device server: NCAN-1 One channel CAN to Ethernet Gateway NCAN-1 PoE One channel CAN to Ethernet Gateway with Power over Ethernet NCAN-1-ISO One channel ISO CAN to Ethernet Gateway...
1.1 Key Features The NCAN-1 CAN to Ethernet Gateway has the following features: • Adds one virtual CAN ports via network connection • Supports network protocols such as TCP and UDP client/server • CAN bus speed up to 1Mbits • Provides DC +5V 100mA power for external devices •...
Listen mode: passive receiving of CAN frames Echo mode: transmitter also receives sent frames (for testing purposes) Protection +/-16 KV ESD protection for CAN signals NCAN-1 PoE CAN Interface No. of Ports Connector DB9 male connectors CAN Bus Speed 5kbits to 1Mbits for CAN data transmit & receive...
Page 9
NCAN-1-ISO PoE CAN Interface No. of Ports Connector DB9 male connectors CAN Bus Speed 5kbits to 1Mbits for CAN data transmit & receive Signals CAN_H, CAN_L, CAN_GND, CAN_V+ CAN Bus Controller Bosch C_CAN module CAN bus data activity, CAN bus error...
NCAN CAN to Ethernet Gateway is ready. 3.3 Step 3 – Connecting to a CAN Device Connect the CAN data cable between NCAN and the CAN device. The NCAN-1’s CAN port provides CAN BUS 2.0A and CAN BUS 2.0B. The port uses a standard male DB9...
CAN bus cable specification for proper impedance matching. 3.7 Hardware Reset Button NCAN-1 has a hardware reset button for resetting the device. When the hardware reset button is pressed for a short duration, NCAN’s power will be reset.
3.8 Changing CAN Port Operation Mode in NCAN-1 CAN port operation mode of NCAN-1 can be easily changed via software. This can be done using our Windows utility software or the web console interface. The web console interface is used to configure the CAN to Ethernet Gateway. Open any web browser and enter the device’s IP address in the address bar to access the...
Page 14
The port operation mode can also be configured with our Windows utility software, NCOM Virtual Serial Port Manager. After running NCOM Virtual Serial Port Manager, click on “Configuration” to enter the control menu page. Select an attached device to configure the virtual serial port parameters.
3.9 LED Indicators The NCAN-1 has 5 LED indicators, as described in the following table: LED Function Name Color Steady on: Power is on and functioning normally. Steady off: Power is off. Flashes two times to indicate the device is ready.
4. CONFIGURING NCAN-1 FOR THE FIRST TIME 4.1 Configuring Static IP Address When setting up your NCAN-1 for the first time, it is important to configure the IP address in order to operate in your network. The NCAN-1 products are configured with the following default private IP address: Default private IP address: 192.168.254.254...
4.2 Opening the Web Console Interface of NCAN-1 NCAN-1 offers a web console interface to configure the CAN to Ethernet Gateway. Open any web browser and enter ip address in the address bar to access the “HOME” page of NCAN-1.
4.3 Setting NCAN-1 to Work in DHCP Networks Many networks are DHCP networks, which assign IP addresses for client computers and NCAN-1 automatically, in which case you would need to set the NCAN-1’s IP address to DHCP/AutoIP mode. Under the “HOME” page of NCAN-1’s firmware, select “SYSTEM SETTINGS”. Under “Address Type:”...
Under the “HOME” page of NCAN-1’s firmware, select “NETWORK SETTINGS” to find the “Port 1 Mode Settings” window. Under “Mode”, select the proper operation mode, check the “Make these the default settings”...
Computer NCAN-1 Server Under the “HOME” page of NCAN-1’s firmware, select “NETWORK SETTINGS” to find the “Port 1 Mode Settings” window. Under “Mode”, select “Driver Mode” and check the “Make these the default settings” box and click “Apply Changes” to set your...
Computer NCAN-1 Server Under the “HOME” page of NCAN-1’s firmware, select “NETWORK SETTINGS” to find the “Port 1 Mode Settings” window. Under “Mode”, select “RFC2217-Server” and check the “Make these the default settings” box and click “Apply Changes” to set...
5.3 RFC2217 Client Mode In RFC2217 Client Mode, NCAN-1 can establish a TCP connection with a pre- determined host computer or a CAN to Ethernet Gateway working in RFC2217 Server Mode. You need to define the IP address (telnet server’s IP) to establish a TCP connection with a pre-determined host computer or a CAN to Ethernet Gateway.
IP Address:192.168.254.250 Port:2000 When setting two NCAN-1 devices in Pair Connection Mode, you need to set the “Destination IP Address” of the master NCAN CAN to Ethernet Gateway as the IP address of the slave NCAN CAN to Ethernet Gateway.
5.5 TCP Raw Server Mode In TCP Raw Server Mode, NCAN-1 is configured with a unique IP & Port combination on a TCP/IP network. It waits passively to be contacted by a host computer. After a host computer establishes a transparent connection, it then proceeds with data transmission.
TCP connection with a pre-determined host computer or a CAN to Ethernet Gateway in TCP Raw Server Mode. Check the “Make these the default settings” box and click “Apply Changes” to set your NCAN-1 into TCP Raw Client Mode.
UDP connection with a pre-determined host computer or serial device in UDP unicasting mode. When selecting “Use Multicast”, you need to type “Multicasting IP Address” (such as 224.0.0.0) for UDP multicasting group. Check the “Make these the default settings” box and click “Apply Changes” to set your NCAN-1 into UDP Mode.
SETTINGS”), “SYSTEM SETTINGS”, “FIRMWARE UPDATE”, “CHANGE PASSWORD”, “ACCESSIBLE IP SETTINGS” and “REBOOT”. To access the web console interface to configure the device, open any web browser and enter NCAN-1’s IP address in the address bar to access the “HOME” page of NCAN-1’s firmware.
6.1 Port 1 Settings The “PORT 1 SETTINGS” include “CAN SETTINGS” and “NETWORK SETTINGS”. Click “CAN SETTINGS” to display the current CAN bus settings for NCAN-1. To modify the CAN bus settings for a particular port, select appropriate options located on the right side of “Port 1 CAN Settings”.
Page 30
After you modify the network parameters for your NCAN-1, please check the “Make these the default settings” and click “Apply Changes” to update the network parameters for your device.
Click “Address Type”, located under “IP Address Selection”, to select IP address type (DHCP/AutoIP or Static IP) for NCAN-1. When you select “Static IP”, you need to enter the static IP address (such as 192.168.254.254) and Subnet Mask (such as 255.255.255.0) then click “Update Settings”...
Page 32
You can change NCAN CAN to Ethernet Gateway’s name by modifying the “Server Name” under “General Configuration Settings”. You need to enter a new name (such as NCAN-1) and click “Update Settings” to set your CAN to Ethernet Gateway to a new name.
Input the “Old Login Password”, “New Login Password” and “Confirm New Login Password” to change the login password. After clicking “Set New Password” the NCAN-1 will have password protection. When password protection is enabled, you need to input the “Password” then click “Login” to access NCAN-1’s firmware to configure the device.
Page 35
If you forget the password, the ONLY way to configure NCAN-1 is by using the reset button to restore factory defaults (press the hardware reset button until the “PWR” LED flashes). The factory default settings have password protection disabled, allowing you to log in without a password.
Accessible IP settings allow you to pass or block remote host IP addresses to prevent unauthorized access. Access to NCAN-1 is controlled by IP address. If a host’s IP address is in the accessible IP table, then the host will be allowed to access the device.
Page 37
CAN to Ethernet Gateway, please check the “Make these the default settings” and click “Update Settings” to update the accessible IP settings table for NCAN-1. You can click “Reset” to allow any host to access NCAN-1. The default accessible IP setting is to allow all hosts to access.
When the attached serial port device sends communication data, it is transmitted over TCP/IP network and back from the network to your serial device. NCOM Virtual Serial Port Manager has options to configure NCAN-1 with the options “Add” (add virtual serial port), “Edit” (edit virtual serial port parameters), “Remove” (remove virtual serial port), “Refresh”...
7.2 Installing NCOM Virtual Serial Port Manager 1. Insert the software CD into your CD-ROM or DVD-ROM drive. 2. Open files in the CD and double click “NCOM_setup” to install NCOM Virtual Serial Port Manager. 3. When the confirmation for “User Account Control” appears, click “Yes” and the “Setup - NCOM Virtual Serial Port Manager”...
Page 41
4. After you click “Next”, you will see following information. Click on “Next” and the “Ready to Install” message appears. Click “Install” to install NCOM Virtual Serial Port Manager. 5. After you click “Install” to install NCOM Virtual Serial Port Manager and virtual serial port driver for NCAN CAN to Ethernet Gateway, you will see the following information.
Page 42
6. When the message “Completing the NCOM Virtual Serial Port Manager Setup Wizard” appears, click “Finish” to finish the installation and exit setup program. 7. Double click the shortcut icon of “NCOM Virtual Serial Port Manager” on the desktop to launch NCOM Virtual Serial Port Manager. 8.
8. RUNNING NCOM VIRTUAL SERIAL PORT MANAGER After installing NCAN-1 hardware and NCOM Virtual Serial Port Manager, double click the shortcut icon of “NCOM Virtual Serial Port Manager” on the Desktop to start NCOM Virtual Serial Port Manager.
8.1 NCOM Virtual Serial Port Manager Functions NCOM Virtual Serial Port Manager has options to configure NCAN-1 with the options “Add” (add virtual serial port), “Edit” (edit virtual serial port parameters), “Remove” (remove virtual serial port), “Refresh” (refresh virtual serial port), “Search” (search all attached NCAN CAN to Ethernet Gateway), “Configuration”...
8.2 Manually Add Virtual Serial Port for NCAN After opening NCOM Virtual Serial Port Manager, click “Add” to open the “Add connection” window. Under “Add connection”, select an available COM port (e.g. COM2. Note that NCOM Virtual Serial Port Manager will show your next available COM port) and type your NCOM device’s IP address and port in “IP Address”...
8.3 Manually Edit Existing Virtual Serial COM Ports for NCAN To edit existing virtual serial COM port for NCAN CAN to Ethernet Gateway, select the existing virtual serial COM port and click “Edit” to open the “Add connection” window. Under “Add connection”, you can change the COM port number with the “COM Port” option (e.g.
8.4 Manually Remove Existing Virtual Serial COM Ports for NCAN To remove an existing virtual serial port for NCAN CAN to Ethernet Gateway, select an existing virtual serial port and click “Remove”. After clicking “Remove”, a confirmation message will appear asking “Are you sure you want to delete NCOM_XXXXXXXX_COMX connection?”.
8.5 Refreshing Virtual Serial Port Information The virtual serial port information on the main window of NCOM Virtual Serial Port Manager may be incorrect or absent in some cases. In case this happens, you can click “Refresh” to recover the virtual serial port information.
8.6 Automatically Search for NCAN CAN to Ethernet Gateway NCOM Virtual Serial Port Manager provides a search function, which can search all attached NCAN CAN to Ethernet Gateway and can also automatically install virtual serial port driver for NCAN CAN to Ethernet Gateway. You may also open the web console interface to configure NCOM, reboot NCAN CAN to Ethernet Gateway, restore factory defaults and execute firmware update from here.
8.6.1 Selecting an NCOM Device to Read Parameters After you select an attached NCOM device to configure the virtual serial port parameters, you will find the NCOM device information on the main window of NCOM Virtual Serial Port Manager. The information includes “Server Name”, “Product”, “Serial Number”, “Firmware Revision”, “IP Address”, “MAC Address”, “Address Type”, “Static IP Address”, “Subnet Mask”...
8.6.2 Installing Virtual Serial Port Driver for NCAN CAN to Ethernet Gateway The search function can also create virtual COM ports and install virtual serial port drivers automatically. After selecting an attached NCAN CAN to Ethernet Gateway from the control menu, click “Add All” button to install virtual serial port drivers automatically.
Page 55
In the “Search” window, there are five control buttons: “Search Device”, “Open Web”, “Reboot Device”, “Restore Defaults” and “Firmware Update”.
8.6.3 Manually Search for NCAN CAN to Ethernet Gateway The “Search Device” button searches for all attached NCAN CAN to Ethernet Gateway. If a new NCAN CAN to Ethernet Gateway is attached to the network system, you can click “Search Device” to find new NCAN CAN to Ethernet Gateway.
8.6.4 Opening the Web Console Interface The “Open Web” button opens the web console interface to configure NCAN. After selecting an attached NCAN CAN to Ethernet Gateway, click “Open Web” to open the web console interface for that particular NCAN CAN to Ethernet Gateway.
8.6.5 Rebooting NCAN CAN to Ethernet Gateway The “Reboot Device” button reboots/resets your NCAN CAN to Ethernet Gateway. After selecting an attached NCAN CAN to Ethernet Gateway, click “Reboot Device” and a message will ask “Are you sure you want to reboot device?” Click “Yes” to reboot/reset your NCAN CAN to Ethernet Gateway.
8.6.6 Restoring to Factory Defaults The “Restore Defaults” button restores the firmware to factory defaults. When you select an attached NCAN CAN to Ethernet Gateway, you can restore all options to factory default states by clicking the “Restore Defaults” button; After clicking “Restore Defaults”, a message will ask “Are you sure you want to restore device to default?”.
8.6.7 Firmware Update Tool The “Firmware Update” button opens the firmware update tool to upgrade NCAN-1 firmware contents via Ethernet port. When you click “Firmware Update”, a message will ask “Are you sure you want to update firmware?” Confirm by clicking “Yes” and the message “Input new firmware file”...
Page 61
While upgrading, you will find the following message. After successfully upgrading the firmware contents, there will be a message stating “Update Success!!”. Click on “OK” to finish the firmware update procedure.
8.7 Configuring NCAN CAN to Ethernet Gateway NCOM Virtual Serial Port Manager has a configuration function which can configure all attached NCAN CAN to Ethernet Gateway. It can also import/export configuration files for NCAN CAN to Ethernet Gateway, open web console interface to configure NCAN CAN to Ethernet Gateway, reboot NCAN CAN to Ethernet Gateway, restore factory defaults and execute firmware update.
Page 63
After a few seconds, NCOM Virtual Serial Port Manager will search all attached NCAN CAN to Ethernet Gateway automatically, and you will find “Device List” information for all NCAN CAN to Ethernet Gateway.
8.7.1 Selecting an NCAN CAN to Ethernet Gateway to Configure Parameters When you select an attached NCAN CAN to Ethernet Gateway to configure the virtual serial port parameters, you will find “Device Status”, “Port Status”, “Device Control” and “Configuration Import/Export” on the main window of NCOM Configuration.
Address”, “Subnet Mask” and “Gateway” depending on your application. To change the CAN to Ethernet Gateway name, modify the “Server Name” under “Device Status”. You need to enter a new name (such as NCAN-1) and click “Update” to set your CAN to Ethernet Gateway to a new name.
Page 66
Under “Device Status” of NCOM Configuration, select “USE DHCP/AutoIP” under “Address Type:” and click “Update”. A message will ask “Are you sure you want to change Static IP to DHCP/AUTOIP?”, confirm by clicking “Yes” and NCAN-1 will be set to DHCP/AutoIP mode.
Page 67
After successfully setting NCAN-1 to DHCP/AutoIP mode, a message will indicate “Success!!”. Click on “OK” to finish changing the IP address type. When NCAN-1 is working in a static network environment, you need to set NCAN-1 to a fixed IP address mode.
Page 68
After clicking “Update”, a confirmation message saying “Are you sure you want to change new Static IP?” will appear. Confirm by clicking “Yes” and NCAN-1 will be set to a new static IP address.
8.7.3 COM Port Status The “Port Status” section indicate the following information: “Port X”, “CAN Settings” and “Network Settings”.
Page 70
8.7.3.1 Changing CAN Parameters To change serial parameters under “Serial Settings” for a virtual serial port, click “Port1/Port2” under “COM Port Status”. You can modify the following serial parameters: CAN Parameter Setting Default Values Mode Close, Normal Mode, Listen Only, Close Loopback Bit Rate...
Page 71
Connection Master Mode”, “Pair Connection Slave Mode” and “UDP” depending on your application. After selecting an operation mode, click “Update” to set your NCAN-1 into the proper operation mode. After clicking “Update” to set your NCAN-1’s operation mode, a message will indicate “Update Success!!”.
Page 72
Click on “OK” to finish changing and saving a new operation mode. To modify the network settings for a chosen operation mode, please refer to Chapter 5 for detailed information. You can also modify the network parameter settings for your NCAN-1 CAN to Ethernet Gateway.
Page 73
Following are the default values of network parameters: Network Parameters Default Values Mode Driver Mode Timeout 0 seconds Keep alive time 10 minutes Address Type Static IP Static IP address 192.168.254.254 Subnet Mask 255.255.255.0...
8.7.4 Device Control The “Device Control” section contains the “Search Device”, “Open Web”, “Reboot Device”, “Restore Defaults” and “Firmware Update” functions.
Page 75
8.7.4.1 Manually Search for NCAN CAN to Ethernet Gateway The “Search” button searches for all attached NCAN CAN to Ethernet Gateway. If a new NCOM device is attached to the network system, you can click “Search Device” to find new NCAN CAN to Ethernet Gateway.
Page 76
8.7.4.2 Opening the Web Console Interface The “Open Web” button can be used to open the web console interface to configure NCOM. After selecting an attached NCOM device, click “Open Web” to open web console interface for that particular NCOM device.
Page 77
8.7.4.3 Rebooting NCAN CAN to Ethernet Gateway The “Reboot Device” button reboots/resets your NCOM device when you need to. After selecting an attached NCOM device, click “Reboot Device” and a message will ask “Are you sure you want to reboot device?”. Click “Yes” to reboot/reset your NCOM device.
Page 78
8.7.4.4 Restoring to Factory Defaults The “Restore Defaults” button restores the firmware to factory defaults. When you select an attached NCOM device, you can restore all options to factory default states by clicking the “Restore Defaults” button; After clicking “Restore Defaults”, a message will ask “Are you sure you want to restore device to default?”.
Page 79
8.7.4.5 Firmware Update Tool The “Firmware Update” button opens the firmware update tool to upgrade NCAN-1 firmware contents via Ethernet port. Before you click “Firmware Update”, please go to the web console interface of NCAN device firmware. Enable firmware update interface via Ethernet port to upgrade NCAN-1.
Page 80
Use the “File” button to browse to the new firmware file and click on “Update” to start upgrading NCAN-1’s device firmware. While upgrading, you will find the following message. After successfully upgrading the firmware contents, there will be a message stating “Update Success!!”.
8.7.5 Importing/Exporting Configuration Settings The “Configuration Import/Export” function allows you to back up and recover your NCOM device configuration settings. 8.7.5.1 Exporting Configuration Settings Select an attached NCOM device then click the “Export” button. After you click “Export” you will find a “Save a configuration file” page. Click on “Save” to store the NCAN device configuration data to a NCAN_XXXXXXXXX.xml file.
Page 83
8.7.5.2 Importing Configuration Settings Select an attached NCOM device then click the “Import” button. After you click “Import” you will find an “Open” page, select a NCOM configuration file and click “Open” to start uploading configuration data into NCOM. After all configuration data is uploaded into NCOM device, a message will indicate “Import Success!!”.
9. NCOM VIRTUAL SERIAL PORT MANAGER AND DRIVER UNINSTALLATION 9.1 Uninstalling NCOM Virtual Serial Port Manager and Virtual COM Port Driver To uninstall NCOM Virtual Serial Port Manager and virtual serial port driver, click the "Start" button and navigate to “Control Panel”. Choose "Uninstall a program" under “Programs”.
Page 86
When you click on “Uninstall”, a message will ask “Are you sure you want to completely remove NCOM Virtual Serial Port Manager and all of its components?”. Confirm by click “Yes”. When uninstalling NCOM Virtual Serial Manager Port and virtual serial port driver in, you will find the following message.
10. FUNCTION DESCRIPTION 10.1 LED Indicators The ETHERNET to CAN adapter has two LEDs (green LED & red LED) to indicate CAN bus status for monitoring CAN bus channel status. The green LED indicates CAN bus data activity while the red LED indicates a CAN bus error. Following are the definition of different LED combinations: A: CAN bus channel open/close When CAN bus channel opens, the green LED will turn on to indicate that the CAN...
10.2 ASCII Command Set The USB CAN adapter can be registered as a virtual serial port on the host computer. With simple ASCII commands the USB CAN adapter can be controlled over this serial port. User can send/receive commands from any simple serial terminal program. Example: Set bitrate to 500Kbps, open CAN channel, send CAN frame (ID = 002h, DLC = 3, Data = 11 22 33), close CAN: Command...
10.2.1 Command list The commands are line based and terminated with newline character CR (0xD). On error the response will be 0x7 (BELL). The “help” command (‘H’, ‘h’ or ‘?’) will list supported commands. Command Response Function H[CR] [CR] List all supported commands h[CR] [CR] ?[CR]...
Page 90
10.2.1.1 Opening the CAN Bus Channel The CAN bus channel will be opened with the command O[CR], L[CR] or Y[CR]. The command O[CR] will open the CAN bus channel in normal operation mode, the command L[CR] will open the CAN bus channel in listen only mode, in which no bus interaction will be done from the controller.
Page 91
10.2.1.3 Setting CAN Bitrate (Standard) The CAN bus bitrate can be set with the command SX[CR]. The command can only be used if the CAN bus channel is closed. Command Response Function S00[CR] [CR] Set the CAN bus bitrate to 5K S0[CR] [CR] Set the CAN bus bitrate to 10K...
Page 92
10.2.1.4 Setting CAN Bitrate (Advanced) A more user defined bus bitrate can be configured with the command sXXXXXXXXX[CR]. As with the standard bus timing command above, you can only use this command when the CAN bus channel is closed. sXXXXXXXXX [CR] sets the bitrate registers of the CAN controller. Users can set non- standard bitrates which are not supported by the "SX"...
Page 93
10.2.1.5 Transmitting a Standard CAN Frame Transmitting a standard CAN frame (ID: 11 bit) over a CAN bus can be done with the command tiiildddd…dd[CR]. The return value will be z[CR] or the normal error byte (BELL). The command is only available when the CAN bus channel is open. Command Response Function tiiildddd…dd[CR]...
10.2.1.7 Transmitting an Extended CAN Frame Transmitting an extended CAN frame (ID: 29 bit) over a CAN bus can be done with the command Tiiiiiiiildddd...dd[CR]. The return value will be Z[CR] or the normal error byte (BELL). The command is only available when the CAN bus channel is open. Command Response Function Tiiiiiiiildddd…dd[CR] Z[CR]...
Page 95
10.2.2.1 Setting Timestamps ON/OFF The timestamp command will set the timestamp functionality of received frames ON or OFF. This command is only available when the CAN channel is closed. Command Response Function Z1[CR] [CR] Set the timestamp functionality on received frames Z0[CR] [CR] Set the timestamp functionality on received frames...
Page 96
10.2.2.2 Setting Acceptance Mask The acceptance mask, in conjunction with the acceptance code (M), defines which CAN message frames (i.e. of a specific ID or range of CAN IDs) will be passed to the serial interface. The acceptance mask value corresponds to bits within a range of valid CAN IDs for either standard or extended CAN frames.
Page 97
10.2.2.3 Setting Acceptance Code The acceptance code/filter, in conjunction with the acceptance mask (m), defines which CAN message frames (i.e. of a specific ID or range of CAN IDs) will be passed to the serial interface. The acceptance code value corresponds to a valid CAN IDs for either standard or extended CAN frames.
Page 98
10.2.2.4 Getting Status Flags User can use the command F[CR] to get the status bits when an error occurs. A two- byte BCD number is returned to correspond to the 8-bits of the internal register of the CAN controller. Command Response Function F[CR] XX[CR]...
Page 99
Bit 3: Transmitted a message successfully 1 = Since this bit was last reset by CPU, a message has been successfully (error-free and acknowledged by at least one other node) transmitted. 0 = Since this bit was last reset by CPU, no message has been transmitted. Bit 4: Received a message successfully 1 = A message has been successfully received since this bit was last reset by CPU (independent of the result of acceptance filtering).
Page 100
10.2.2.5 Getting Version Information The command V[CR] to retrieve the current firmware version of the USB CAN adapter. Command Response Function V[CR] VXXXX[CR] Get the current firmware version of the USB CAN adapter This command is always available and will return the version information formatted like this: VXXXX[CR].
11. TOOLS 11.1 CANHacker CANHacker Windows application software analyzing transmitting/receiving CAN frames. The CANHacker software has a friendly interface and is easy to use. Through the software user can easily test and analyze the CAN frames. Following shows its main panel: The following sections will briefly introduce the necessary steps on how to use the software.
Page 102
Settings procedure for selecting and configuring the USB to CAN adapter 1. Open CANHacker and click “Settings” under the menu. 2. Select COM port of the USB to CAN adapter. 3. Check “RTS HS” to enable RTS handshake function. 4. Check “Time Stamp” to enable timestamp function. 5.
Page 104
Receiving CAN frames When CANHacker receives CAN frames from another CAN node, it will show all CAN frame messages in the middle of main panel. The CAN frame messages includes ID, DLC, Data, Period, Count. Sending CAN frames CANHacker provides many parameters for sending CAN frames to another CAN node, you can set the following parameters on the bottom of the main panel for CAN data transmission: Select transmit an extended CAN Frame (29 bits ID) or a standard CAN frame (11 bits...
Page 105
In “TX Mode” dialog box, you can select “off”, “Periodic”, “RTR”, “Trigger” modes. When “Periodic” mode is selected, you can enter “Period(ms)” to send CAN frames message repeatedly (enter “500” to send CAN messages every 500ms). To send a single CAN frame message, click “Single Shot”. Click “Send All” to send CAN frames message repeatedly.
Page 106
Assistant features There are many assistant features included in CANHacker, as shown in the figure below: Saving data to file or loading data from file: Select “File” option to save Rx List, Trace, Tx List, Command List and Load Trace, Tx List, Command List.
Page 107
Select “Filter” to set mask filter and range filter. Select “Tracer” or “Monitor” to trace or monitor the CAN frame messages.
11.2 Titan CAN Test Program Titan CAN test program is a Windows application software for testing and transmitting/receiving CAN frames. The Titan CAN test program is an easy to use software. Through the software users can easily test and analyze the CAN frames. Following shows its main panel: The following section will briefly introduce the necessary steps on how to use the Titan CAN test program.
Page 109
Settings procedure for selecting and configuring the USB to CAN adapter 1. Open Titan CAN test program and click “Settings” under the menu. 2. Select COM port of the USB to CAN adapter. 3. Select CAN Baudrate for the CAN bus operating speed. 4.
Page 111
Receiving CAN frames When Titan CAN test program receives CAN frames from another CAN node, it will show all CAN frame messages in middle of main panel. The CAN frame messages includes ID, DLC, Data, Period, Count. Sending CAN frames Titan CAN test program provides many parameters for sending CAN frames to another CAN node, you can set the following parameters on the bottom of the main panel for CAN data transmission:...
Page 112
When “Periodic” mode is selected, you can enter “Period(ms)” to send CAN frames message repeatedly (enter “100” to send CAN messages every 100ms). To send a single CAN frame message, click “Single Shot”. Click “Send All” to send CAN frames message repeatedly. To stop sending CAN frame messages, click “Stop All”.
Page 113
Assistant features There are many assistant features included in Titan CAN test program, as shown in the figure below: Select “File” option to save Rx List, Tx List and Load Tx List. Click “Disconnect” to stop Titan CAN test program. Select “Filter”...
Page 114
Mask Filter: Set “Acceptance Code Register” and “Acceptance Mask Register” for CAN bus controller to specify the CAN IDs that are passed or blocked; after setting “Mask” and “Code”, check “Enable Mask Filter” then click “OK” to finish the Mask Filter settings and return to the main panel.
Page 115
CAN IDs that are to be passed; after setting “Start ID” and “Stop ID”, check “Enable Range Filter” then click “OK” to finish the Ranger Filter settings and return to the main panel. Range Filter example: After setting “Start ID” to 00000000 and “End ID” to 01FFFFFF, The CAN message frames of the range 0x00000000 through 0x01FFFFFF will be passed and all other CAN IDs will be blocked.
Page 116
transmitted (received) count. Click “About” option to show the version information of Titan CAN test program.
11.3 CANopen CANopen is a CAN-based communication system. It comprises higher-layer protocols and profile specifications. CANopen has been developed as a standardized embedded network with highly flexible configuration capabilities. It was designed originally for motion-oriented machine control systems, such as handling systems. Today it is used in various application fields, such as medical equipment, off-road vehicles, maritime electronics, railway applications, or building automation.
Page 118
Windows Compilation CanFestival can be compiled and run on Windows platform. It is possible to use both Cygwin and win32 native runtime environment. Minimal Cygwin installation is required at configuration time to create specific header files (config.h and cancfg.h). Once these files created, Cygwin is not necessary anymore.
Page 119
Under Windows connect two CAN devices, installed as COM3 and COM4. Open two command windows and change to the directory where examples were extracted to and execute TestMasterSlave -s COM3 -S 125K -M none -l canfestival_titan.dll in the first command window and TestMasterSlave -m COM4 -M 125K -S none -l canfestival_titan.dll in the second.
Page 120
Under Linux connect two CAN devices, installed as /dev/ttyUSB0 and /dev/ttyUSB1. Open two terminal windows and change to the directory where examples were extracted to and execute export LD_LIBRARY_PATH=. ./TestMasterSlave -s “/dev/ttyUSB0” -S 125K -M none -l ./libcanfestival_can_titan.so in the first terminal window and export LD_LIBRARY_PATH=.
11.4 python-can The python-can library provides Controller Area Network support for Python, providing common abstractions to different hardware devices, and a suite of utilities for sending and receiving messages on a CAN bus. More information you can find in: https://python-can.readthedocs.io/en/master/ USB-2CAN-M is compatible to slcan-interfaces (slcan ASCII protocol) https://python-can.readthedocs.io/en/master/interfaces/slcan.html...
11.5 APPLICATION PROGRAMMING INTERFACE The Application Programming Interface (API) gives the user tools to use all of the functions that the CAN adapter provides. It will make it much easier for users to build their own CAN controlling software with these functions, than to implement their application command by command on the ASCII protocol.
11.5.1 CAN_Open CAN_Open(ComPort, szBitrate, acceptance_code, acceptance_mask, flags, Mode) Function: Opens a channel to the device. Parameters: • ComPort o Type: String o The COM port to be opened. o Format: “COMXXX” o Example: “COM1, “COM57”, “COM118” • szBitrate o Type: String o The bitrate to operate at.
Page 124
o Determines whether or not the timestamp function should be enabled. o Format: ▪ 1 = Timestamp will be enabled ▪ 0 = Timestamp will be disabled o Example: 1 • Mode o Type: Integer o Determines the mode the USB CAN should operate at. o Format: ▪...
11.5.2 CAN_Close CAN_Close(Handle) Function: Closes the channel with the specified handle. Parameters: • Handle o Type: Integer o The handle of the CAN channel to be closed. o Format: A numeric value provided by the return value of CAN_Open o Example: 2508 •...
11.5.3 CAN_Write CAN_Write(Handle, Buf) Function: Writes a message to the channel with the specified handle. Parameters: • Handle o Type: Integer o The handle of the CAN channel to write to. o Format: A numeric value provided by the return value of CAN_Open o Example: 2508 •...
11.5.4 CAN_Read CAN_Read(Handle, Buf) Function: Reads a message from the channel with the specified handle. Parameters: • Handle o Type: Integer o The handle of the CAN channel to read from. o Format: A numeric value provided by the return value of CAN_Open o Example: 2508 •...
11.5.5 CAN_Flush CAN_Flush(Handle) Function: Clears the buffers of the channel with the specified handle. Parameters: • Handle o Type: Integer o The handle of the CAN channel whose buffers are to be cleared. o Format: A numeric value provided by the return value of CAN_Open o Example: 2508 •...
11.5.6 CAN_Status CAN_Status(Handle) Function: Checks the status bits for more specific details when an error occurs. Parameters: • Handle o Type: Integer o The handle of the CAN channel whose status bits are to be inquired. o Format: A numeric value provided by the return value of CAN_Open o Example: 2508 •...
Page 130
Checks the status bits of device connected to channel with the handle 2508.
11.5.7 CAN_Version CAN_Version(Handle, buf) Function: Retrieves the firmware version of the device connected to channel with the specified handle. Parameters: • Handle o Type: Integer o The handle of the CAN channel whose version information is to be inquired. o Format: A numeric value provided by the return value of CAN_Open o Example: 2508 •...
Page 132
CAN_MSG Structure • Members: o Id ▪ Type: Unsigned Integer ▪ Message ID. ▪ Format: XXX (standard), XXXXXXXX (extended) ▪ Example: 1FF o Size ▪ Type: Byte ▪ Message size. ▪ Format: A numeric value from 0~8 ▪ Example: 8 o Data ▪...
11.6 Using the API in C# 1. Ensure that the DLL file is placed in the same folder as your application executable. 2. Import the functions you need from the DLL into your source code with the Declare statement: [DllImport("can_api.dll", EntryPoint "CAN_Open", CallingConvention...
11.7 Using the API in Visual Basic .NET 6. Ensure that the DLL file is placed in the same folder as your application executable. 7. Import the functions you need from the DLL into your source code with the Declare statement: Private Declare Function CAN_Open Lib "CANDLL_STDCALL.dll"...
Page 137
9. In order to communicate with the channel with other functions after opening it with CAN_Open, you need to create a variable to store the handle value. Private myHandle As Integer myHandle = CAN_Open(("COM3", "50", "00000000", "00000000", 1, 2) 10. This concludes the basic setup process of using the DLL in Visual Basic .NET. Imported functions can then be easily called from the DLL with the parameters created above.
11.8 Using the API in Visual Basic 6.0 1. Ensure that the DLL file is placed in the same folder as your application executable. 2. Import the functions you need from the DLL into your source code with the Declare statement: Private Declare Function CAN_Open Lib "CANDLL_STDCALL.dll"...
11.9 Using the API in Python 6. Ensure that the DLL file is placed in the same folder as your application executable. 7. Import the DLL using the ctypes library function LoadLibrary. from ctypes import windll DLL = windll.LoadLibrary("CANDLL_STDCALL.dll") 8. Create a definition of the CAN_MSG structure for the CAN_Write and CAN_Read functions, if needed.
11.10 Using the API in LabVIEW 11.10.1 CAN_Main.vi The main panel is a simple, easy-to-use example program which contains most of the important functions available for use in the CAN API. Different functions can be tested by changing the settings on the leftmost side, which are restricted to legal parameters to prevent an error in operation.
11.10.2 CAN_Open.vi Description Opens a channel to the device. Input o ComPort: The COM port to establish a connection with. o szBitrate: The speed at which the connection is to be made, with preset values of 10, 20, 50, 100, 125, 250, 500, 800, 100 o acceptance_code: Used for filtering CAN messages.
11.10.3 CAN_Close.vi Description Closes the CAN channel with the specified handle. Input • Handle: The handle of the CAN channel which is to be closed Output • Return: A positive value indicates success in closing the channel, whereas a negative value indicates an error in closing the channel.
11.10.4 CAN_Write.vi Description Writes a message to the CAN channel with the specified handle. Input • Handle: The handle of the CAN channel which the message is to be sent to. • Id: Message ID. • Size: Frame size (0~8). •...
11.10.5 CAN_Read.vi Description Read a message from the CAN channel with the specified handle. Input • Handle: The handle of the CAN channel which the message is to be read from. Output • Return: A positive value indicates success in reading the message, whereas a negative value indicates an error in reading the message, with -4 representing that the channel is not open and -5 representing that there is no message to be read.
Page 146
Within Every Great Machine For over 20 years our rugged, off-the-shelf USB hubs, chargers, and serial products are ready to go for your next project. Based in the US, Coolgear has successfully engineered and deployed millions of connectivity solutions into industrial, medical, automotive, commercial, and aerospace industries.
Page 147
(iv) normal wear and tear; (v) damage to or loss of repaired or replaced Products during shipping by Coolgear except when such damage or loss is caused by poor or inadequate packaging by Coolgear; or (vi) Products purchased outside the United States.
Need help?
Do you have a question about the NCAN-1 and is the answer not in the manual?
Questions and answers