cancel
Showing results for 
Search instead for 
Did you mean: 

TRAVEO™ II

Bill-li
New Contributor II

CAN bus cannot transmit complete interrupt

I try to use all Interrupt for can 

can erro and can RX can be use

 

but can TX all Interrupt invalid。

i need this to clear busoff flag

0 Likes
1 Solution
yanf
Moderator
Moderator

OKay, in this case, there might be some problems with your TX interrupt handler. 

Can you double check your CAN_TxMsgCallback function? Is that successfully implemented in main.c? 

Here is a demo call back function, RxMsgCallback. I put it here for your reference. 

yanf_0-1634541181063.png

Meanwhile, don't forget to update your canCfg configuration struct.  The .txCallback feild is set to NULL by default, but you want to set it to your interrupt handler (namely CAN_TxMsgCallback())

Check if these changes bring it back to work.

Kind Regards,

Finn

 

View solution in original post

5 Replies
yanf
Moderator
Moderator

Hi Bill-li,

So you are having some difficulties to trigger CAN interrupt on complete TX Transmission, right? 

Have you set the interrupt enable bit accordingly? The  "un_CANFD_CH_TXBTIE_t" bit in "stc_CANFD_CH_M_TTCAN" configure struct.

 

 

0 Likes
Bill-li
New Contributor II

Thank you for your response!

I have set the relevant interrupt bit。

unIE.stcField.u1TCE = 1; /* Transmission Completed */

But still can not trigger send interrupt!However, errors and received interrupts can be triggered

0 Likes
yanf
Moderator
Moderator

OKay, in this case, there might be some problems with your TX interrupt handler. 

Can you double check your CAN_TxMsgCallback function? Is that successfully implemented in main.c? 

Here is a demo call back function, RxMsgCallback. I put it here for your reference. 

yanf_0-1634541181063.png

Meanwhile, don't forget to update your canCfg configuration struct.  The .txCallback feild is set to NULL by default, but you want to set it to your interrupt handler (namely CAN_TxMsgCallback())

Check if these changes bring it back to work.

Kind Regards,

Finn

 

View solution in original post

Bill-li
New Contributor II

Thank you! I've already solved the problem。

Now there's a new problem。

I couldn't access the interrupt to receive new messages。

1634639179(1).png

Which registers are set for this?

 

1634639273(1).png

0 Likes
yanf
Moderator
Moderator

Hi Bill-li,

 

Glad to hear your last question is solved.

When you refers to "can't access receive interrupt", do you mean that you can not enter RX interrupt service routine? But in your first post,  you said it works fine, not any longer now?

If you can not enter interrupt routine, you can try to set every bits in unIE.stcField to "1" according to TRM. (Though I think only the bits in your red circles matters in this case, I don't have a can device to test, so...better follows TRM). There are some other steps suggested in TRM,  Chapter 23.6.6.3.

You can follow the whole process in Chapter 23.6.6.3 to see if it works. If works, then you can try disabling some irrelevant bits.  If not works, you might check the TX terminal you are communicating with, whether it is correctly sending CAN messages or not.

Regards,

Finn

 

0 Likes