Hi Rahul,
Did, you try to connect BDM interface and attach/hotsync to MCU?

After that, you should be able to detect where XGATE hangs. Please check XGMCTL register. If XGDBG bit is set, XGATE is in debug mode and the only way how to leave debug mode is clearing this bit (write to XGMCTL register with XGDBG=0 and XGDBGM=1).
Could you please share here your code for XGATE setting - XGATE Control Register (XGMCTL). For example:
/* enable XGATE mode and interrupts */
XGMCTL= 0xFBC1; /* XGE | XGFRZ | XGIE */
Could you please share here your CAN routines?
Is there any potential endless loop inside these routines – for example waiting for empty TX buffer?
Just for sure, what MCU family you use (S12XE, S12XD) and what CW version you use?

I hope it helps you.
Have a great day,
RadekS
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------