How to hook up CAN bus?

jim lee

Well-known member
I've been using a custom circuit board with a CAN chip on it for talking to my Teensy. There are CAN bus pins on this thing, how does one hook up a can bus to them? What does one need to read/write CAN messages using these pins? Is there hardware needed? Libraries?
 
@jim lee:

For CAN hardware connectivity with the T4.0, I've successfully used a SN65HVD230 breakout board connected to the following pins:

PIN D22/A8 = CAN1 TX (to CTX on SN65HVD230 breakout board)
PIN D23/A9 = CAN1 RX (to CRX on SN65HVD230 breakout board)

In <this> thread, I posted a sketch that I developed over a long period of time (with lots of help from others on this forum, most especially @PaulS) which I used extensively for querying & monitoring the CAN bus on my 2020 Honda Civic (& other vehicles as well).

Hope that helps . . .

Mark J Culross
KD5RXT
 
Would this work? Adafruit can bus interface
Or possibly this one? Waveshare SN65HVD230 - Found on Amazon.
@jim lee: Sorry, I don't have any personal experience with the Adafruit device. The CANbus interface that I used was ordered from Amazon (it was a SN65HVD230 breakout), however, it is no longer available. Based upon the fact that the Waveshare device is using the same SN65HVD230 primary IC, I would think that it should work as well.

Hope that helps !! Good luck & have fun !!

Mark J Culross
KD5RXT
 
@jim lee : I would definitely suggest the Waveshare board, it works fine.

These will probably also work [although there are fake SN65HVD230 parts out there]:

1786863815261.png


But be aware that the silkscreen may be wrong on the other side of the PCB. See this post.

Paul
 
To my knowledge all CANBus driver chips are equivalent dumb transceivers - all the smarts is in the microcontroller, so other than maximum baud rate limitations and maximum fanout limitations the transceiver chips should all inter-work.

But watch out for termination issues and very long busses - a 120R terminator at each end is required (for multidrop the intermediate transceivers need termination resistor disabled/unsoldered).
 
I think I have the termination issue already solved. It's a long bus with teminators on the ends. (35' Sailboat) I just cooked my original electronics. And need something to get myself back up and running. I'm going to give the Adafruit one a try because I can get it quick and know who to yell at if it doesn't work.
 
Ok I'm assuming this : FlexCAN_T4 is the library I want to use for this "TJA1051" board. This says it it goof for Teensy 4.0 processors.

The way the example creates the instance of the interface :
Code:
FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_16> Can0;

I'm not familiar with this kind of creation. typeName<this,that,theOther> objName; What's with these <> brackets? How are they different than the old ( ) brackets? I never learned templates. My previous driver I was able to create it as a pointer and use newObj = new typeName(Params); Is there some sort of mapping between the two types or creators?

Thanks Millions!
 
Ok I'm assuming this : FlexCAN_T4 is the library I want to use for this "TJA1051" board. This says it it goof for Teensy 4.0 processors.

The way the example creates the instance of the interface :
Code:
FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_16> Can0;

I'm not familiar with this kind of creation. typeName<this,that,theOther> objName; What's with these <> brackets? How are they different than the old ( ) brackets? I never learned templates. My previous driver I was able to create it as a pointer and use newObj = new typeName(Params); Is there some sort of mapping between the two types or creators?

Thanks Millions!
You can find an explanation here. (From Google Search)
 
Back
Top