MOD5213 FlexCAN RX Message Buffers

Discussion to talk about software related topics only.
Post Reply
limaxray
Posts: 2
Joined: Fri Jan 02, 2009 12:22 pm

MOD5213 FlexCAN RX Message Buffers

Post by limaxray »

I'm having some trouble with receiving CAN messages on a 5213. I'm not using the RTOS, so I wrote my own CAN driver using the Netburner code as a starting point. I have a global mask set to mask off the 'message type' field of my CAN protocol, and message buffers configured to receive each possible combination of this message type. This way, the different message types each get placed into its specific MBs and handled by its specific ISRs. This works fairly well, most of the time.

The problem starts when multiple messages of the same type are received in quick succession. The CPU isn't able to service the interrupt in time for the subsequent messages, so the previous message gets overwritten. The seemingly obvious solution is to configure multiple message buffers to receive the same message type, with the thought that the FlexCAN module will skip a full message buffer and shift the new message into the next empty RX buffer with a matching ID. This doesn't happen though - it still places all of the messages into the first matching buffer, even if it's full, and ignores any other RX buffers with the same ID.

Is this how the FlexCAN module is intended to function, or am I doing something wrong? I read through the FlexCAN section of the Freescale manual several times, and it isn't very clear on this point.
User avatar
lgitlitz
Posts: 331
Joined: Wed Apr 23, 2008 11:43 am
Location: San Diego, CA
Contact:

Re: MOD5213 FlexCAN RX Message Buffers

Post by lgitlitz »

How fast is the CAN bus operating at when you start losing packets? Can you try to use the standard NetBurner CAN driver to see if you still loose packets? Just run the CAN2Serial example on your bus. If the default driver works then just build your higher level CAN code on top of the low level driver that is provided.
Post Reply