ISO-CAN-DUO-FD Configuration

Configuration

The CAN-BUS FD controller card is configured by adding a few overlay lines to /boot/config.txt and then configuring the network interfaces file

Here are the two sections that need adding, note that the CM4 Based XT Integrator board uses different hardware chip-select pins to the other versions so use the applicable line when adding to config.txt

/boot/config.txt

dtoverlay=spi0-on
# Integrator Board OG/NT
dtoverlay=spi0-2cs,cs0_pin=8,cs1_pin=7
# Integrator Board XT
#dtoverlay=spi0-2cs,cs0_pin=8,cs1_pin=23
# CAN-FD Overlays
dtoverlay=mcp251xfd,spi0-0,interrupt=25
dtoverlay=mcp251xfd,spi0-1,interrupt=26

 

To configure the card in standard CAN 2.0 Mode (500kbps) use the below setup

 /etc/network/interfaces.d/can

############### CAN BUS CONFIG ###########################
auto can0
iface can0 inet manual
    pre-up ip link set $IFACE type can bitrate 500000 listen-only off
    up /sbin/ifconfig $IFACE up
    down /sbin/ifconfig $IFACE down

auto can1
iface can1 inet manual
    pre-up ip link set $IFACE type can bitrate 500000 listen-only off
    up /sbin/ifconfig $IFACE up
    down /sbin/ifconfig $IFACE down
############### CAN BUS CONFIG ###########################

To configure the card in CAN FD Mode (500kpbs / 2Mbps). use the below setup

 /etc/network/interfaces.d/can

	
############### CAN BUS CONFIG ###########################
auto can0
iface can0 inet manual
    pre-up ip link set $IFACE type can bitrate 500000 listen-only off dbitrate 2000000 fd on sample-point .7 dsample-point .7
    up /sbin/ifconfig $IFACE up
    down /sbin/ifconfig $IFACE down

auto can1
iface can1 inet manual
    pre-up ip link set $IFACE type can bitrate 500000 listen-only off dbitrate 2000000 fd on sample-point .7 dsample-point .7
    up /sbin/ifconfig $IFACE up
    down /sbin/ifconfig $IFACE down
############### CAN BUS CONFIG ###########################

With these changes in place reboot the unit and check the config as below

root@raspberrypi:~# ifconfig can0
can0: flags=193<UP,RUNNING,NOARP>  mtu 72
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 10  (UNSPEC)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 63

root@raspberrypi:~# ifconfig can1
can1: flags=193<UP,RUNNING,NOARP>  mtu 72
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 10  (UNSPEC)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 64

root@raspberrypi:~# 

 

IO Card Connector Pinout

This card has the following pin out on the front Green Industrial 8pin Connector Connector pin numbered left to right from front of card

1 CAN0-L
2 CAN0-H
3 CAN0-GND
4 No Connect
5 No Connect
6 CAN1-L
7 CAN1-H
8 CAN1-GND

Testing

To test the setup in a loopback mode use a short 2 wire cable to join together the CAN0-L + CAN1-L and CAN0-H + CAN1-H and fit 120R termination resistors at either ends so the bus resistance measures 60R when powered off.

Install the can-utils package

root@raspberrypi:~# apt-get install can-utils

Next setup two terminal windows and run cangen & candump as shown below

Can Duo FD IO Card test1

Basic CAN FD messages can be sent using the cansend commands

To send a CAN FD message with BRS use :

cansend can0 7df##15555555555555555

To send a CAN FD message with no BRS use :

cansend can0 7df##05555555555555555

Can-FD message test raspberry pi

Can-FD message test raspberry pi

Contact us now to discuss your project

Ready to order, contact us today for pricing or samples

Contact Us