CAN_LDD Filter

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
2,345件の閲覧回数
CCandido
Contributor V

Hi,

my teste bus with 10 IDs.

how to set filter to: read 3 ID/10 ID?

ex:

read ID: 0x7E0,0x7E1,0x7E2, others IDs not read.

500khz, interval between frames = 90uS.

how to  ISR use filter for the ID must read.

simple cmp not have timer!

if(  ID == ID[i] )

save

else

not save

my test with  K70.

thanks

Carlos.

ラベル(2)
0 件の賞賛
返信
1 解決策
2,027件の閲覧回数
CCandido
Contributor V

Hi Zhou,

thank you for your help.

Solved Invidual acceptance mask filter.

see:

Can_filter_ok.jpg

calc_id_mask

uint mask   = your_id ;   // 0001-1111-1111-1100-0000-0000-0000-0000

   mask  = mask << 18;

   mask |= 0x3FFFF;  < ---Acceptance mask invidual

//-----------------------------------------

void CAN1_OnFullRxBuffer(LDD_TUserData *UserDataPtr, LDD_CAN_TMBIndex BufferIdx)

{

simple

    switch(  BufferIdx){ read buffer_x }

}

//-----------------------------------

Thanks,

Carlos.

元の投稿で解決策を見る

0 件の賞賛
返信
5 返答(返信)
2,027件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Carlos candido,

    Thank you for your more information.

     I already help you create a K70 KDS CAN_LDD project, you can refer to my project, the CAN_LDD configuration is like following:

71.jpg

Because you want to receive the standard ID:0x7E0,0x7E1,0x7E2

the standard ID is 11bit, it is:

0x7e0: 11111100000

0x7e1: 11111100001

0x7e2: 11111100010

Then, you can use the acceptance mask to care all the higher 9 bit ID, and don't care the lower 2bit.

so you can configure the acceptance mask for buff(register CAN1_RXMGMASK) = 0x1ff3ffff, you can combine the Rx FIFO structure in RM to understand it:

72.jpg

Actually, if you don't care the lower 2 bit of the standard ID, you can receive just 0x7E0,0x7E1,0x7E2, 0x7e3, then all other standard ID won't be received.

I already test my project on my TWR-K70F120M, the test result is like following:

70.jpg

You will find 0x7E0,0x7E1,0x7E2 can be received by the K70, but the 0X123 will be reject.

More details, please refer to my attached project.

Wish it helps you!

If you still have question, please let me know!

Have a great day,

Jingjing

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信
2,027件の閲覧回数
CCandido
Contributor V

Hi Zhou,

thank you for your help.

Mode : 1

Golbal Acceptance Mask, Buffer 0...N = ok

Mode :2

Invidual Accptance Mask = not run all ID

see:

my_function_calc_mask()

{

uint mask   = 0x7C4;

uint xor      = 0x1FFFFFFF;

uint accep = 0x1FFFFFF; // 0001-1111-1111-1100-0000-0000-0000-0000

            mask  = mask << 18;

            mask |= 0x3FFFF;  < ---Acceptance mask ividual

}

CAN_Invidual Mak.jpg

note:

Buffer:0 0x7C1 = ok

Buffer:2 0x7C2 =  not accepted

Buffer:3 0x7C3 = ok

Buffer:4 0x7C4 = not accepted

buffer_zero defined all masks.

thanks,

Carlos.

0 件の賞賛
返信
2,028件の閲覧回数
CCandido
Contributor V

Hi Zhou,

thank you for your help.

Solved Invidual acceptance mask filter.

see:

Can_filter_ok.jpg

calc_id_mask

uint mask   = your_id ;   // 0001-1111-1111-1100-0000-0000-0000-0000

   mask  = mask << 18;

   mask |= 0x3FFFF;  < ---Acceptance mask invidual

//-----------------------------------------

void CAN1_OnFullRxBuffer(LDD_TUserData *UserDataPtr, LDD_CAN_TMBIndex BufferIdx)

{

simple

    switch(  BufferIdx){ read buffer_x }

}

//-----------------------------------

Thanks,

Carlos.

0 件の賞賛
返信
2,027件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Carlos candido,

   Please tell me which IDE you are using? and the ID type is standard or extend ID?

Waiting for your reply!

Jingjing

0 件の賞賛
返信
2,027件の閲覧回数
CCandido
Contributor V

Hi Zhou,

I use IDE KDS30.

Type ID Stander.

Twr-K70F.

Thanks

Carlos

0 件の賞賛
返信