I wrote:
> We have MCF5235 FlexCAN code at work. I'll check it on Tuesday and see
> how we programmed the levels.
I'm surprised by this. Let's see if I can use the ">> / Insert / Syntax Highlighting / C++:
typedef struct
{
uint8_t controller;
uint8_t source;
uint8_t level;
uint8_t priority;
} INT_INFO;
const INT_INFO int_can_buf[CAN_NUM_BUSES][CAN_NUM_MSG_BUFS] =
{
{
{ 1, 8, 6, 7 }, { 1, 9, 6, 6 }, { 1, 10, 6, 5 }, { 1, 11, 6, 4 },
{ 1, 12, 6, 3 }, { 1, 13, 6, 2 }, { 1, 14, 6, 1 }, { 1, 15, 6, 0 },
{ 1, 16, 5, 7 }, { 1, 17, 5, 6 }, { 1, 18, 5, 5 }, { 1, 19, 5, 4 },
{ 1, 20, 5, 3 }, { 1, 21, 5, 2 }, { 1, 22, 5, 1 }, { 1, 23, 5, 0 }
},
{
{ 0, 43, 6, 7 }, { 0, 44, 6, 6 }, { 0, 45, 6, 5 }, { 0, 46, 6, 4 },
{ 0, 47, 6, 3 }, { 0, 48, 6, 2 }, { 0, 49, 6, 1 }, { 0, 50, 6, 0 },
{ 0, 51, 5, 7 }, { 0, 52, 5, 6 }, { 0, 53, 5, 5 }, { 0, 54, 5, 4 },
{ 0, 55, 5, 3 }, { 0, 56, 5, 2 }, { 0, 57, 5, 1 }, { 0, 58, 5, 0 },
}
};
const INT_INFO int_can_err[CAN_NUM_BUSES] =
{
{ 1, 24, 4, 7 } , { 0, 59, 4, 7 }
};
const INT_INFO int_can_boff[CAN_NUM_BUSES] =
{
{ 1, 25, 4, 6 } , { 0, 60, 4, 6 }
};
So we're using IPL levels 4, 5 and 6. You'll also note we're using the *SAME* IPL/Priority pairs for the same buffers on the two different FlexCAN controllers. How can we get away with that? This paragraph:
13.3 Prioritization Between Interrupt Controllers
The interrupt controllers have a fixed priority, where INTC0 has the highest
priority, and INTC1 has the lowest priority. If both interrupt controllers have
active interrupts at the same level and priority, then the INTC0 interrupt will
be serviced first. If INTC1 has an active interrupt that has a higher level or
priority than the highest INTC0 interrupt, then the INTC1 interrupt will be
serviced first.
Which needs to be read in conjunction with the following, which isn't quite correct:
It is the responsibility of the software to program the ICRnx registers
with unique and non-overlapping level and priority definitions.
What the above should say is "ICRnx registers within each interrupt controller ..." as you can re-use the level/priority pairs BETWEEN the controllers!
So when I read the above and concluded::
Since you have 103 programmable sources, and only 6 maskable levels
(1 to 6) that tells me you can only use 6*8=48 out of the 103 interrupts in a design.
That's wrong. It is "2*6*8=96 out of the 103 interrupts", which is better. But NOT obvious!
Tom