David Krauss

Processor Expert, MSCAN, and transmit buffer priority

Discussion created by David Krauss on Mar 3, 2011
Latest reply on Mar 7, 2011 by David Krauss

I want to send a block of data through a sequence of CAN messages using the Processor Expert driver. I don't want the sequence to defer any other messages that might need transmission in the meantime.


The MSCAN controller has a priority value for each transmission buffer, but the Processor Expert driver does not support prioritization. Instead it sets every message to highest priority. MSCAN does secondary prioritization if all buffers are set to equal priority, with buffer 0 over 1 over 2. So, I use buffer 0 for non-sequence messages and 1 and 2 for double-buffered transmission.


There's just one problem. How do I ensure that buffer 2 is sent before buffer 1 when reloading buffer 1? For example, if buffer 2 contains the next message to send, and I get the tx interrupt because buffer 1 was just transmitted, how do I ensure that SendFrame inside the ISR won't cause the new buffer 1 to race past buffer 2?

If PE only ignored the priority register (TBPR) or set it to a high value, then there would be no problem. It seems the overzealousness is a defect in the driver.