CAN in IMXRT1176

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

CAN in IMXRT1176

Jump to solution
2,652 Views
smartpavan333
Contributor I

Hi,

I am using SDK example given in /drivers/flexCAN. Its running perfectly with ID modifications. 

Present scenario is that a message is getting transferred and received from two specific IDs (one for Tx and one for Rx). 

My requirement is to recieve data from 4 different ID's. Can anyone help with this issue?

1) I have modified RXMGMASK bit to 0x00, I am able to receive data from all ID's.

2) If modified the same bit to 0x1FFFFFFF,I am able to receive data from single specific id data.But I want only specific 4 IDs.

0 Kudos
Reply
1 Solution
2,489 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

1) If I need specific ID's (discontinuous random ID's), what should be the value for RXMGMASK?
I have taken 0x123 and 0x128 to be receiving ID, but here 3 bits are getting changed i.e. 18th,19th and 21st bit are don't care in RXMGMASK. In this scenario, I am receiving all ID's between 0x123 and 0x128.

TS: The RXMGMASK (Global mask register) is suitbale for countinue ID address. For a few ID filter scenario, would be better to use indicidual Rx Masking.

2) I have also tried with MCR[IRMQ]=1, and used RXIMR register (RxIndependentMask()) with 0x123 at MB6 and 0x128 at MB7. Still this is not working. Can you help with getting specific data?

TS: Besides of setting RXIMR6 and RXIMR7 with value 0x1FFFFFFF, you also need to config MB6 as Rx message buffer (with ID 0x123 ) and ready for receive data; the similar config with MB7 as Rx MB(ID = 0x128). 

Wish it helps.

Mike

View solution in original post

0 Kudos
Reply
9 Replies
2,599 Views
smartpavan333
Contributor I

Hi,

I was busy with some other task, So I wasn't able to test yet.

As you have suggested to change RXMGMASK to 0x1FF3FFFF for 4 CAN ID's that are continuous ex- 0x64(100),0x65,0x66,0x67(103), I have my query on-

1) Setting RXMGMASK= 0x1FF3FFFF, Does it work for any 4 continuous CAN ID's?

2) What is the calculation like if there is 3 continuous IDs then setting 0x1FFF3FFF, will it work?

0 Kudos
Reply
2,586 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

1) Setting RXMGMASK= 0x1FF3FFFF, Does it work for any 4 continuous CAN ID's?

TS: It only works for strandard frame (ID standard) with low 2 bits difference.

Such as 0x64(100),0x65,0x66,0x67(103); Or 0x68(104),0x69,0x6A,0x6B(107); and etc.. 

2) What is the calculation like if there is 3 continuous IDs then setting 0x1FFF3FFF, will it work?

TS: No, It need to check which bits are different with those 3 continous IDs.

Thanks for the attention.

Mike

0 Kudos
Reply
2,571 Views
smartpavan333
Contributor I

Hi @Hui_Ma ,

1) I have configured mailboxes with 3 ID's (0x7E0, 0x7E8 & 0x123) with message buffer number (MB8, MB4, MB11) respectively, where 0x7E0 is Tx ID and rest both are Rx ID's. RxMGMASK register (in RxGlobalMask()) is set to 0x1FFFFFFF. Here transmission is working good but while receiving only the last ID masked in RxMbConfig() function is getting taken while logging data from CAN bus  i.e. I am getting data from 0x123 only. 

 

 Can you help in figuring where the issue is or where I am getting wrong? 

 

2) In the above, even if I try to modify RXMGMASK to 0x1FF3FFFF, I am receiving data from 0x123,0x124,0x125,0x126, which are not configured in mailbox. 

 

3) If there are 6 random ID's i.e. not continuous, what will the value of RxMGMASK register value or can you tell in how to calculate the value given in the RxMGMASK register for different number of IDs? 

 

Thanks

0 Kudos
Reply
2,537 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

1> It needs to check the FlexCANx_MCR register [IRMQ] bit, if that bit was set, which means using the individual Rx masking. 

And do you have CAN analyzer tool, that could captuer all CAN frame at bus. Could you check if related CAN frame (ID = 0x7E0) was sent.

