AnsweredAssumed Answered

Why disable/enable CAN interrupt will make not working abnormally

Question asked by Kim Chan on Aug 20, 2018

Hi,

 

I have a CAN stack project integrated with CanNM.(S12G128 with Trace32 debugger)

And I add CAN DisInterrupt/EnInterrupt in exclusive area like this:

FUNC(void, RTE_CODE) SchM_Enter_CanNm_SCHM_CANNM_EXCLUSIVE_AREA_0 (void)
  
{
 /* disable */
  
CAN_RIER = 0U;
CAN_TIER = 0U;
/* FUNC(void, RTE_CODE) SchM_Enter_Nm_SCHM_NM_EXCLUSIVE_AREA_0 (void) */
  
   
  
FUNC(void, RTE_CODE) SchM_Exit_CanNm_SCHM_CANNM_EXCLUSIVE_AREA_0 (void)
  
{
  /* enable */
   
#if (CAN_RX_MODE == CAN_INTERRUPT_MODE)
/* The CAN interrupts defines have been specified to correspond with */
/* the CANRIER and CANTIER registers */
/* CANRIER : 7 : WAKE-UP */
/* 6 : CAN status change */
/* 5..4 : Rx status change */
/* 3..2 : Tx status change */
/* 1 : Overrun */
/* 0 : RxOK */
/* CANTIER : 7..3 : unused */
/* 2 : TxOK mailbox 2 */
/* 1 : TxOK mailbox 1 */
/* 0 : TxOK mailbox 0 */

CAN_RIER |= CAN_RIER_RXFIE;

/* TxOK interrupts are enabled before each frame transmission. */
/* They must be disabled if any frame transmission is in progress */
/* to prevent from a TxOK interrupt which is not due to a frame transmission */
CAN_TIER = 0U;
#endif

/* Generate CSCIF interrupt in Bus-off state both in interrupt and polling mode */
CAN_RIER |= CAN_RIER_TSTATE_BOF;

#if (CAN_ERROR_STATUS_MODE == CAN_INTERRUPT_MODE)
/* Generate an error interrupt request when CSCIF bit is set */
CAN_RIER |= CAN_RIER_CSCIE;
#endif
/* FUNC(void, RTE_CODE) SchM_Exit_Nm_SCHM_NM_EXCLUSIVE_AREA_0 (void) */

 

But when I run this program, it will not working normally.

It should send period frames but only send several times and stop sending. 

Program is still running, not fleeting.

I referred to S12XHY128 and S12G192, but I didn't find breakpoint.

Does anyone have suggestions about this?

 

Br,

Kim

Outcomes