1

enter image description hereTrying to filter messages using can in python using the following:

   bus=can.Bus(interface="ixxat",channel=0, bitrate=250000)
   filter=[{"can_id":0x0629, "can_mask"=0xFFFF}]
   bus.setfilters(filter)

   while True:
       msg=bus.recv()
       print(msg)

I've tried with "extended"=False as well, and attempted to use a different id, in case I misunderstand what 0629 means. Have tried "can_id" = 629, 0x629 with the same outcome.

I've tried setting the bus initially with filter, bus.apply_filters, and bus.set_filters. Does not seem to change the output.

The idea is to track a particular device in the network to monitor it closely, as well as make sending commands in response to its messaging easier. On a related note, I am also not sure how to send messages specifically to a device, unless that information is also found in the message itself (which all the technical specs on the device seem to indicate). This is my first time working with CAN-bus, so I'm learning it on the fly- have read lots of documentation on it, but still getting some of the principles down. Thank you for any help.

Am I misusing the "can_id", or "can_mask" settings?

Am I misunderstanding how this works? Thanks so much for the help. I also need to add more detail because of the code above, so I am writing what the system says. I can't think of anything else that might be relevant to getting this particular issue resolved. Once I learn how to track each message, I can identify the new devices on the network that we've added, ensure that they are the correct ones, and then begin sending messages to set them up in the network. Thanks again.

1 Answers1

0

@Ryan M. Williams. Please, try to use in your code can id == 0x0629 and mask == 0xFFF and let me know if works. Also, later try to code like this:

filters = [ {"can_id": 0x0629, "can_mask": 0xFFF, "extended": False} ]

bus = can.interface.Bus(channel=0, bustype="ixxat", can_filters=filters,bitrate=250000)

The can_id/mask must be specified according to IXXAT behaviour, that is bit 0 of can_id/mask parameters represents the RTR field in CAN frame. See IXXAT VCI documentation, section “Message filters” for more info.

from ixxat documentation :

To register exclusively an individual ID in the list, specify the desired ID (including RTR bit) in dwCode and in dwMask the value 0xFFF (11 bit ID) resp. 0x3FFFFFFF (29 bit ID).

Gabriel Lincoln
  • 155
  • 1
  • 10