[go: up one dir, main page]

0% found this document useful (0 votes)
6 views29 pages

SavvyCAN-Hardware-Manual-20240103

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 29

High Speed USB2.

0 To CAN FD Converter
Data Field Up to 12M Max

USB To CANFD Series Products


User Mannual

SavvyCAN-FD-X2 SavvyCAN-FD-C SavvyCAN-FD-mPCI


USB To Dual Channel CANFD USB To CANFD Cable USB To Dual Channel CANFD with mini
pcie interface (usb2.0 bus)

Date Revision Description


2023/01/01 V1.0 First Released
2024/01/03 V1.0 Add Chapter5 Software

1
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

Document Catalogue
Document Catalogue .......................................................................................................................................... 2
1Introduction ..........................................................................................................................................................3
1.1 Product Series .................................................................................................................................3
1.2 Product Features ............................................................................................................................3
2Hardware Description ....................................................................................................................................... 3
2.1 SavvyCAN-FD-X2 .................................................................................................................................3
Specification ......................................................................................................................................... 4
Pins Out Description ......................................................................................................................... 5
LED Indication ......................................................................................................................................6
2.2 SAVVYCAN-FD-C ................................................................................................................................ 6
Specification ......................................................................................................................................... 7
Pins Out Description ......................................................................................................................... 8
LED Indication ......................................................................................................................................9
2.3 SavvyCAN-FD-mPCI ........................................................................................................................... 9
Specification .......................................................................................................................................10
Pins Out Description .......................................................................................................................11
LED Indication ................................................................................................................................... 12
Design Reference .............................................................................................................................13
3 Connection .................................................................................................................................................. 15
3.1 Enable/Disable Build In 120Ω Term Resistor ........................................................................... 15
3.2 SavvyCAN-FD-X2/SAVVYCAN-FD-C Connection ................................................................ 16
3.3 SavvyCAN-FD-mPCI Connection Figure ...................................................................................17
4 Software Description ................................................................................................................................17
4.3 CAN-UTILS/C/Python For Linux ................................................................................................... 17
4.3.1 Linux Support List ................................................................................................................. 17
4.3.2 Hardware Connection ......................................................................................................... 19
4.3.3 CAN-UTILS DEMO ................................................................................................................20
4.3.4 C Demo .....................................................................................................................................22
4.3.5 Python3 Demo ....................................................................................................................... 22
4.3.6 Software Description ............................................................................................................23

2
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

1Introduction

1.1 Product Series

Product Name CAN Version Bitrate Isolation Max Rate Interface Time
Stamp
SavvyCAN-FD-X2 CAN2.0A/B 12Mbit/s 2500V 15000fps/s USB 1us
CANFD 1.0 2*DSUB 9PIN
SavvyCAN-FD-mPCI CAN2.0A/B 12Mbit/s 2500V 15000fps/s MINIPCIE 1us
CANFD 1.0 (USB Bus)
SavvyCAN-FD-C CAN2.0A/B 12Mbit/s 2500V 15000fps/s 1.5M USB 1us
CANFD 1.0 Cable
1*D-Sub 9PIN
The new CAN FD standard (CAN with Flexible Data rate) is primarily characterized by higher
bandwidth for data transfer.

The maximum of 64 data bytes per CAN FD frame (instead of 8 so far) can be transmitted
with bit rates up to 12 Mbit/s.

1.2 Product Features

1 True High-speed USB 2.0 Compatible with CAN specifications 2.0A/2.0B/FD;


2 CAN FD support for ISO and Non-ISO standard support software switch;
3 CAN FD bit rates data field (64 bytes max.) from 25 kbit/s up to 12Mbit/s;
4 Class CAN bit rates data field from 25 kbit/s up to 1 Mbit/s;
5 Time stamp Resolution Up to 1 μs;
6 Each CAN FD Signal &Power Separately Isolated Up to 2500 Volts against USB;
7 Bus load measurements including error frames and overload frames on physical bus;
8 Induced error generation for incoming and outgoing CAN messages;

2Hardware Description

2.1 SavvyCAN-FD-X2

The SavvyCAN-FD-X2 is a plug and play high speed USB2.0 to CANFD adapter enables the
connection of dual channel CANFD networks to a computer via USB. Each CAN FD channel is

3
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

separately isolated against USB with a maximum of 2500V.

Specification

Connector
CANFD Dual Channel 9PIN D-SUB Connectors
USB USB plug type A(Computer)
USB plug type B(Devcie)
CAN Features
Protocols CAN 2.0A (standard format)
CAN 2.0B (extended format)
CAN FD ISO 11898-1:2015
CAN FD non-ISO
CAN bit rates 25 kbit/s up to 1 Mbit/s
CANFD bit rates 25 kbit/s up to 12Mbit/s
USB ESD IEC 61000-4-2 Level 4
+25 kV (contact discharge)
+30 kV (air-gap discharge)

