WaveShare RS485 CAN module note

Viewed 13 times

So I have been at least trying to connect to the hat from the Pi, the following is my configuration: enter image description here

I follow the manual set in this link: https://www.waveshare.com/w/upload/2/29/RS485-CAN-HAT-user-manuakl-en.pdf

However I get the following output when checking if the connection is successful: enter image description here

This is my config.txt file: enter image description here

I use the oscillator with that number since the version of the hat I have uses that oscillation value. I use dtoverlay=spi0-hw-cs instead of the usual dtoverlay=spi0-bcm2835-overlay because my overlays folder is as shown:

enter image description here

I have checked the wiring multiple times, tried to reduce the spimaxfrequency, checked the interrupt pin in the config.txt file to be sure its connecting to the correct pin of the Pi, but all to no avail.

Can anyone please help? It’s for an important uni project…

  • Hi @aldo, Welcome and nice to meet you. Ah, let me see. First thing first, please let me know how do you do with the following: (1) $ uname -a, (2) $ ls /dev/spi*. / to continue, … – tlfong01 2 hours ago
  • Second thing. Let us see if our docs are in sync: (1) RS485 CAN HAT Overview and Features – WaveShare waveshare.com/rs485-can-hat.htm (2) RS485 CAN HAT Wiki – WaveShare waveshare.com/wiki/RS485_CAN_HAT (3) RS485 CAN HAT User Manual – WaveShare waveshare.com/w/upload/2/29/RS485-CAN-HAT-user-manuakl-en.pdf. / to continue, … – tlfong01 2 hours ago
  • Third. If possible, beg/steal/borrow the following or similar, and confirm our docs in sync: (4) USB TO RS232/RS485/TTL Industrial Isolated Converter Overview and Features – WaveShare waveshare.com/usb-to-rs232-485-ttl.htm (5) USB TO RS232/485/TTL Wiki – WaveShare waveshare.com/wiki/USB_TO_RS232/485/TTL (6)USB TO RS232/485/TTL User Manual – WaveShare waveshare.com/w/upload/e/e4/…. /to continue, … – tlfong01 2 hours ago
  • I will be brainstorming quick and dirty troubleshooting ideas. This forum is only for short Q&A. It would be nice if you can let me know your public GitHub/GitLab/ProjectBlog with more details such as: (version of HAT, 10HMz or 12MHz), You DSC (Digital Storage /。。Ah sorry I have an Eng to Chi clash, need to reset. Never mind if you see funny characters. Perhaps come back this afternoon – tlfong01 2 hours ago
  • I am using Chinese Win10 to talk and might show funny characters here and there, now and then. In case you read weird chars. Let me know and I can extract docs from my Chinese Wiki/blog/penzu test log/diary for your more pleasant reading. 拜拜. – tlfong01 2 hours ago
  • I must confess that I have very little practical experience with CAN/485, though I know pretty well UART/SPI/I2C. So be warned that I might mislead you by amateurishly stupid suggestions. Now let me brainstorm a test plan: (1) just try SPI, forget the UART part. (2) The software/drivers the tutorial recommend is “universal” for all versions of Rpi. If you are using Rpi3A+ buster/stretch/jessie/wheezy? You might not need to following the tutorial’s install guides, expecially when using pip/pip3 which might confuse the raspbain. – tlfong01 1 hour ago
  • (3) I would suggest to focus on the python version of setup and debug, because (a) C/C++ language is hard to debug/develop, (b) WiringPi is depreciated, no long supported. Ah lunch time. See you late evening or tomorrow. Cheers. – tlfong01 1 hour ago
  • Your connection failure error message above says “Error 19: probe failed, SPI0.0 cannot initialize MCP2515”. So I would suggest to first troubleshoot MCP2515 in two steps: (1) make sure SPI 0.0 wiring/driver are OK by using python SPI loopback test, (2) Use python to write and read MCPO2515 config register, to make sure the HAT should be OK to do similar. – tlfong01 just now   Edit

CAN RS485 Discussion Notes

(7) MCP2515 SPI CAN Controller Datasheet – MicroChip

Click to access MCP2515-Stand-Alone-CAN-Controller-with-SPI-20001801J.pdf

(8) MCP2515 Summary – tlfong01

(9) AliExpress SPI TJA1050 MCP2515 Can Bus Module US$2

(10) WaveShare Rpi3b+/4B RS485 SPI CAN bus UART module ¥58


(4) USB TO RS232/RS485/TTL Industrial Isolated Converter Overview and Features – WaveShare

(5) USB TO RS232/485/TTL Wiki – WaveShare

(6)USB TO RS232/485/TTL User Manual – WaveShare

Click to access USB_TO_RS232_485_TTL_-user-manual-en.pdf

(1) RS485 CAN HAT Overview and Features – WaveShare

(2) RS485 CAN HAT Wiki – WaveShare

(3) RS485 CAN HAT User Manual – WaveShare

Click to access RS485-CAN-HAT-user-manuakl-en.pdf

WH/2B/3B/3B+ (no Rpi4B),

CAN – Controller SPI MCP2515 Transceiver SN65HVD230

RS485 – Controller UART, half-duplex, Transceiver SP3485

Python Examples – pages 16, 20, 24

sudo pip install python-can

dtoverlay=spi0-hw-cs instead of the usual dtoverlay=spi0-bcm2835-overlay




Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: