This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RS485 CAN HAT [RESOLVED]
#1
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.
   

Any ideas?

TIA
--
Sailor and techie or techie and sailor?
Whichever way I am in the right place
Reply
#2
my config is this for can:
dtoverlay=mcp2515-can0,oscillator=12000000,interrupt=25

for RS485 bluetooth has to be disabled.

holger
Reply
#3
(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.
   
--
Sailor and techie or techie and sailor?
Whichever way I am in the right place
Reply
#4
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
Reply
#5
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.
Reply
#6
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.
--
Sailor and techie or techie and sailor?
Whichever way I am in the right place
Reply
#7
fine - you got it...

maybe this helps for others.

how
Reply
#8
(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.
--
Sailor and techie or techie and sailor?
Whichever way I am in the right place
Reply
#9
Of you Connect them with an cable, The characters will be Received.
Opencpn has an Option to set it as an Output Line.
Reply
#10
(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!
--
Sailor and techie or techie and sailor?
Whichever way I am in the right place
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)