2015-06-12 05:20 AM
I would like to connect to my car's CAN network but I'm a little confused as there are two CAN interfaces in STM32F407 - CAN1 (Master, PB8 and PB9) and CAN2 (Slave, PB5 and PB6).
Why do we need two interfaces? Can you tell me the difference or are they both needed to connect to one network? Or maybe CAN1 is just more robust than CAN2? Which one should I connect to my car's CAN network for reading data from the car? I found only these lines in the reference manual about the differences:CAN1: Master bxCAN for managing the communication between a Slave bxCAN andthe 512-byte SRAM memory
CAN2: Slave bxCAN, with no direct access to the SRAM memory.
The two bxCAN cells share the 512-byte SRAM memory Thank you
2015-06-12 10:17 AM
Other than the memory access and how the filters are split there's no difference between the two buses. CAN is a peer to peer network, no master or slave.
The reason for two interfaces is that some applications use the redundant support in CAN network protocols to increase reliability by using multiple buses. CANopen has a well-defined protocol for managing two buses to ensure certain high priority and safety critical messages are received by the entire network. Even if you don't use the redundant features you can still aggregate the two buses to double the bandwidth. If one bus is busy route outgoing messages to the other bus, and then merge incoming messages from both buses to the network stack. For a car you're likely to encounter the J1939 protocol. Some J1939 based vehicles (for instance heavy duty trucks) use multiple CAN buses to ensure adequate response in subsystems. These are not redundant but completely separate networks. Jack Peacock2015-06-15 03:42 AM
@peacock.jack.003
Thank you, much appreciated.