S32K148 FLEXCAN FITLER CAN_ID

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K148 FLEXCAN FITLER CAN_ID

996 Views
gravity_one
Contributor III

HI,Dear

use S32K148 FLEXCAN

I need add ID;

code:

FLEXCAN_DRV_Init(INST_CANCOM1, &canCom1_State, &canCom1_InitConfig0);
flexcan_data_info_t dataInfo =
{
.data_length = 8U,
.msg_id_type = FLEXCAN_MSG_ID_STD,
.enable_brs = true,
.fd_enable = false,
.fd_padding = 0U
};
/* Configure RX message buffer with index RX_MSG_ID and RX_MAILBOX */
FLEXCAN_DRV_ConfigRxMb(INST_CANCOM1, RX_MAILBOX, &dataInfo, 0x1);


Only receive ID 0X1,how to add more ID?

help me,please

thanks

BRS

Grayli

0 Kudos
Reply
1 Reply

870 Views
alexandrunan
NXP Employee
NXP Employee

You can use multiple Message Buffers every one with it's one ID. Or use a combination of individual message buffer and filter mask applied on every MB. You can use max of Rx Message buffers with max_num_mb configured by FLEXCAN_DRV_Init.

Example Id 0x10 and filter 0xFFFFFFF0 will accept all ids from 0x10 to 0x1F, masking with 0 will not take in consideration when will be made the ID match for acceptance. The correspondence between mask and MB id is one to one, for more details check the RM(Reference Manual).

But to use this method you need to change on individual masking by calling:

FLEXCAN_DRV_SetRxMaskType(INST_CANCOM1, FLEXCAN_RX_MASK_INDIVIDUAL);

Or more simple if you don't need CAN_FD you can use RxFIFO, and you can set multiple filters.

BR,

Alexandru Nan

0 Kudos
Reply