S32K144 FlexCAN

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

S32K144 FlexCAN

8,180 次查看
Alex19
Contributor II

Hello NXP,

I need your help, please. My problem is receiving several CAN messages PERIODICALLY without filtering.  It means, for example, i have 10 CAN messages with different period 50ms, 100ms, 500ms. If I take, for example, CAN ID = 0x101 and I receive with filtering, i receive periodically, but if I receive without filtering, this CAN message is received non periodically.  

0 项奖励
回复
15 回复数

8,170 次查看
Senlent
NXP TechSupport
NXP TechSupport

Hi@Alex19

This can indeed happen if you don't set the mask for each MBs, which is not the correct way to set it.

In order to meet your design requirements, you can refer to this demo

https://community.nxp.com/t5/S32K-Knowledge-Base/S32K1xx-FlexCAN-Mask-Setting-Demo/ta-p/1519753 

Chapter:4.2.Set the Mask Type to Individual Mask Type.

0 项奖励
回复

8,171 次查看
Senlent
NXP TechSupport
NXP TechSupport

Hi@Alex19

This can indeed happen if you don't set the mask for each MBs, which is not the correct way to set it.

In order to meet your design requirements, you can refer to this demo

https://community.nxp.com/t5/S32K-Knowledge-Base/S32K1xx-FlexCAN-Mask-Setting-Demo/ta-p/1519753 

Chapter:4.2.Set the Mask Type to Individual Mask Type.

0 项奖励
回复

8,165 次查看
Alex19
Contributor II

Thank you for your response, 

I don't understand about 

4.1.Set the Mask Type to Global Mask Type.

     In this case, we can only receive the messages which ID from 0x300~0x37F and 0x400~0x47F.

but what if i want to receive for example 0x001~0x399 0x480~0x7FF. The idea is to identify the IDs and periods of the receiving CAN messages in a range  0x001~0x7FF. 

0 项奖励
回复

8,160 次查看
Senlent
NXP TechSupport
NXP TechSupport

If you want to receive all IDs, you can set the mask to all 0

0 项奖励
回复

8,158 次查看
Alex19
Contributor II

like this?

 

FLEXCAN_DRV_Init(INST_CANCOM1, &canCom1_State, &canCom1_InitConfig0);

FLEXCAN_DRV_SetRxMaskType(INST_CANCOM1, FLEXCAN_RX_MASK_GLOBAL); 
FLEXCAN_DRV_SetRxMbGlobalMask(INST_CANCOM1, FLEXCAN_MSG_ID_STD, 0);

flexcan_data_info_t dataInfo =
{
.data_length = 8U,
.msg_id_type = FLEXCAN_MSG_ID_STD,
.enable_brs = false,
.fd_enable = false,
.fd_padding = 0U,
.is_remote = false
};

FLEXCAN_DRV_ConfigRxMb(INST_CANCOM1,RX_MAILBOX, &dataInfo, 0x7FF);

 

0 项奖励
回复

8,137 次查看
Senlent
NXP TechSupport
NXP TechSupport

Yes, all ID messages can be received in this way, but frame loss will occur if the speed is too fast, and this is not the correct way to use it. The recommended approach is to set one MB for each ID and set the mask value to all 1s.

0 项奖励
回复

8,130 次查看
Alex19
Contributor II

The idea is receive several CAN messages, and identify IDs of messages. If i want receive 40 messages, but there are just 32 MB, so I can't set one MB for each ID, with my understanding. 

0 项奖励
回复

8,096 次查看
Alex19
Contributor II

hello @Senlent ,

 

Can you clarify, please, about your last message

The recommended approach is to set one MB for each ID and set the mask value to all 1s. 

0 项奖励
回复

8,091 次查看
Senlent
NXP TechSupport
NXP TechSupport

for example:

FLEXCAN_DRV_SetRxMaskType(INST_CANCOM1,FLEXCAN_RX_MASK_INDIVIDUAL);

FLEXCAN_DRV_ConfigRxMb(INST_CANCOM1, mb_idx_1, &dataInfo, msg_id_1);
FLEXCAN_DRV_SetRxIndividualMask(INST_CANCOM1,FLEXCAN_MSG_ID_STD,mb_idx_1,0xFFFFFFFF);

FLEXCAN_DRV_ConfigRxMb(INST_CANCOM1, mb_idx_1, &dataInfo, msg_id_2);
FLEXCAN_DRV_SetRxIndividualMask(INST_CANCOM1,FLEXCAN_MSG_ID_STD,mb_idx_2,0xFFFFFFFF);
...............
0 项奖励
回复

8,085 次查看
Alex19
Contributor II

Hello @Senlent 

Thank you very much for your answer.

FLEXCAN_DRV_SetRxMaskType(INST_CANCOM1,FLEXCAN_RX_MASK_INDIVIDUAL);

FLEXCAN_DRV_ConfigRxMb(INST_CANCOM1, mb_idx_1, &dataInfo, msg_id_1);
FLEXCAN_DRV_SetRxIndividualMask(INST_CANCOM1,FLEXCAN_MSG_ID_STD,mb_idx_1,0xFFFFFFFF);

FLEXCAN_DRV_ConfigRxMb(INST_CANCOM1, mb_idx_1, &dataInfo, msg_id_2);
FLEXCAN_DRV_SetRxIndividualMask(INST_CANCOM1,FLEXCAN_MSG_ID_STD,mb_idx_2,0xFFFFFFFF);

this configuration is for receiving CAN messages with filtering, but I need receiving without filtering. 

标记 (1)
0 项奖励
回复

8,079 次查看
Senlent
NXP TechSupport
NXP TechSupport

We've discussed filtering and not filtering, I don't know that your problem is not solved yet.
You can send me your demo, I will reproduce this problem first, and I will think about whether there is any way to improve it.

0 项奖励
回复

8,072 次查看
Alex19
Contributor II

@Senlent 

I attached the poject 

 

0 项奖励
回复

8,057 次查看
Senlent
NXP TechSupport
NXP TechSupport

I read your code, there are many problems, I can not help you to modify directly. I suggest you refer to the routine of interrupt sending and receiving, you can set the mask to all 0 (if you don't want to set the mask)

0 项奖励
回复

8,047 次查看
Alex19
Contributor II

Hello @Senlent ,

 

What do you mean use interrupt sending and receiving, it's use RxFIFO? 

0 项奖励
回复

8,039 次查看
Senlent
NXP TechSupport
NXP TechSupport

You can use MB or FIFO to interrupt receiving and sending, I suggest you read the demo in my previous answer

0 项奖励
回复