Answer

Mar 04, 2025 - 09:34 PM
To install the SK Pang electronics RSP-PICAN FD DUO ISO Isolated CAN-Bus Board on your Raspberry Pi, follow these steps:
1. Make sure your Raspberry Pi is switched off before installing the board.
2. Carefully align the 40-way connector on top of the Pi.
3. Use spacers and screws (optional) to secure the board.
4. The CAN connections are made via the 4-way plug-in xxxx terminals labeled J1 and J2.
- J1: CAN_L, CAN_H, GND, n/c
- J2: CAN_L, CAN_H, GND, n/c
5. If you want to use the 120Ω terminator, solder a 2-way header pin to JP1 and JP2, then insert a jumper.
6. Each channel has a red LED connected to GPIO04 and GPIO26 for indication.
7. Install a brand new Raspbian image on your Raspberry Pi. Download the latest version from the official Raspberry Pi website.
8. After the first-time boot up, perform an update and upgrade by running the following commands:
- sudo apt-get update
- sudo apt-get upgrade
- sudo reboot
9. Open the config.txt file by running the command:
- sudo nano /boot/config.txt
10. Add the following lines to the end of the file:
- dtparam=spi=on
- dtoverlay=mcp251xfd,spi0-0,interrupt=25
- dtoverlay=mcp251xfd,spi0-1,interrupt=05
11. Save the file and reboot your Raspberry Pi again:
- sudo reboot
12. Install the CAN utils by running the command:
- sudo apt-get install can-utils
13. Bring up the CAN interface by running one of the following commands:
- For CAN 2.0B at 500kbps:
- sudo /sbin/ip link set can0 up type can bitrate 500000
- For CAN FD at 500kbps/2Mbps:
- sudo /sbin/ip link set can0 up type can bitrate 500000 dbitrate 2000000 fd on sample-point .7 dsample-point .7
14. Connect the PiCAN FD Duo ISO to your CAN network via the plug-in xxxx terminal.
15. To send a CAN 2.0 message, use the command:
- cansend can0 7DF#0201050000000000
16. To send a CAN FD message with BRS (Bit Rate Switch) set, use the command:
- cansend can0 7df##15555555555555555
17. To send a CAN FD message with no BRS, use the command:
- cansend can0 7df##05555555555555555
18. To monitor CAN traffic, use the command:
- can dump can0
19. You can use can1 instead of can0 to access the other CAN channel.
20. For Python installation and usage, ensure the PiCAN FD driver is installed correctly.
21. Clone the python-can repository by running the command:
- git clone https://github.com/hardbyte/python-can
22. Install python-can by running the command:
- sudo python3 setup.py install
23. Check for any error messages.
24. Bring up the can0 interface by running the command:
- sudo /sbin/ip link set can0 up type can bitrate 500000 bitrate 2000000 fd on sample-point .7 sample-point .7
25. Start Python3 and try transmitting a CAN FD message with BRS set using the following commands:
- python3
- import can
- bus = can.interface.Bus(channel='can0', bustype='socketcan', fd=True)
- msg = can.Message(arbitration_id=0x7de, extended_id=False, is_fd=True, bitrate_switch=True, data=[0,0,0,0,0,0x1e,0x21,0xfe,0x80,0,0,1,0])
- bus.send(msg)
26. To receive messages and display them on the screen, use the following command:
- notifier = can.Notifier(bus, [can.Printer()])
27. For more information and examples, refer to the documentation for python-can at:
- https://python-can.readthedocs.io/en/...
- Additional examples can be found on GitHub:
- https://github.com/skpang/PiCAN-FD-Python-examples
Add New Comment