ESP 32 and multiple CAN BUS - Page 1
Forum section: electronics / projects

author: tru3533
author_rank: Regular Contributor
timestamp: March 16, 2022, 06:04:36 pm
content: Working on a project where I need to monitor 3 CAN Bus lines. One at the time.Using ESP32Have limited space and would like to use only one CAN Transceiver (MAX3051)Can you help with a solution how I can do this?

author: matb
author_rank: Regular Contributor
timestamp: March 17, 2022, 07:10:07 am
content: I did that on a project with ahttps://www.ti.com/lit/ds/symlink/cd74hc4052.pdf?ts=1647424521982HC4052.That worked well up to 1Mbps (I didn't try more as I didn't need to).My case was specific because Iknew for surethat multiple lines were not communicating at the same time, here you don't specify if multiple lines can be transmitting at the same time. That could be a big problem.I had the CAN signal from my µC going through the HC4052 and then either to CAN1 or CAN2 (going the same speed but I guess you could manage that in software)

author: tru3533
author_rank: Regular Contributor
timestamp: March 17, 2022, 12:03:20 pm
content: Thank you so much matb, for this grate tip. Very useful chip to discover.

author: fchk
author_rank: Frequent Contributor
timestamp: March 17, 2022, 12:03:41 pm
content: Your idea is not the recommended way. CAN transceivers are not only simple level shifters, but they also serve as circuit protection. You won't have the same level of protection with analog switches, your common mode range will be worse, and the overall reliability will be worse.If you have space problems, then there are transceivers in spaller packages (SOT23-8 or DFN-8). You should go for smaller packages then.fchk

author: matb
author_rank: Regular Contributor
timestamp: March 17, 2022, 12:12:00 pm
content: @fchk it is not a space problem, it is kind of a CAN multiplexing problem. From one can transceiver to multiple CAN signals.@tru3533 you should prototype the circuit so you can be sure it will work for your application.This design is in a used product distributed to dealership and other places so it works, the only thing is will it work for you.

author: tru3533
author_rank: Regular Contributor
timestamp: March 17, 2022, 12:34:06 pm
content: @matb you are absolutely right, I was thinking I had a space problem, but diving deeper into the problem,I think I will meet problems with 3 can lines to the ESP32, wonder if this is possible by switching in software?

author: matb
author_rank: Regular Contributor
timestamp: March 17, 2022, 12:43:15 pm
content: Not sure I understand this question but I guess you are asking if it is possible.You could have some kind of functionCode:select_can1with likeCode:A = 1 B = 0 C = 0 init_can(1Mbps)but you could have quite a lot of problems if you switch in the middle of a communication (again you could have some kind of boolean that says "No transmission / reception at the moment" that allows you to switch lines.It depends on the frequency of connection between all the CAN lines.

author: Robotec
author_rank: Contributor
timestamp: March 17, 2022, 01:10:48 pm
content: Wouldn't be much easier to have 3 different transceivers and switching enabling and disabling the transceivers? just 1 more chip and you would keep the protections, this but with 3 transceivers using the shdn signal.

author: tru3533
author_rank: Regular Contributor
timestamp: March 17, 2022, 05:22:29 pm
content: @RobotecGenious, I totally overlooked shdnThis solution covers everything! Thank you so much