How to set Rx FIFO Mask?

cancel
Showing results for 
Search instead for 
Did you mean: 

How to set Rx FIFO Mask?

Jump to solution
853 Views
kbj
Contributor IV

Dear NXP.

I develop with S32K144 and S32DS for arm with SDK3.0.0

If I want to receive CAN id 0x111, How to set the Rx FIFO Mask?

I set like as below.

But all ID can be received.(0x000~ 0x7FF)

canDataInfoTable[idx].id = idx;
canDataInfoTable[idx].isExtendedFrame = FALSE;
canDataInfoTable[idx].isRemoteFrame = FALSE;

FLEXCAN_DRV_ConfigRxFifo(INST_CANCOM2, FLEXCAN_RX_FIFO_ID_FORMAT_B, canDataInfoTable);

FLEXCAN_DRV_SetRxFifoGlobalMask(INST_CANCOM2, FLEXCAN_MSG_ID_STD, (((uint32)(0x7FF)<<18u) & 0x1FFC0000u));

FLEXCAN_DRV_SetRxIndividualMask(INST_CANCOM2, FLEXCAN_MSG_ID_STD, 0, (((uint32)(0x111)<<18u) & 0x1FFC0000u));

Please let me know how to set the mask to receive the CAN ID 0x111.

Best regards,

Byungju.

0 Kudos
1 Solution
659 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you should configure all ID elements in ID filter table and set mask properly. So for default 8 elements below code can be used

/* ID Filter table */
flexcan_id_table_t filterTable[8]={};
uint16_t id_counter;

for(id_counter=0;id_counter<8;id_counter++)
{
    filterTable[id_counter].isRemoteFrame = false;
    filterTable[id_counter].isExtendedFrame = false;
    filterTable[id_counter].id = 0x111 ;
}
/* Configure RX FIFO ID filter table elements based on filter table defined above*/
FLEXCAN_DRV_ConfigRxFifo(INST_CANCOM1, FLEXCAN_RX_FIFO_ID_FORMAT_A, filterTable);
/* set individual masking type */
FLEXCAN_DRV_SetRxMaskType(INST_CANCOM1, FLEXCAN_RX_MASK_INDIVIDUAL);
for(id_counter=0;id_counter<8;id_counter++)
FLEXCAN_DRV_SetRxIndividualMask(INST_CANCOM1, FLEXCAN_MSG_ID_STD, id_counter, 0xC0000000|0x7FF);

BR, Petr

View solution in original post

4 Replies
660 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you should configure all ID elements in ID filter table and set mask properly. So for default 8 elements below code can be used

/* ID Filter table */
flexcan_id_table_t filterTable[8]={};
uint16_t id_counter;

for(id_counter=0;id_counter<8;id_counter++)
{
    filterTable[id_counter].isRemoteFrame = false;
    filterTable[id_counter].isExtendedFrame = false;
    filterTable[id_counter].id = 0x111 ;
}
/* Configure RX FIFO ID filter table elements based on filter table defined above*/
FLEXCAN_DRV_ConfigRxFifo(INST_CANCOM1, FLEXCAN_RX_FIFO_ID_FORMAT_A, filterTable);
/* set individual masking type */
FLEXCAN_DRV_SetRxMaskType(INST_CANCOM1, FLEXCAN_RX_MASK_INDIVIDUAL);
for(id_counter=0;id_counter<8;id_counter++)
FLEXCAN_DRV_SetRxIndividualMask(INST_CANCOM1, FLEXCAN_MSG_ID_STD, id_counter, 0xC0000000|0x7FF);

BR, Petr

View solution in original post

659 Views
kbj
Contributor IV

Dear Petr Stancik

I checked the mask function.

Thanks for your help.

Best regards,

Byungju.

0 Kudos
659 Views
revibattstu_b
Contributor I

Pins indicates the modem or data set is ready to accept transmit data from the device Upsers.

0 Kudos
659 Views
kbj
Contributor IV

Dear Warford Jonas,

I am sorry but I don't understand it.

I want to know to set mask to receive only CAN ID 0x111.

FLEXCAN_DRV_SetRxFifoGlobalMask(INST_CANCOM2, FLEXCAN_MSG_ID_STD, (((uint32)(0x7FF)<<18u) & 0x1FFC0000u));

FLEXCAN_DRV_SetRxIndividualMask(INST_CANCOM2, FLEXCAN_MSG_ID_STD, 0, (((uint32)(0x111)<<18u) & 0x1FFC0000u));

Best regards

Byungju.

0 Kudos