1
\$\begingroup\$

I have tried to design a circuit for controlling the CAN bus 120 Ohms termination resistance by using a 3.3V GPIO from a STM32 MCU.

In the SSR datasheet, it specifies that the LED voltage should typically be 1.27V. So by using a voltage divider with 3.3V input and R1 = 20k, R2 = 13k that would result in 1.3V. I understand the issues regarding timing of the bus resistance etc. but since the customer of the product should open the box with the PCB, using physical switch is not preferrable.

The ON-state resistance is specified as 0.3 Ohms max, so the bus resistance should not be an issue in my opinion. I have not used SSR like this before, so if anyone could verify if the design should work in theory, that would be very helpful.

enter image description here

EDIT: This is what my current solution looks like. enter image description here

\$\endgroup\$

3 Answers 3

2
\$\begingroup\$

The LED voltage specification is the forward voltage of the LED - when it's turned on, the voltage across it will be (around) 1.27V. This means that you need a resistor to limit the current, but you only need R64 - you should remove R81.

After removing R81, the current through the LED will be (3.3-1.27)/R64 = 100uA, but the datasheet says that it needs to be at least 2mA, so R64 needs to be max 1kOhm.

\$\endgroup\$
2
1
\$\begingroup\$

For starters, that's not how you drive LEDs with an MCU. The LED inside the relay needs at least 2mA of current. The resistor values cannot provide that.

Also the LED voltage range for 2mA current is from 1.1V to 1.3V. Simply use Ohm's law to calculate a series resistor for LED.

The next thing is more serious. The CAN bus must terminate at the ends of the cable. If this is the last device it is OK to terminate inside the devive. But do understand that if there ever is a problem, such as accidentally the LED being controlled off, or power to the MCU breaks, the whole bus will become unterminated on that end, and all communication on the bus may fail.

So if this device is required to terminate the bus, you can never turn the power off from this device to save batteries or the bus termination fails.

\$\endgroup\$
1
  • \$\begingroup\$ Yes, you are absolutely correct about the LED, I guess it's just late in the evening. Thanks for pointing out though. Regarding the serious stuff: I am aware of the things that you are pointing out, but for this application it should be fine. Will do a lot of testing to verify that it wont be a problem. Cheers \$\endgroup\$
    – eidetech
    Commented Feb 24 at 21:53
1
\$\begingroup\$

These parts likely are too slow to be used, up to 6ms switching time.

Compare that to your baudrate and count how many error frames that may get sent during that time, enough to put the part in error passive mode (128 errors)?

Probably, if my calculations are correct - assuming standard baudrate of 250kbps and 6 bit error frames and 3 interframe spacing, then 1/250kps * (6+3) = 36us. 6ms / 36us = 166 error frames.

I've encountered problems with crappy switching of CAN bus signals before - someone was using plain old car relays to switch CAN bus signals and relays are far too slow - giving the bus plenty of time to die completely until the switch was done.

Consider using analog switches instead, if you insist of having a MCU GPIO pin solution like this.

\$\endgroup\$
5
  • \$\begingroup\$ Thanks for the input Lundin, this is great value to me. I have done some research on analog switches. For example the TS5A3166DCKR seems like a good price/performance part for solving this problem. Do you agree, or do you have any better suggestions? \$\endgroup\$
    – eidetech
    Commented Feb 28 at 7:26
  • \$\begingroup\$ @eidetech You'll probably want one with 2 channels so you can flip both CAN lines at once. \$\endgroup\$
    – Lundin
    Commented Feb 28 at 7:37
  • \$\begingroup\$ Not sure I understand what you mean by flipping both CAN lines at once. I only want to connect a 120 Ohms resistor between the CAN H and CAN L lines. I have updated the post with new schematic diagram of how I have connected it currently. \$\endgroup\$
    – eidetech
    Commented Feb 28 at 7:58
  • \$\begingroup\$ @eidetech Hmm yeah actually that's probably ok. I was thinking you would attach each signal to each side of resistor, but leaving it as a "stub" always attached to one of them is probably harmless. \$\endgroup\$
    – Lundin
    Commented Feb 28 at 8:01
  • \$\begingroup\$ Aha now I see what you mean. Yeah I think this is fine. Thanks for the input. \$\endgroup\$
    – eidetech
    Commented Feb 28 at 8:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.