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
Solved! Go to Solution.
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 */
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 */