This bug caused the message filtering malfunction when mask was defined.
Now the standart, extended and mixed message ID filtering with mask definition is supported.
When mixed is selected, only he higher bits of the Mask and ID registers are used.
/**
* 31 Set whether use of std/ext ID should have effect on acceptance filtering
*/
/**
* 31 Set whether use of std/ext ID should have effect on acceptance filtering
*/
- controller->IF1MSK = ((cfg.type == RPP_CAN_MIXED ? 0 : 1) << 31);
+ switch (cfg.type) {
+ case RPP_CAN_STANDARD:
+ controller->IF1MSK = 0 << 31;
+ break;
+ case RPP_CAN_MIXED:
+ controller->IF1MSK = 1 << 31;
+ break;
+ case RPP_CAN_EXTENDED:
+ controller->IF1MSK = 1 << 31;
+ break;
+ }
/**
* 31 Message object is valid
/**
* 31 Message object is valid
* 31 Set whether use of std/ext ID should have effect on acceptance filtering
* 28-1 Set mask
*/
* 31 Set whether use of std/ext ID should have effect on acceptance filtering
* 28-1 Set mask
*/
- controller->IF2MSK = ((cfg.type == RPP_CAN_MIXED ? 0 : 1U) << 31)
- | cfg.mask;
+ switch (cfg.type) {
+ case RPP_CAN_STANDARD:
+ controller->IF2MSK = (1 << 31) | (cfg.mask << 18);
+ break;
+ case RPP_CAN_MIXED:
+ controller->IF2MSK = (0 << 31) | cfg.mask;
+ break;
+ case RPP_CAN_EXTENDED:
+ controller->IF2MSK = (1 << 31) | cfg.mask;
+ break;
+ }
/**
* 31 Message object is valid
/**
* 31 Message object is valid
* 29 Direction is read
* 28-18 / 28-1 Object ID
*/
* 29 Direction is read
* 28-18 / 28-1 Object ID
*/
- controller->IF2ARB = (1U << 31)
+ controller->IF2ARB = (1U << 31) // MsgVal
| ((cfg.type == RPP_CAN_STANDARD ? 0 : 1) << 30)
| ((cfg.type == RPP_CAN_STANDARD ? 0 : 1) << 30)
| cfg.id << (cfg.type == RPP_CAN_STANDARD ? 18 : 0);
| cfg.id << (cfg.type == RPP_CAN_STANDARD ? 18 : 0);
/**
* 12 Use mask for filtering
* 7 End of buffer
/**
* 12 Use mask for filtering
* 7 End of buffer