4
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

Galvanic isolation Signal &Power Separately Isolated by 2500


Volts against USB
IEC 61000-4-2 Contact
IEC 61000-4-2 Air
ISO 10605 150 pF / 2 k2 Contact
ISO 10605 330 pF 1 2 k2 Contact
Micro controller 180MHZ Cortex-M4 MCU
Timestamp resolution 1 μs
Built In 120Ω Termination Resistor Enable/Disable Through Software
Others
Temperature -40°~ 85°
PCBA Size (L * W * H) 84x80x28 mm
Weight 190 g

Pins Out Description

CAN1 PIN OUT Description


1 NC
2 CANL bus line (dominant low)
3 CAN_GND
4 NC
5 NC
6 NC
7 CANH bus line (dominant
high)
8 NC
9 NC

CAN0(Normal) PIN OUT Description


1 NC
2 CANL bus line (dominant low)
3 CAN_GND
4 NC
5 NC
6 NC
7 CANH bus line (dominant
high)
8 NC
9 NC
Note1: Not connect GND do not affect normal communication, if cable with shielding
suggest connect to GND;

5
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

LED Indication

When plug SavvyCAN-FD-X2 device to Computer All lights are flashing for one second.
Then TERM LED And LINK LED turns to be green.

Led Name Description


Power LED Indicator Power Up And Driver Installted
LINK LED turns to be blinking.
CAN1 LED Indicator TX LED Blinking, Sending Data;
RX LED Blinking, Receiving Data;
TERM LED Green,120Ω Activated;
CAN0 LED Indicator TX LED Blinking, Sending Data;
RX LED Blinking, Receiving Data;
TERM LED Green,120Ω Activated;

2.2 SAVVYCAN-FD-C

The SAVVYCAN-FD-C is a plug and play high speed USB2.0 to CANFD converter comes with
1.2m high quality Cable enables the connection of one channel CANFD networks to a
computer via USB. CANFD is isolated protection against USB 2500V.

6
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

Specification

Connector
CANFD 9PIN D-SUB Connectors
USB Cable 1.2M High Quality USB Cable with type A
CAN Features
Protocols CAN 2.0A (standard format)
CAN 2.0B (extended format)
CAN FD ISO 11898-1:2015
CAN FD non-ISO
CAN bit rates 25 kbit/s up to 1 Mbit/s
CANFD bit rates 25 kbit/s up to 12Mbit/s
USB ESD IEC 61000-4-2 Level 4
+25 kV (contact discharge)
+30 kV (air-gap discharge)
Galvanic isolation Signal &Power Separately Isolated by 2500
Volts against USB

7
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

IEC 61000-4-2 Contact


IEC 61000-4-2 Air
ISO 10605 150 pF / 2 k2 Contact
ISO 10605 330 pF 1 2 k2 Contact
Micro controller 180MHZ Cortex-M4 MCU
Timestamp resolution 1 μs
Built In 120Ω Termination Resistor Disable/Enable Through Software
Others
Temperature -40°~ 85°

Pins Out Description

1 NC
2 CAN-L
3 GND
4 NC
5 NC
6 NC
7 CAN-H
8 NC
9 NC

8
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

LED Indication

Led Name LED Status Description


RXD Blinking Receiving Data
TXD Blinking Sending Data
TER Blue Led On Build In 120Ω Term Resistor Enable;
LINK Blinking Power Up and Driver Installed.
Blue Led On Power Up Driver Not Installed.

2.3 SavvyCAN-FD-mPCI

The PU2CANFD-MPCIE is a plug and play high speed USB2.0 to CANFD CAN Card.
CAN FD each channel is separately isolated against USB with a maximum of 2500V.

9
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

Specification

Connector
Dual Channel CANFD 2X3PIN 1mm Connector

Mini PCIE USB USB BUS


CAN Features
Protocols CAN 2.0A (standard format)
CAN 2.0B (extended format)
CAN FD ISO 11898-1:2015
CAN FD non-ISO
CAN bit rates 25 kbit/s up to 1 Mbit/s
CANFD bit rates 25 kbit/s up to 12Mbit/s
USB ESD IEC 61000-4-2 Level 4
+25 kV (contact discharge)
+30 kV (air-gap discharge)
Galvanic isolation Signal &Power Separately Isolated by 2500
Volts against USB
IEC 61000-4-2 Contact
IEC 61000-4-2 Air
ISO 10605 150 pF / 2 k2 Contact
ISO 10605 330 pF 1 2 k2 Contact
Micro controller 180MHZ Cortex-M4 MCU
Timestamp resolution 1 μs
Built In 120Ω Termination Resistor Activated/Deactivated Through Software

