MQX-FlexCAN (PXN20) more Rx mailboxes

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

MQX-FlexCAN (PXN20) more Rx mailboxes

跳至解决方案
1,744 次查看
michal_kelnar
Contributor I

Hi,

 

After testing FlexCAN driver (MQX3.8) I still have problem with CAN mailboxes.

So main idea of my application is use more than one mailboxes for receiving CAN messages with specific IDs range (I have some modules based on HSC12 which sending measured and other data to TWR-PXN20 as data interface module between distributed control system and visualisation).

 

Ex. 0x100 is base address for module A. 0x0c is base address form module B. and so on.

So message IDs 0x100, 0x101,... should be received by one mailbox and 0x0c0, 0x0c1,... by second mailbox.

 

After testing and studying reference manual for PXN20 and FlaxCAN driver I am a little bit confused by driver's function. Because it looks like everything is OK when I am sending only messages with corresponding ID range to mailbox 0 (in this case every messages are correctly received). After second messages IDs range was added to sending for mailbox 0 is still everything OK but mailbox 1 can receive only last from messages.

 

So I think that messages filtering is ok and it should be OK but somewhere is problem and I can not find it.

 

Do you know where is problem? (can source files are attached)

 

Note: for now TWR-SER module in kit is used like DCS simulator.

 

Original Attachment has been moved to: can.c.zip

Original Attachment has been moved to: can.h.zip

标记 (3)
0 项奖励
回复
1 解答
1,268 次查看
Martin_
NXP Employee
NXP Employee

Hi,

On PXN20, each FlexCAN Message Buffer 0-15 has it's own interrupt vector. Thus, I think you should call FLEXCAN_Install_isr for the mailboxes 0-3.

Also inside the isr FLEXCAN_ISR_MB(), replace the line:

can_reg_ptr->IFLAG |= tmp_reg; /* read modify write */

with

can_reg_ptr->IFLAG = tmp_reg; /* write */

在原帖中查看解决方案

0 项奖励
回复
1 回复
1,269 次查看
Martin_
NXP Employee
NXP Employee

Hi,

On PXN20, each FlexCAN Message Buffer 0-15 has it's own interrupt vector. Thus, I think you should call FLEXCAN_Install_isr for the mailboxes 0-3.

Also inside the isr FLEXCAN_ISR_MB(), replace the line:

can_reg_ptr->IFLAG |= tmp_reg; /* read modify write */

with

can_reg_ptr->IFLAG = tmp_reg; /* write */

0 项奖励
回复