I found the problem. I hope this helps to all other people experiencing it.
- First the MCF52259 microcontroller device --possible others, too-- has some undeterministic behavior when the ICR registers are set to the same values. "MCF52259 ColdFire® Integrated Microcontroller Reference Manual, Rev. 4", page 16-10 states: "It is the responsibility of the software to program the ICRnx registers with unique and non-overlapping level and priority definitions. Failure to program the ICRnx registers in this manner can result in undefined behavior."
I find this as a major drawback on the device design. A microcontroller should be a deterministic machine. There should be a mechanism that solves concurrent interrupts of the same configured priority.
- Second, MQX does exactly what the manual says not to do. In function FLEXCAN_Int_enable, called as follows:
FLEXCAN_Initialize_mailbox -> FLEXCAN_Int_enable -> _flexcan_int_init
... the ICRs associated with the CAN mailboxes are set to a predefined interrupt level and sub-level...
Check: _flexcan_int_init (index, FLEXCAN_MESSBUF_INT_LEVEL, FLEXCAN_MESSBUF_INT_SUBLEVEL, TRUE)
This caused a our application - heavily dependant on CAN @500 kbps- to generate continuous resets and therefore to not function at all.
I think that Freescale needs to address this issue in their next MQX release.
My setup:
MCF52259 in a custom developed board, using CAN @ 500 kBit/s
CodeWarrior 10.2
MQX 3.8