سؤال

I had an interview. The interviewer asked me:

If two nodes are sending two messages of the same identifier (0x100) with different data, who will win the arbitration? Which message will be there on the bus?

If node 1 wins then what about node 2's message? When will node 2's message be sent?

هل كانت مفيدة؟

المحلول

There are two cases here

  1. Same ID and the same DATA field
  2. Same ID with a different DATA field

CASE 1: when two nodes are trying to transmit the same ID and the same data field, the CAN will see it as a single message, and it will send it on the CAN bus. Here you really can't say if node 1 is sending or node 2 is sending, because both has the same ID and data.

CASE 2: here the data field is different. Until the arbitration field there will be no problem. Since the data is different for both the nodes you will get a bus error. This is because your data field is protected by a CRC and bit stuffing also will come into the picture.

نصائح أخرى

In a CAN N/W if 2 devices are with same Node Id's, then both devices will not detect & No resquest/ response of messages will takes place. (Nothing will work.. like Bit Stuffing, Arbitration, Error Detection, Bit monitoring, ACK, CRC).

In a N/W if we have differernt ID's, then we can transfer same or different messages. Inorder to take control over the CAN N/W then we use the concept of Arbitration.

I found the answer in Controller Area Network - CAN Information.

Two nodes on the network are not allowed to send messages with the same ID. If two nodes try to send a message with the same ID at the same time, arbitration will not work. Instead, one of the transmitting nodes will detect that his message is distorted outside of the arbitration field. The nodes will then use the error handling of CAN, which in this case ultimately will lead to one of the transmitting node being switched off (bus-off mode).

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top