How do I setup Flexcan fifo on k64?

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

How do I setup Flexcan fifo on k64?

1,177 Views
ahmedsobhy
Contributor I

I have the Flexcan module on the K64 setup to receive data from the CAN bus using Message Buffers. I setup each Message buffer with a specific ID to listen to and receive the info from the bus.

Everytime a message is received the module causes an Interrupt. I then read the data from the message buffer and so on. I would like to know if there is a better implementation using FIFO buffers for example, that would not cause any messages to be dropped and at the same time reduce the workload on the MCU.

Thank you,

Ahmed.

0 Kudos
Reply
2 Replies

945 Views
ahmedsobhy
Contributor I

Thank you Fang. I am using one of the example projects actually as a template. What I am interested in is the receiving not transmitting. I have made some modification to my code since that time is that I setup several MBs on the flexcan module to the IDs I want to recieve on the bus, then since I know that the message are gonna be sent as a burst and in order I interrupt only once when the last message is received and this is how I reduce the number of times the MCU has to context switch to run the interrupt and store then data.

0 Kudos
Reply

945 Views
miduo
NXP Employee
NXP Employee

Hi,

Please make reference from the FlexCAN project that was released for the Kinetis K6X. You can find the project in the KINETIS_SC.zip file on NXP website. There is a "can_loopback_node" project included that has example CAN driver code. Thre is an ISR that can handle transmit included. The FlexCAN_Poll_TxMBs() function in the can.c file is probably of the most interest to you. The function references polling, but it is called by the MB isr function.


					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
0 Kudos
Reply