Others
Temperature -40°~ 85°

10
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

PCBA Size (L * W * H) 84x80x28 mm


Weight 191 g

Pins Out Description

11
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

LED Indication

Description Indication

A Power&Driver LED Blinking, Driver install and Power Up

B CAN0 120Ω Term On, CAN0 Term Enable; Off, CAN0 Term Disable

C CAN1 120Ω Term On, CAN1 Term Enable; Off, CAN1 Term Disable

D CAN0 Receive Blinking,CAN0 Receiving Data;

E CAN0 Send Blinking,CAN0 Sending Data;

F CAN1 Receive Blinking,CAN1 Receiving Data;

G CAN1 Send Blinking,CAN0 Receiving Data;

12
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

Design Reference

3PIN Connector Board End

Vendor:HDGC1002WR-S-3P

Design End

Vendor:HDGC1002H-5P

13
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

MINIPCIE Connector

Vendor:Lotes,AAA-PCI-049-K01

14
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

3 Connection

3.1 Enable/Disable Build In 120Ω Term Resistor

Products comes enable build in 120Ω term resistor in default.


If you need external connection of 120Ω termination resistor
Please refer to chapter 5 Appendix A-ID Setting Reference learn how deactivated it.

15
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

3.2 SavvyCAN-FD-X2/SAVVYCAN-FD-C Connection

Notes:

Note: Remove jumper When build in 120Ω Note: Add jumper When build in 120Ω
termination resistor Enable. termination resistor Disable.

16
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

3.3 SavvyCAN-FD-mPCI Connection Figure

4 Software Description

4.3 CAN-UTILS/C/Python For Linux

(USE AS SOCKET CAN)

4.3.1 Linux Support List

SavvyCAN-FD-X2 device can run properly without any additional driver request on all Linux
system as below.

17
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

amd64 i386 arm64 armhf ppc64el

Ubuntu:

Trusty 14.04 LTS

Xenial 16.04 LTS

Bionic 18.04 LTS

Cosmic 18.10

Disco 19.04

Eoan 19.10

Focal 20.04 LTS

Groovy 20.10

Hirsute 21.04

OpenSUSE see Xenial

Tumbleweed

Debian:

Wheezy 7.11

Jessie 8.11

Stretch 9.9

Buster 10

Bullseye 11

18
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

4.3.2 Hardware Connection

Connect device to your Linux computer As below picture and follow chapter 2.2 to activated
120Ω resistor by hardware, use the 2pcs db9 to termination board we provide and put on
jumper in red circle.

LED Indication should be as below picture:

19
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

4.3.3 CAN-UTILS DEMO

Prepare

Type command ifconfig -a to check ‘can0’ and ‘can1’device is available in system, if you can
not find the command ifconfig, use command sudo apt-get install net-tools

Type command dmesg to check more information

Type command sudo apt-get install can-utils to install can-utils.

Note:
This tool is a very easy way to test SavvyCAN-FD-X2 module communication. There is only a
simple use instruction. For more details, please refer to can-utils user manual and source
code. https://github.com/linux-can/can-utils/

Send/Receive

Initialize CAN port, Open two termination command for can0 and can1.
sudo ip link set can0 down
sudo ip link set can0 up type can bitrate 50000 dbitrate 2000000 fd on

20
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

sudo ip link set can1 down


sudo ip link set can1 up type can bitrate 50000 dbitrate 2000000 fd on

<1>Set can0 as receiver


candump can0
<2>Set can1 as sender
cansend can1 500#1E.10.10

21
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

4.3.4 C Demo

<1>Send CAN0 As Receiver,


sudo ./can0_receive_fd
<2>Set CAN1 As Sender
sudo ./can1_send_fd

4.3.5 Python3 Demo

(1) Check the Python version of your Raspbian. Python 3.7.3 default in
2019-09-26-Raspbian.img. Our Demo can run on any Python3 version.
python3 -V

(2) If you can’t find the Python3 in system. Install the Python3
sudo apt-get install python3-pip

22
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

(3) Install Python CAN library.


sudo pip3 install python-can
(4) Set CAN0 as receiver
sudo python3 receive.py

(5) Set CAN1 as sender


sudo python3 send.py

4.3.6 Software Description

