Skip to main content
qwer.asdf
Senior
June 12, 2015
Question

bxCAN Master vs Slave

  • June 12, 2015
  • 2 replies
  • 839 views
Posted on June 12, 2015 at 14:20

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 and

 

the 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
    This topic has been closed for replies.

    2 replies

    jpeacock
    Associate
    June 12, 2015
    Posted on June 12, 2015 at 19:17

    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 Peacock
    qwer.asdf
    qwer.asdfAuthor
    Senior
    June 15, 2015
    Posted on June 15, 2015 at 12:42

    @peacock.jack.003

    Thank you, much appreciated.