# CAN filter configuration to use along libcanard V1

**URL:** <https://forum.opencyphal.org/t/can-filter-configuration-to-use-along-libcanard-v1/1021>\
**Category:** Libcanard\
**Created:** [December 11, 2020, 2:56pm UTC](https://forum.opencyphal.org/t/can-filter-configuration-to-use-along-libcanard-v1/1021 "2020-12-11T14:56:28Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![noxuz](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/noxuz/32/397_2.png) [@noxuz](https://forum.opencyphal.org/u/noxuz)\
**Post date:** [December 11, 2020, 8:27pm UTC](https://forum.opencyphal.org/t/can-filter-configuration-to-use-along-libcanard-v1/1021/3 "2020-12-11T20:27:26Z")

</div>

Perfect!

The default filter config I was looking for will end up with the ID field as (0x1FFF \<\< 8), and in the case of the mask, same as line #195 from the PyUAVCAN function you shared, adding 3 bits to the mask aside from the (0x1D55 \<\< 8).  
[https://github.com/UAVCAN/pyuavcan/blob/f43afb54e944e766a052957ac6f03310ecc97c82/pyuavcan/transport/can/\_identifier.py#L194](https://github.com/UAVCAN/pyuavcan/blob/f43afb54e944e766a052957ac6f03310ecc97c82/pyuavcan/transport/can/_identifier.py#L194)

I also found the migration guide below that clarifies why the bits 22 and 21 are being ignored in the mask. This completes the explanation of all the bits particular when dealing solely with messages, as in the simplest case mentioned earlier.

> [@Libcanard for UAVCAN/CAN v1 is released](https://forum.opencyphal.org/t/libcanard-for-uavcan-can-v1-is-released/774/30):
>
> Here is the migration guide from Libcanard v0.100 to the stable v1.0.0. It is super short: Update your subject-ID idenfiers by clearing the two most significant bits. The maximum subject-ID was 32767 (15 bits), it was contracted down to 8191 (13 bits) in the Specification v1.0-beta. For example, the subject-ID of 32085 (0x7d55) would become 7509 (0x1d55). Notice that in many cases, this change does not really affect wire compatiblity between v0.100 and v1.0.0 (unless low subject-ID values are…

I think this step of configuring the filter is the only one that is skipped from the libcanard example provided in the repo’s readme; and adding this step to the section that demonstrates how to setup reception could be of support for the documentation.

 ![image](https://forum.opencyphal.org/uploads/default/original/1X/a3e8419b14f0b127b03b4cc420e6b4eccab1b80b.png)  
Quick idea is a single line just below the previous section:

```auto
configureHWfilter(7509, 2**13 - 1); // ID-Mask pair for receiving Hearbeat messages 

```

Thank you Pavel for the explanation.

---

_[View the full topic](https://forum.opencyphal.org/t/can-filter-configuration-to-use-along-libcanard-v1/1021)._
