FLEXCAN RX FIFO mask filter

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

FLEXCAN RX FIFO mask filter

Jump to solution
1,302 Views
emb02
Contributor IV

Hi,

I'm working on S32K144 CAN peripheral in which I'm using RX FIFO filter to receive data from multiple ID's. 

In which masking is used to achieve ID range.

-> 0x404 is masked with 0x7FC thus lower 2 bits are don't care, so messages with ID 0x404-0x407 are received

-> 0x420 is masked with 0x7F0 thus lower 4 bits are don't care, so messages with ID 0x420-0x42F are received

Now If I want to receive multiple can ID's
Ex. 0x11111110, 0x12222210, 0x13333310 and so on.
In this ID lower 8 bits are same and other bits are don't care.
so how to achieve this using masking?
 
0 Kudos
1 Solution
1,045 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@emb02

I checked and reproduced your problem, what i want to say is that this is not a software problem but that you overestimated the communication rate.

you can see that the bus load rate is close to 100%

Senlent_0-1695695493892.png

Senlent_1-1695695513390.png

 

View solution in original post

Tags (1)
0 Kudos
8 Replies
607 Views
P007
Contributor II

Am also trying to filter two commands ,I followed the above steps ,but no t successful in filtration of two messages.

0 Kudos
1,160 Views
emb02
Contributor IV
Hi,
 
-> I'm using FLEXCAN0 so instance = 0; 
-> I've configured RXFIFO to receive FLEXCAN data. 
 
flexcan_msgbuff_t RxBuff;
FLEXCAN_DRV_RxFifo(instance, &RxBuff); // called in flexcan0_Callback
 
-> To send data I'm using TX_MAILBOX = 15;
 
flexcan_data_info_t BuffCfg;
BuffCfg.data_length = 8;
BuffCfg.enable_brs  = false,
BuffCfg.fd_enable   = false,
BuffCfg.fd_padding  = 0U;
BuffCfg.is_remote = false;
BuffCfg.msg_id_type = FLEXCAN_MSG_ID_EXT;
 
flexcan_msgbuff_t TxBuff;
TxBuff.dataLen = 8;
memset(&TxBuff.data[0], 0x10, 8);
TxBuff.msgId = 0x10000001;
 
// Sending in 10mS using RTOS Task
if(FLEXCAN_DRV_GetTransferStatus(instance, TX_MAILBOX) != STATUS_BUSY)
{
if((FLEXCAN_DRV_ConfigTxMb(instance, TX_MAILBOX, &BuffCfg, 0)) == STATUS_SUCCESS) 
{
FLEXCAN_DRV_Send(CAN0, TX_MAILBOX, &BuffCfg, TxBuff.msgId, TxBuff.data);
}
}
 
-> Here I'm using TX_MAILBOX = 15 for sending data and I'm getting TransferStatus = STATUS_BUSY always. 
And then FLEXCAN is not sending any frame. 
I'm not able to understand this. 
0 Kudos
1,109 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@emb02

here is my test code without using FreeRTOS and it works find on myside

Senlent_0-1695607459175.png

So could you please test this case without using FreeRTOS, if the result is same with mine, then I think this might be an issue with your freertos.

0 Kudos
1,087 Views
emb02
Contributor IV

Hi @Senlent ,

I'm attaching my project which uses Free RTOS. 

I'm sending 10 frames with 10 different ID's in 10mS (from Flexcan0 to CAN tool) and simultaneously receiving other frames using flexcan callback. (i.e. Sending frames from CAN tool to S32K144 Flexcan0 in 10mS)

If I'm Sending 16 or 17 frames from CAN tool in 10mS then this code works fine, Flexcan0 is able to send 10 frames to CAN tool.

But if I'm Sending more than 16 or 17 frames from CAN tool in 10mS then flexcan0 stops sending frames to CAN tool. I'm getting MB transfer state = STATUS_BUSY.

If Flexcan0 is receiving more than 16 frames then it is not able to send any frames till I reduce no of frames sending from CAN tool.

Is different TX MB required to send standard and extended frames?

Can we use same MB to transmit large no of frames?

Help me with this.

 

Tags (1)
0 Kudos
1,046 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@emb02

I checked and reproduced your problem, what i want to say is that this is not a software problem but that you overestimated the communication rate.

you can see that the bus load rate is close to 100%

Senlent_0-1695695493892.png

Senlent_1-1695695513390.png

 

Tags (1)
0 Kudos
1,234 Views
emb02
Contributor IV

Hi,

Thanks for the response. I'm able to receive expected ID's.

I've one more query about CAN transmission.

I'm using Flexcan0 with below settings.

Flexcan0.png

I'm receiving data in RX FIFO (8 MB's are occupied) and I'm using TX MB's 9 to 16 to send data. But after receiving multiple frames (16 no. frames) continuously, TX MB is not able to send data. I'm getting MB Transfer status = STATUS_BUSY.

If there are 15 no. frames to be received then I'm getting Transfer status = STATUS_SUCCESS and able to send data.

There can be N no of frames to be received but I'm not able to send data after receiving 16 frames.

Please help me with this.

0 Kudos
1,195 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@emb02

I see no problem with this setting, and I made a sample test 

Senlent_0-1695349070002.png

Sending more than 16 frames at the same time, no problems were found.

please provide more info about your issue, demo code, test process.

0 Kudos
1,246 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@emb02

please refer to this post.

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

 

for example:

Senlent_0-1695276775480.png

format A, individual mask ,extended frame,mask value set to 0xFFFFFF00

Senlent_1-1695276812038.png

 

0 Kudos