The ID 0x7E0 & 0x7E8 is different at bit 21, below code should change to :

/* RxGlobalMask() */
base->RXMGMASK = 0x1FDFFFFF;

2> That's right. The standard ID low 2 bit are unmasked (don't care);

3> You can list those 6 random ID here, then we need to compare the ID each bit difference to find a suitable setting to Global Mask Register.

Mike

0 Kudos
Reply
2,530 Views
smartpavan333
Contributor I

Hi @Hui_Ma ,

Thanks. I understood how to configure the value in RXMGMASK register. 

The value configured in RXMGMASK is the bit difference between those ID's. Its working good. But this thing is not given in the reference manual, so can you look at it or add it. 

 

My query is: 

1) If my receiving ID's are 0x123, 0x147, 0x7E8. The difference between all three ID's and the calculated values in the RXMGMASK is 0x0443FFFF. But I use CAN analyzer, I am receiving all ID's between 0x123 and 0x7E8. I want to getting data from those specific IDs. 

 

2) I have tried with MCR[IRMQ]=1, and I have used RXIMR register (RxIndependentMask()). Still this is not working. Can you help with getting specific data?

 

Thanks 

0 Kudos
Reply
2,512 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

Due to you are using the CAN standard ID, which from bit [18:28], total 11 bits.

So you need to set FLEXCANx_RXMGMASK register bit [18:28] for related filter bit setting.

Please refer below picture for the detailed info:

Hui_Ma_0-1666836322778.png

Mike

 

0 Kudos
Reply
2,507 Views
smartpavan333
Contributor I
Hi,

I understood how to configure the value in RXMGMASK. But the above said register is able to receive continuous ID's like

0x124 & 0x125 --- Here only one bit is getting changed i.e. 18th bit should be '0' in RXMGMASK.

0x60,0x61,0x62,0x63 ---- Here only two bits are getting changed i.e. 18th & 19th bit should be '0' in RXMGMASK.

The above scenario works fine.

But my issue is -
1) If I need specific ID's (discontinuous random ID's), what should be the value for RXMGMASK?
I have taken 0x123 and 0x128 to be receiving ID, but here 3 bits are getting changed i.e. 18th,19th and 21st bit are don't care in RXMGMASK. In this scenario, I am receiving all ID's between 0x123 and 0x128.

2) I have also tried with MCR[IRMQ]=1, and used RXIMR register (RxIndependentMask()) with 0x123 at MB6 and 0x128 at MB7. Still this is not working. Can you help with getting specific data?

Thanks
0 Kudos
Reply
2,490 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

1) If I need specific ID's (discontinuous random ID's), what should be the value for RXMGMASK?
I have taken 0x123 and 0x128 to be receiving ID, but here 3 bits are getting changed i.e. 18th,19th and 21st bit are don't care in RXMGMASK. In this scenario, I am receiving all ID's between 0x123 and 0x128.

TS: The RXMGMASK (Global mask register) is suitbale for countinue ID address. For a few ID filter scenario, would be better to use indicidual Rx Masking.

2) I have also tried with MCR[IRMQ]=1, and used RXIMR register (RxIndependentMask()) with 0x123 at MB6 and 0x128 at MB7. Still this is not working. Can you help with getting specific data?

TS: Besides of setting RXIMR6 and RXIMR7 with value 0x1FFFFFFF, you also need to config MB6 as Rx message buffer (with ID 0x123 ) and ready for receive data; the similar config with MB7 as Rx MB(ID = 0x128). 

Wish it helps.

Mike

0 Kudos
Reply
2,642 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

First of all, sorry for the later reply.

The ID filter based on CAN Frame type, the standard frame with 11bit ID field, the extend Frame with 29bit ID field.

Hui_Ma_0-1664332547591.png

If customer is using Stand frame, the RXMGMASK register should set [28:18] bits for ID filter.

For example, if customer want to receive CAN frame from ID[0x64(100),0x65,0x66,0x67(103)], customer can set RXMGMASK  value to 0x1FF3FFFF.

If those four ID is not continuty, there could exist gap just only allow four ID passed, the other ID all be filtered. The continuty ID could be possible.

Wish it helps.

Mike

0 Kudos
Reply