Warren Gay
2017-05-20 00:42:36 UTC
I made the following small change locally to the routine
*can_filter_id_mask_16bit_init()* to get it working correctly. The mask and
id values need to be reversed (mask goes to the upper 16 bits, while the
IDs values go to the lower 16 bits):
diff --git a/lib/stm32/can.c b/lib/stm32/can.c
index a7ca00fd..4e9d7c07 100644
--- a/lib/stm32/can.c
+++ b/lib/stm32/can.c
@@ -276,8 +276,8 @@ void can_filter_id_mask_16bit_init(uint32_t canport,
uint32_t nr, uint16_t id1,
uint16_t mask2, uint32_t fifo, bool
enable)
{
can_filter_init(canport, nr, false, false,
- ((uint32_t)id1 << 16) | (uint32_t)mask1,
- ((uint32_t)id2 << 16) | (uint32_t)mask2, fifo,
enable);
+ ((uint32_t)mask1 << 16) | (uint32_t)id1,
+ ((uint32_t)mask2 << 16) | (uint32_t)id2, fifo,
enable);
}
Once this change was made, both of my filters worked correctly (with my
setup, sending odd 11-bit addresses to one fifo, and the even addresses to
the other).
Thanks, Warren
*can_filter_id_mask_16bit_init()* to get it working correctly. The mask and
id values need to be reversed (mask goes to the upper 16 bits, while the
IDs values go to the lower 16 bits):
diff --git a/lib/stm32/can.c b/lib/stm32/can.c
index a7ca00fd..4e9d7c07 100644
--- a/lib/stm32/can.c
+++ b/lib/stm32/can.c
@@ -276,8 +276,8 @@ void can_filter_id_mask_16bit_init(uint32_t canport,
uint32_t nr, uint16_t id1,
uint16_t mask2, uint32_t fifo, bool
enable)
{
can_filter_init(canport, nr, false, false,
- ((uint32_t)id1 << 16) | (uint32_t)mask1,
- ((uint32_t)id2 << 16) | (uint32_t)mask2, fifo,
enable);
+ ((uint32_t)mask1 << 16) | (uint32_t)id1,
+ ((uint32_t)mask2 << 16) | (uint32_t)id2, fifo,
enable);
}
Once this change was made, both of my filters worked correctly (with my
setup, sending odd 11-bit addresses to one fifo, and the even addresses to
the other).
Thanks, Warren