Now with previous demo’s code to show you how to program socket can in Raspbian with C
and Python . The socket can is an implementation of CAN protocols(Controller Area Network)
for Linux. CAN is a networking technology which has widespread use in automation,
embedded devices, and automotive fields. While there have been other CAN
implementations for Linux based on character devices, Socket CAN uses the Berkeley socket
API, the Linux network stack and implements the CAN device drivers as network interfaces.
The CAN socket API has been designed as similar as possible to the TCP/IP protocols to
allow programmers, familiar with network programming, to easily learn how to use CAN
sockets. For more Socket CAN detail please refer to below link:
https://www.kernel.org/doc/Documentation/networking/can.txt
https://elinux.org/CAN_Bus

Programming in C

For Sender’s codes

(1): Create the socket, If an error occurs then the return result is -1.

(2): Locate the interface to “can0” or other name you wish to use. The name will show when
you execute “./ifconfig –a”.

23
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

(3): Bind the socket to “can0”.

(4): Disable sender’s filtering rules,this program only send message do not receive packets.

(5): Assembly data to send.

(6): Send message to the can bus.You can use the return value of write() to check whether all
data has been sent successfully .

24
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

(7): Close can0 device and disable socket.

For Receiver’s codes

(1)step 1 and (2) is same as Sender’s code.


(3):It’s different from Sender’s.

(4):Define receive filter rules,we can set more than one filters rule.

(5): Read data back from can bus.

Programming in Python

Import

import os
The OS module in Python provides a way of using operating system dependent functionality.
The functions that the OS module provides allows you to interface with the underlying
operating system that Python is running on – be that Windows, Mac or Linux. We usually use
os.system() function to execute a shell command to set CAN.

import 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.
For more information about python-can, please to below link:

25
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

https://python-can.readthedocs.io/en/stable/index.html

ifconfig
If you are use Ubuntu system, It may can’t use the ‘ifconfig‘ command. Please install the net
tools.
sudo apt install net-tools

Simple common functions

(1) Set bitrate and start up CAN device.


os.system('sudo ip link set can0 type can bitrate 1000000')
os.system('sudo ifconfig can0 up')

(2) Bind the socket to ‘can0’.


can0 = can.interface.Bus(channel = 'can0', bustype = 'socketcan_ctypes')

(3) Assembly data to send.


msg = can.Message(arbitration_id=0x123, data=[0, 1, 2, 3], extended_id=False)

(4) Send data.


can0.send(msg)

(5) Receive data.


msg = can0.recv(30.0)

(6) Close CAN device


os.system('sudo ifconfig can0 down')

Error Frame

You may receive some error frame marked in red when you use the USB2CANX2-FD module.
They will tell you what problem does the USB2CANX2-FD module meet on your CAN Bus.

Some people would say why didn’t they meet the error frame with other tool or USB to CAN
module before. The truth is that most of the tool filter out the error frame to avoid
controversy and support. They just show nothing when there are some error on the CAN Bus.
We want to show the all raw data to help you to analyze your CAN BUS. Some error can
be ignored, but some error maybe the hidden danger for your CAN BUS.

26
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

For the error frame ID description, please refer to below link:

https://github.com/linux-can/can-utils/blob/master/include/linux/can/error.h

Now we take a simple case to show you how to analyze the error frame ID. I made the
incorrect connection between the USB2CAN module and the CAN Bus, to see what happens.

As Above, We received error frame Id: 0x20000024 and 2 set of 8 byte Frame Data:
data[0]=0x00, data[1]=0x0C,data[3] to data[7] are all 0x00 .
data[0]=0x00, data[1]=0x30,data[3] to data[7] are all 0x00 .

According the above error frame ID description link:

This Error frame ID = 0x200000000 | 0x00000020|0x00000004


= 0x200000000 | CAN_ERR_ACK|CAN_ERR_CRTL

27
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

So the USB2CANX2-FD meet two problem ‘received no ACK on transmission’ and ‘controller
problems’.

For problem ‘received no ACK on transmission’ may case by the not CAN-BUS or other
module on the CAN BUS are only listen mode(No ACK).

For problem ‘controller problems’, refer to the data[1] description:

data[1] = 0x0C = 0x04|0x08 = CAN_ERR_CRTL_RX_WARNING|CAN_ERR_CRTL_TX_WARNING


It means the USB2CAN module can’t send/receive data properly and reached warning level.

data[1] = 0x30 = 0x10|0x20 = CAN_ERR_CRTL_RX_PASSIVE | CAN_ERR_CRTL_TX_PASSIVE


It means the USB2CAN module can’t send/receive data too much, USB2CAN module into
error status.

Summing up the above, the error frame tell us, USB2CAN module can’t get ACK from CAN
BUS and can’t send data to the CAN Bus. So the CAN Bus may not inexistence or the
connection error.

28
High Speed USB2.0 To CAN FD Converter
Data Field Up to 12M Max

5 SavvyCAN Software
https://docs.pibiger-tech.com/home/savvycan-series/savvycan-fd

29

You might also like