Zum Inhalt springen

WSAL14882 – RS485 CAN HAT/en

Aus JW Tech Wiki

Documentation notice: This technical documentation was independently rewritten from an archived supplier source. Check technical details and commands against the product version and manufacturer documentation before use.

Summary

The RS485 CAN HAT adds CAN and RS485 communication to a Raspberry Pi via the 40-pin GPIO header. It uses an MCP2515 CAN controller over SPI and an SP3485 transceiver for half-duplex RS485 operation.

Related products at JW Tech

Technical overview

  • Standard 40-pin Raspberry Pi GPIO header compatible with all Raspberry Pi models, including Raspberry Pi 4B.
  • CAN function: onboard MCP2515 CAN controller via SPI interface with SN65HVD230 transceiver (Texas Instruments).
  • RS485 function: controlled via UART, half-duplex operation; the SP3485 transceiver supports automatic TX/RX control without additional programming.
  • Onboard TVS suppresses surge voltages and electrostatic discharge on the RS485 bus.
  • Dimensions: 65 mm x 30 mm; mounting hole diameter 3.0 mm; operating voltage 3.3 V.
  • CAN bus pins: SCK, MOSI, MISO, CS (CE0), and interrupt output at pin 25 (BCM).
  • RS485 bus pins: RXD, TXD via UART; RSE control signal at BCM pin 4.
  • Factory default uses hardware auto mode for RS485 transmit/receive; manual software control can be enabled by soldering a 0-ohm resistor.
  • For CAN operation, add 'dtparam=spi=on' and the dtoverlay 'mcp2515-can0' to /boot/config.txt (or /boot/firmware/config.txt for Bookworm/Ubuntu).
  • After reboot, verify initialization with 'dmesg | grep -i "\(can\|spi\)'.

Commands and examples – verify before use: 

sudo nano /boot/config.txt
dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=12000000,interrupt=25,spimaxfrequency=2000000
sudo reboot
dmesg | grep -i '\(can\|spi\)','sudo ip link set can0 up type can bitrate 1000000
sudo ifconfig can0 txqueuelen 65536
sudo ifconfig can0 up
ifconfig
sudo apt-get install can-utils
sudo ip link set can0 down
sudo ip link set can0 type can bitrate 1000000 loopback on
candump can0
cansend can0 000#11.22.33.44

Notes and version constraints

  • On Bookworm systems only the lgpio library is available; bcm2835 and wiringPi cannot be installed or used.
  • The oscillator setting depends on purchase date: pre-August 2019 boards use an 8 MHz oscillator; newer boards use 12 MHz.
  • For very high baud rates, it is recommended to use the manual RS485 transceiver because transistor switching speed limits the automatic mode.
  • When testing with a single module: enable loopback mode and verify with 'candump'/'cansend'.
  • Ensure both ends of the CAN bus have 120-ohm terminating resistors and that the bit rate is identical on both sides.
  • If initialization fails: check the physical connection, confirm SPI and the MCP2515 kernel driver are enabled, and that a reboot was performed after configuration changes.

Source and revision record

  • RS485 CAN HAT - Waveshare Wiki
  • Source revision: 110789
  • Captured: 2026-08-31T02:31:38+00:00
  • SHA-256: 4a716167cb065406906af14e64473e3b0368b69f1e23823f75e1979a0bac156e