Should the Can interrupt need disabled in FLEXCAN_DRV_AbortTransfer?

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

Should the Can interrupt need disabled in FLEXCAN_DRV_AbortTransfer?

Jump to solution
2,567 Views
cheney
Contributor III

Dear support team:

    When we use FLEXCAN_DRV_AbortTransfer to abort the CAN message transmission, our routine is stuck in the while loop.

pastedImage_2.png

   The description of abort process in RM is showed below:

pastedImage_1.png

   It means an interrupt is generated when ABORT code is write to register. 

   Does it means that a interrupt is generated after calling  FLEXCAN_AbortTxMsgBuff? If so, the interrupt routine will be processed, and the IFlag will be cleared in the interrupt, the code will stuck in the while loop.

    Please help me confirm the solution.

SDK version: RTM3.0.0

Best regards!

Cheney

Labels (1)
0 Kudos
Reply
1 Solution
2,411 Views
alexandrunan
NXP Employee
NXP Employee

Hello Cheney,

The driver function "FLEXCAN_DRV_AbortTransfer" is doing FLEXCAN_CompleteTransfer should disable the interrupt before issue the abort operation code. Can you check if is doing ok the disable of the interrupt ? Maybe something else is reactivating it. Can you check if before execution of "FLEXCAN_AbortTxMsgBuff" if the IMASK register corresponding bit for mb_idx selected for abort is cleared ?!   

View solution in original post

0 Kudos
Reply
5 Replies
2,412 Views
alexandrunan
NXP Employee
NXP Employee

Hello Cheney,

The driver function "FLEXCAN_DRV_AbortTransfer" is doing FLEXCAN_CompleteTransfer should disable the interrupt before issue the abort operation code. Can you check if is doing ok the disable of the interrupt ? Maybe something else is reactivating it. Can you check if before execution of "FLEXCAN_AbortTxMsgBuff" if the IMASK register corresponding bit for mb_idx selected for abort is cleared ?!   

0 Kudos
Reply
2,411 Views
cheney
Contributor III

Hi, Alexandru:

Thank you for your reminding, It's exactly the mailbox interrupt is not disabled in FLEXCAN_CompleteTransfer.

Normally the can interrupt is disabled when a CAN message is received. And the new CAN message can not be received anymore unless you recall FLEXCAN_DRV_Receive. 

So we think it is a good idea to remove the FLEXCAN_SetMsgBuffIntCmd(base, mb_idx, false) from FLEXCAN_CompleteTransfer. This operation effect the CAN message cancellation.

Best regards!

Cheney

0 Kudos
Reply
2,411 Views
cheney
Contributor III

alexandrunan‌ Could give me some help. Pls.

Cheney.

0 Kudos
Reply
2,411 Views
alexandrunan
NXP Employee
NXP Employee

Can you specify on which platform ? and What are the code changes ?! Do you execute in multiple thread Mode ? 

0 Kudos
Reply
2,411 Views
cheney
Contributor III

Hi,  alexandrunan :

Thank you for your response.

It is occurred in S32K144, the code is not executed in multiple thread mode.

First, i disconnect the CAN line to CANoe, and i send a CAN message. Then i use the api FLEXCAN_DRV_AbortTransfer to cancel the message i sent. When the function is executed, it will stuck in the line i showed before.

If i disable the global interrupt or CAN interrupt when i call the function "FLEXCAN_DRV_AbortTransfer", it works fine.

So i want to confirm if the interrupt need be disable when the function FLEXCAN_DRV_AbortTransfer is called.

Best regards!

Cheney

0 Kudos
Reply