Skip to content

Commit 63bdb26

Browse files
committed
NUVOTON: CAN: Fix filter mask
NOTE: This fix only targets CAN (M453/M487), not CAN-FD (M467). NOTE: NUC472 CAN doesn't support filter.
1 parent 7ae592d commit 63bdb26

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

targets/TARGET_NUVOTON/TARGET_M451/can_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ int can_filter(can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t
294294
{
295295
numask = (mask << 18);
296296
}
297-
numask = (numask | CAN_IF_MASK2_MDIR_Msk | CAN_IF_MASK2_MXTD_Msk);
297+
numask = (numask | ((CAN_IF_MASK2_MDIR_Msk | CAN_IF_MASK2_MXTD_Msk) << 16));
298298
return CAN_SetRxMsgAndMsk((CAN_T *)NU_MODBASE(obj->can), handle, (uint32_t)format, id, numask);
299299
}
300300

targets/TARGET_NUVOTON/TARGET_M480/can_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ int can_filter(can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t
341341
{
342342
numask = (mask << 18);
343343
}
344-
numask = (numask | CAN_IF_MASK2_MDIR_Msk | CAN_IF_MASK2_MXTD_Msk);
344+
numask = (numask | ((CAN_IF_MASK2_MDIR_Msk | CAN_IF_MASK2_MXTD_Msk) << 16));
345345
return CAN_SetRxMsgAndMsk((CAN_T *)NU_MODBASE(obj->can), handle, (uint32_t)format, id, numask);
346346
}
347347

0 commit comments

Comments
 (0)