Can bus project /// i need help

Hello. I’m currently working on a project where I connect both a BMS and a motor controller to an ESP32 via CAN communication. I have a question regarding the setup:

  1. Should I connect the BMS and the motor controller to the ESP32 separately, each using its own CAN connection?
  2. Or is it okay to connect both the BMS and the motor controller in parallel on the same CAN_H and CAN_L lines, like in a typical CAN bus setup?
    I believe option 2 should be fine since each device uses a different PID (identifier), but I’d appreciate your advice.

I moved your topic to an appropriate forum category @youganghyeon.

In the future, when creating a topic please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.

This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

Correct

note that the ESP32 has a onboard Two-Wire Automotive Interface (TWAI)

supported by ESP32-TWAI-CAN library

just requires a cjmcu-1051 CAN transceiver or similar

Is the SN65HVD230 in @youganghyeon's diagrams above unsuitable or inferior to cjmcu-1051?

Thanks for your answer.

So, both the BMS and the motor controller use 250 kbps, both use extended 29-bit CAN IDs, and they have different PIDs.
Given these conditions, it's okay to connect them on the same CAN bus and receive data using a single SN65HVD230 with an ESP32, right?

Every device on the bus must have both a canbus controller and a transceiver.

If that is the case and each has a unique PID then you can have a large number of devices on a single bus.

Yes, when connecting them together be sure it is separated from the bus by a transceiver and the units at each end of the bus need a 120 Ohm termination resistor. There are only two of them regardless of how many nodes.

You can place as a lot of nodes on the CAN bus, depending on what Transceivers you use.
This should help:

the CAN_H and CAN_L lines of the BMS and the motor controller are separated, so I wasn't sure if it was okay to connect them together on the same CAN bus. Thank you for your answer.

  1. The motor controller uses the SAE J1939 protocol, and it's unclear which protocol the BMS uses. Could there be any issues if these two systems use different protocols?
  2. If I successfully communicated with the motor controller and BMS using the ESP32 and SN65HVD230, can it be assumed that both the motor controller and BMS have integrated CAN transceivers?

Possibly yes. Do some tests to see if one generates messages that accidentally confuses the other.

Yes. All commercial products that list CAN as a feature will have transceivers.

@youganghyeon - Maybe your LCD should be on the CAN bus. It usually holds the limits (max speed, class1/2/3, assist level).