AnsweredAssumed Answered

MC9S12DP512 CAN1 Pin access

Question asked by Joern Katzorke on Nov 17, 2010
Latest reply on Nov 18, 2010 by Daniel Lundin



i figured out a strange behaviour of my program.

when i am within the debugger or just flashed my controller, everything works.

if i hit reset or power it up again and run it without the debugger it behaves not as within the debugger.


i managed to identify the problem:


my program initializes all components at the beginning, also the can1 is initialized and enabled (through bean) and i can send around messages etc.


now i wrote a function to manually toggle the can txd pin to generate a wake pattern as i want it to look like.



void FTCAN_generate_wake(void){  CAN1CTL0_INITRQ = 1;          // Get into configuration mode  CAN1CTL1_INITAK = 1;          // to be able to disable CAN1.  CAN1CTL1_CANE = 0;            // Disable CAN1 to take manual control of pin TXD                                                                               DDRM_DDRM3 = 1;               // Set pin TXD as output    PTM_PTM3 = 1;                 // Start of wake pattern generation  FUNCTIONS_delay(100);  PTM_PTM3 = 0;  FUNCTIONS_delay(100);  PTM_PTM3 = 1;  FUNCTIONS_delay(100);  PTM_PTM3 = 0;  FUNCTIONS_delay(100);    CAN1CTL1_CANE = 1;            // Reenable CAN1 and    CAN1CTL1_INITAK = 0;          // close configuration mode.  CAN1CTL0_INITRQ = 0;  FUNCTIONS_delay(10);  CAN1RIER = 127;               // Reenable the CAN1 interrupts. Can only be set when not in configuration mode.}



when i am in the debugger these waveforms appear on the scope.

when i hit reset and run it without the debugger it happens nothing.


reading the mscan2 manual i found a sentence telling me:

"Write: Anytime when INITRQ = 1 and INITAK = 1, except CANE which is write once in normal and
anytime in special system operation modes when the MSCAN is in initialization mode (INITRQ = 1 and
INITAK = 1)."


does this mean that i am not able to enable and disable CANE in normal mode after initialization?

then it would be strange if the debugger let my program do this


how can i gain access to txd on can1 in another way without setting my controller to a special operation mode?