Automatic swapping of CAN-H and CAN-L lines - Page 1
Forum section: electronics / projects

author: matkar
author_rank: Regular Contributor
timestamp: August 31, 2013, 03:21:17 pm
content: Hi,I'm developing a CAN bus device. I'm trying to make some improvements to ease the use of the device. I'd like to implement a mechanism that will automatically invert CANH and CANL lines if a wrong connection to the network is detected.There are two issues to resolve:- Detecting connection polarity- Reversing connectionAs concerns detection I haven't put a lot of thought in it. Currently I'm more concerned with reversing. My ideas are:- Using a DPDT relay. Bad sides are inductive spikes, turn on current spike and drawing power from limited power supply. I'd use this method as a last resort.- Solid state switching solution with some analog switches. I'm not sure if this would work since analog switches have some internal resistance which will probably cause trouble on CAN.- Using two reversely connected CAN transceivers and switching between the two of them.My questions are:A: Do you think it's worth bothering with this functionality?B: Has anybody of you ever seen or made similar solution?C: Can you suggest a better solution? Anything goes...Regards,Matjaž

author: Mad ID
author_rank: Regular Contributor
timestamp: August 31, 2013, 03:32:07 pm
content: I have used DPDT relay for this exact problem in one high volume industrial product (which went trough rigorous testings) and it works like a charm.Solid state solution is not simple as the common mode range of CAN is if I remember correctly -7V do 7V. You have to cover the whole range and impose minimal resistance to the bus..I suspect this is very difficult.

author: matkar
author_rank: Regular Contributor
timestamp: August 31, 2013, 08:05:30 pm
content: Do you remember which brand/type of relay did you use? Am a bit concerned about added capacitance. What was the product's CAN bitrate?Good point regarding solid state solution.I will assemble and test double transceiver metod and report back the results.

author: tszaboo
author_rank: Super Contributor
timestamp: August 31, 2013, 08:17:56 pm
content: Dont forget, that the CAN transceivers have lot of built in ruggedness. ESD, overvoltage, short circuit protection. If you put a solid state before it, it has to handle that.Using two can controllers will divide the number of devices by two. There is twice the load on the lines.If reverse connection could be a serious issue, I would rather put two LED, resistor, and a microswitch before the receivers. During installation, there is communication, you press the button, either of the LEDs will blink. Make good connection green, bad connection red. The installer will see if the cable is wrong or not.

author: free_electron
author_rank: Super Contributor
timestamp: September 01, 2013, 12:21:07 am
content: If you use a good signal relay with latvhing coils it should work fine.

author: Mad ID
author_rank: Regular Contributor
timestamp: September 01, 2013, 01:47:46 pm
content: Quote from: matkar on August 31, 2013, 08:05:30 pmI don't, the cheapest one from Digikey probably. Don't worry about the capacitance, it's not an issue here.You can easily determine if the connection is reversed by looking at CAN controller's error counters (Tx and/or Rx).

author: fcb
author_rank: Super Contributor
timestamp: September 01, 2013, 07:47:01 pm
content: Quote from: matkar on August 31, 2013, 03:21:17 pmA: No, you should not encourage users to wire things wrong. Protection against accidental reverse polarity or misconnection YES, but not trying to make it work if it is wired wrong.B: No.C: Perhaps a warning LED or notice in software to suggest they have wired the CANL/H round the wrong way.