OpenMarine

Full Version: RS485 CAN HAT [RESOLVED]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I saw how cheap this [https://thepihut.com/products/isolated-r...spberry-pi] was and I thought that I could replace the USB-RS485 adapter for more or less the same money and have a HAT rather than a USB device hanging of my RasPi and an NMEA2000 interface for future expansion.

I sorted out the CAN side of things but I cannot understand how to enable/connect the RS485 ports. Anybody has done it? I tried adding this to /boot/config.txt
Code:
dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25,,spimaxfrequency=1000000
dtoverlay=sc16is752-spi1,int_pin=24
But I got a conflict at the 'Check System' applet.
[attachment=2095]

Any ideas?

TIA
my config is this for can:
dtoverlay=mcp2515-can0,oscillator=12000000,interrupt=25

for RS485 bluetooth has to be disabled.

holger
(2023-03-18, 10:20 PM)holgerw Wrote: [ -> ]my config is this for can:
dtoverlay=mcp2515-can0,oscillator=12000000,interrupt=25

for RS485 bluetooth has to be disabled.

holger

On some FB group, people told me that it might be because I am running 64-bit OP. So I did a trial with a 32-bit and it's still the same. I still get the error/warning.

This time I tested if the RS485 works and it's receiving data OK. I cannot test the CAN bus, though.

I tried disabling the Bluetooth, but still no luck. BTW, I am running a Raspberry Pi 4B.

BTW, my CAN HAT has a 16MHz oscillator so I set it to 16000000.

Here you can see the Serial, CAN Bus and System Check applets.
[attachment=2096]
Ok, you have another HAT, but the CAN chip is the same, only other frequency. and you have also 2 serial chips, so forget about bluetooth. i am running also on pi4 with 64bit, so this should work.

what makes me think: the eroor tells about the GPIO conflicts. so there are pins in use which your Hat wants to use.
Check for this in OP-GPIO. And did you enable SPI-Bus in raspi-config?

good luck. Holger
there are 2 versions of the HAT. the old version has two modifications.
A1. Quite old with 8MHz quartz and serial UART
A2. same but with 12 MHz quartz

and now what TO has is B Variant
The board is well documented in WIKI from manufacturer
https://www.waveshare.com/wiki/RS485_CAN_HAT_(B)
Code:
dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25,,spimaxfrequency=1000000
dtoverlay=sc16is752-spi1,int_pin=24
After reboot the serial ports /dev/ttySC0 & /dev/ttySC1 are available.
Update:

After loads of head-scratching and head-banging-against-the-wall, I managed to find the culprit.

Inside my config.txt file there was the following line:
Code:
enable_uart=0

As soon as I commented that one out, the conflict disappeared.

Thanks for all the ideas, suggestions and help.
fine - you got it...

maybe this helps for others.

how
(2023-03-20, 09:17 PM)holgerw Wrote: [ -> ]fine - you got it...

maybe this helps for others.

how

Yes, that is my plan. When it's all done to post a step by step guide for it.

I still have a question, though: have you managed to use one of them as an output? I don't seme to be able to do it.

Thanks again.
Of you Connect them with an cable, The characters will be Received.
Opencpn has an Option to set it as an Output Line.
(2023-03-21, 01:22 AM)holgerw Wrote: [ -> ]Of you Connect them with an cable, The characters will be Received.
Opencpn has an Option to set it as an Output Line.

Thanks!

While you were typing I was playing with wires! I used the SK Simulator plugin (I just discovered it) and it all started spewing out data.

Thanks again!