AnsweredAssumed Answered

MSCAN sync S12X

Question asked by Pascal F-M on Dec 28, 2010
Latest reply on Dec 28, 2010 by Pascal F-M

I tried to use the MSCAN driver from Softec to test my target board.The program works fine on the demo board.



void MSCANInit(unsigned char can_num){  volatile unsigned char *can_pt;  can_pt = can_periph[can_num];    // If MSCAN peripheral is not in Initialization Mode,   // enables the Inizialization Mode Request  if(!(can_pt[CANCTL1]&CANCTL1_INITAK_MASK)){    can_pt[CANCTL0] = CANCTL0_INITRQ_MASK;    while(!(can_pt[CANCTL1]&CANCTL1_INITAK_MASK))      ;  }  // Enables MSCAN peripheral and chooses Oscillator Clock,   // Loop Disabled and Normal Operation  can_pt[CANCTL1] = 0x80;  // Configures SJW = 3Tq and Prescaler = 2  can_pt[CANBTR0] = 0x03;  // Configures One Sample, Time Segment 1 = 6Tq and Time Segment 2 = 3Tq  // TSEG1 = PROP_SEG + PHASE_SEG1 and TSEG2 = PHASE_SEG2   can_pt[CANBTR1] = 0x3a;  // Disables all the Filters  can_pt[CANIDMR_1B+0] = 0xFF;  can_pt[CANIDMR_1B+1] = 0xFF;  can_pt[CANIDMR_1B+2] = 0xFF;  can_pt[CANIDMR_1B+3] = 0xFF;  can_pt[CANIDMR_2B+0] = 0xFF;  can_pt[CANIDMR_2B+1] = 0xFF;  can_pt[CANIDMR_2B+2] = 0xFF;  can_pt[CANIDMR_2B+3] = 0xFF;  // Restarts MSCAN peripheral and waits for Initialization Mode exit  can_pt[CANCTL0] = 0x00;  while(can_pt[CANCTL1]&CANCTL1_INITAK_MASK)    ;  // Waits for MSCAN synchronization with the CAN bus  while(!(can_pt[CANCTL0]&CANCTL0_SYNCH_MASK))    ;    }


But in my target board, the program cannot go through that while loop :

  // Waits for MSCAN synchronization with the CAN bus  while(!(can_pt[CANCTL0]&CANCTL0_SYNCH_MASK))


I'm using TJA1041 on my target board instead of TJA1054 on the demo board.


I've prob the pin and I get 2.35v on both CANH and CANL  which seems normal to me.  I read 121.75 ohm between the two line.


I don't have any clue of what's going on. I tried to connect the board to a CAN bus using CAN King and sending random frame but nothing happen.