I'm trying to get to know the MSCAN module, so I've done a simple test program. It's based on the MSCAN Driver and some Application Notes from Freescale (AN2283)... It's done for the DEMOJM board so if you have one, you can try it.
The problem I'm having is that the CAN Rx ISR is executed 2 times... in both it receives the same data... the question is... Am I transmitting 2 times or it just receiving 2 times?...
As you can see, I clear the CANRFLG twice.. Why? because if I put a break in the first clear instruction and step it, you could see that the falg remains set, but after the second clear it clears. But if I disable that breakpoint and just let it run, the ISR is executed twice... This makes me think that I transmitt twice...
There is a variable named "pepe" wich is initialized as 0, and then incremented in every CAN data read...
For a quick start:
- Button PTG0 sends out data (3 bytes 0x17 0x05 0x85) and toggles PTE2 LED
- Button PTG1 sends out data (3 bytes 0x13 0x10 0x59) and toggles PTE3 LED
I'd appreciate if you could check the MSCAN routines, in MSCAN.c... I guess that's where the problem is
Thank you very much!!!