CAN option not working on S12ZVMx12EVB

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CAN option not working on S12ZVMx12EVB

676 Views
vasu_nallagorla
Contributor I
We are using S12ZVMx12EVB evaluation board(serial no AX153811742) populated with S912ZVML12.
We are trying to use CAN option and we have made the following changes to work for CAN.
  1. Resistors: removed R44, R43 0 ohm resistors and connected them to R35 and R34.
       2. Jumpers: Closed J3 and Opened J2
We have configured PS0 as input and PS1 as output in the software.
When we are executing code we are observing that SYNCH bit in CAN0CTL0  is always set to zero and CAN communication is not working.
On the evaluation board CAN transeiver used is TJA1042T/3.
We have checked the hardware connectivity till CAN transeiver and it OK.
Please do the needful to resolve this issue.
void CAN_init(void)
{
rx_callback = NULL;
//initialise MSCAN
CAN0CTL0 = 0x01;
while (!(CAN0CTL1_INITAK)){}
CAN0CTL1_CANE = 1;      /* Enable MSCAN module */
CAN0CTL1_CLKSRC = 0;    /* Clock source is OSCCLK = 4 MHz */    
CAN0CTL1_LOOPB = 0;     /* Set to 1 for LoopBack Mode, 0 otherwise */
CAN0CTL1_LISTEN = 0;    /* Not listen only mode */  
CAN0CTL0_WUPE = 1; /* Enable WAKEUP */
//Baud rate = CANCLK/(Pre-scaler * time quanta)                                                                           
CAN0BTR1_TSEG_10 = VALUE_TSEG10;
CAN0BTR1_TSEG_20 = VALUE_TSEG20;
CAN0BTR0_BRP = VALUE_PRESCA;
CAN0BTR0_SJW = 0x03;
CAN0BTR1_SAMP = 0;
//accept all messages
CAN0IDAC_IDAM = 0; /* Two 32 bit filters */
CAN0IDMR0 = 0xFF; /* Accept all incoming ID's */
CAN0IDMR1 = 0xFF;
CAN0IDMR2 = 0xFF;
CAN0IDMR3 = 0xFF;
CAN0IDMR4 = 0xFF;
CAN0IDMR5 = 0xFF;
CAN0IDMR6 = 0xFF;
CAN0IDMR7 = 0xFF;
//exit initialisation mode
CAN0CTL0_INITRQ = 0;
while (CAN0CTL1_INITAK){};
while(!(CAN0CTL0_SYNCH)){};
//clear flags
CAN0RFLG_RXF = 1;                                   
CAN0RIER_RXFIE = 1;
//enable physical layer if available
#ifdef CP0CR
CP0CR_CPE = 1;
CP0CR_SPE = 1;
#endif
//enable RX interrupt
CAN0RIER_RXFIE = 1;
}
0 Kudos
2 Replies

567 Views
atzelcollazo
NXP Employee
NXP Employee

Hello Vasu,

I recommend you to change the MODRR0[SCI1RR] bit to 1. By default, the SCI module is routed to the PS0 and PS1 pins so that may affect the control of the MSCAN module. Also, you shouldn't remove J2, which supplies VDDC domain which is used for the CAN transceiver. In the S12ZVML you do not have the BCTLC pin so using Q1 you are supposed to generate the voltage for the VDDC domain.

Best Regards,

Atzel Collazo

0 Kudos

567 Views
vasu_nallagorla
Contributor I

Hello Atzel,

Thanks for your reply.

We tried as mentioned above but it still it didnt work, but we removed J2 and connect USB cable to the USB to SCI(J25) connector then it worked.

Regards,

N.Vasu

0 Kudos