Summary of Contents for SK Pang Electronics PiCAN2 DUO SMPS
Page 1
PiCAN2 DUO SMPS Rev D V1.4 PiCAN2 DUO SMPS USER GUIDE V1.4 Product name PiCAN2 DUO 3A SMPS CAN-Bus Board for Raspberry Pi Model number RSP-PICAN2DUOSMPS Manufacturer SK Pang Electronics Ltd SK Pang Electronics Ltd Ó 2021 www.skpang.co.uk...
Page 2
PiCAN2 DUO SMPS Rev D V1.4 Contents Table of Contents Introduction ......................1.1. Features ................................3 1.2. Hardware Installation ..........................3 1.3. Screw Terminal .............................. 4 1.4. 120W Terminator ............................4 1.5. LED ..................................4 1.6. Not Fitted Items ............................. 4 Software Installation ....................1.7. Bring Up the Interface ..........................6 1.8. Installing CAN Utils ............................6 Writing Your Own Software ..................
Page 3
PiCAN2 DUO SMPS Rev D V1.4 1. Introduction This PiCAN2DUO board provide two independent CAN-Bus channels for the Raspberry Pi 4. It uses the Microchip MCP2515 CAN controller with MCP2551 CAN transceiver. Connections are made via plug in 4 way screw terminal. This board has a 5v 3A SMPS that can power the Pi is well via the screw terminal. Easy to install SocketCAN driver. Programming can be done in C or Python. 1.1. Features • CAN v2.0B at 1 Mb/s • High speed SPI Interface (10 MHz) • Standard and extended data and remote frames • CAN connection via screw terminal • 120Ω terminator ready • Serial LCD ready • LED indicator • Four fixing holes, comply with Pi Hat standard • SocketCAN driver, appears as can0 and can1 to application • Interrupt RX on GPIO25 and GPIO24 • 5v 3A SMPS to power Raspberry Pi and accessories from screw terminal o Reverse polarity protection o High efficiency switch mode design o 7v to 24v input range 1.2.
Page 4
PiCAN2 DUO SMPS Rev D V1.4 1.3. Screw Terminal The CAN connection can also be made via the 4 way screw terminal. CAN B (J4) CAN A (J3) Pin number Function Pin number Function CAN_L CAN_L CAN_H CAN_H GND GND n/c +12v In Connector J3 pin 4 is the input for the SMPS, it has an input voltage range of 6v to 20v that is used to power the Raspberry Pi. 1.4. 120 W Terminator There is a 120W fitted to the board. To use the terminator solder a 2way header pin to JP1 and JP2 then insert a jumper. 1.5. LED There are two red LEDs fitted to the board. This is connected to GPIO04 and GPIO26. 1.6. Not Fitted Items JP5 can be use to power a serial LCD with data on TXD line from the Pi. There is also 5v supply on JP5.
Page 5
PiCAN2 DUO SMPS Rev D V1.4 After first time boot up, do an update and upgrade first. sudo apt-get update sudo apt-get upgrade sudo reboot Add the overlays by: sudo nano /boot/config.txt Add these 4 lines to the end of file: dtparam=spi=on dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25 dtoverlay=mcp2515-can1,oscillator=16000000,interrupt=24 dtoverlay=spi-bcm2835-overlay Reboot Pi: sudo reboot SK Pang Electronics Ltd Ó 2021 www.skpang.co.uk...
Page 6
PiCAN2 DUO SMPS Rev D V1.4 1.7. Bring Up the Interface You can now bring the CAN interfaces up: sudo /sbin/ip link set can0 up type can bitrate 500000 sudo /sbin/ip link set can1 up type can bitrate 500000 1.8. Installing CAN Utils Install the CAN utils by: sudo apt-get install can-utils Connect the PiCAN2 Duo to your CAN network via screw terminal .
Page 7
PiCAN2 DUO SMPS Rev D V1.4 3. Writing Your Own Software You can write your own application software in either C or Python. 1.9. Application in Python Download the Python-CAN files from: https://github.com/hardbyte/python-can/releases/tag/3.2.0 Unzip and copy over to the Pi. sudo python3 setup.py install Bring the CAN interface up if it is not already done: sudo /sbin/ip link set can0 up type can bitrate 500000 Now start python3 python3 To sent a message out type the following lines: import can bus = can.interface.Bus(channel='can0', bustype='socketcan_native') msg = can.Message(arbitration_id=0x7de,...
Page 8
PiCAN2 DUO SMPS Rev D V1.4 To received messages and display on screen type: notifier = can.Notifier(bus, [can.Printer()]) 1.10. Application in C Bring the CAN interface up if it is not already done: sudo /sbin/ip link set can0 up type can bitrate 500000 Download the source code and example files by typing the following in the command prompt: wget http://skpang.co.uk/dl/cantest.tar Unpack the tar file and change into directory by: tar xf cantest.tar cd linux-can-utils The example file is called cantest.c to edit this file, type the following in the command prompt: nano cantest.c Line 77 is the CAN message to be sent out.
Need help?
Do you have a question about the PiCAN2 DUO SMPS and is the answer not in the manual?
Questions and answers