Skip to content

Incorrect frame re-transmission when arbitration ID is duplicate #606

@sbourkedev

Description

@sbourkedev

When arbitration ID is duplicate, only the last message with that arbitration ID is re-transmitted according to period.

Below is a code snippet of how messages are defined.
Note that pm_snapshot_msg, vin1_msg, vin2_msg & vin3_msg have the same arbitration_id 0x400.

self.pm_msg = can.Message(
            arbitration_id=0xFF, 
            data=self.pm_data, 
            extended_id=False, 
            dlc=8)

        self.pm_snapshot_msg = can.Message(
            arbitration_id=0x400, 
            data=self.pm_snapshot_data,
            extended_id=False, 
            dlc=8)
        self.nm_msg = can.Message(
            arbitration_id=0x51E, 
            data=self.nm_data, 
            extended_id=False, 
            dlc=8)

        self.vs_msg = can.Message(
            arbitration_id=0x11, 
            data=self.vs_data, 
            extended_id=False, 
            dlc=8)

        self.vin1_msg = can.Message(
            arbitration_id=0x400, 
            data=self.vin1_data,
            extended_id=False, 
            dlc=8)

        self.vin2_msg = can.Message(
            arbitration_id=0x400, 
            data=self.vin2_data,
            extended_id=False, 
            dlc=8)

        self.vin3_msg = can.Message(
            arbitration_id=0x400, 
            data=self.vin3_data,
            extended_id=False, 
            dlc=8)

Below is code where messages are sent.

def wake(self):
        if self.can_state == "sleep":
            self.nm_data[1] = 0x2
            self.nm_msg.data = self.nm_data
            self.nm_task = self.bus.send_periodic(self.nm_msg, self.nm_period)
            if not isinstance(self.nm_task, can.ModifiableCyclicTaskABC):
                print("This interface doesn't seem to support modification")
                task.stop()
                exit(-1)
            self.pm_task = self.bus.send_periodic(self.pm_msg, self.pm_period)
            self.pm_snapshot_task = self.bus.send_periodic(self.pm_snapshot_msg, self.pm_snapshot_period)
            self.vs_task = self.bus.send_periodic(self.vs_msg, self.vs_period)
            self.vin1_task = self.bus.send_periodic(self.vin1_msg, self.vin_period)
            self.vin2_task = self.bus.send_periodic(self.vin2_msg, self.vin_period)
            self.vin3_task = self.bus.send_periodic(self.vin3_msg, self.vin_period)
            self.can_state = "active"
        else:
            print("Sim already running")

Below is the candump after wake() is called. Note that all messages are transmitted at first, but after that only the last message with arbitration id of 0x400 is sent, namely vin3_msg, which was the last message to be defined with arbitration id of 0x400.

can0  51E   [8]  10 02 00 00 00 00 00 00
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  400   [8]  B0 A1 B1 C1 D1 E1 04 00 <-- pm_snapshot_msg 0x400
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  400   [8]  57 00 00 00 4B 4C 31 54  <-- vin1_msg 0x400
  can0  400   [8]  58 44 35 44 45 33 42 42  <-- vin2_msg 0x400
  can0  400   [8]  59 31 39 35 37 35 36 00  <-- vin3_msg 0x400
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  51E   [8]  10 02 00 00 00 00 00 00
  can0  400   [8]  59 31 39 35 37 35 36 00  <-- vin3_msg 0x400
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  51E   [8]  10 02 00 00 00 00 00 00
  can0  400   [8]  59 31 39 35 37 35 36 00  <-- vin3_msg 0x400
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  51E   [8]  10 02 00 00 00 00 00 00
  can0  400   [8]  59 31 39 35 37 35 36 00  <-- vin3_msg 0x400
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  51E   [8]  10 02 00 00 00 00 00 00
  can0  400   [8]  59 31 39 35 37 35 36 00  <-- vin3_msg 0x400
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  51E   [8]  10 02 00 00 00 00 00 00
  can0  400   [8]  59 31 39 35 37 35 36 00  <-- vin3_msg 0x400
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00
  can0  0FF   [8]  00 00 04 60 00 00 00 00
  can0  011   [8]  00 C0 0C 00 00 00 00 00

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions