How to stop CAN tx interrupt

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

How to stop CAN tx interrupt

5,493 Views
kimjunghyun
Contributor III

Hi.

I have been making source code to generate CAN RX interrupt.

I want to generate CAN RX interrupt only, but CAN TX interrupt works.

How can I stop CAN TX interrupt?

- MCU : S32K144(64pin)

- CAN TX MB : 0

<S32K144.h>

I changed IMASK1 as below to stop interrupt of MB0 and MB1.

1.jpg

 * I also changed IMASK1 to 0x00000000 to see if CAN interrupt is stopped by clearing IMASK1 bit. But CAN TX interrupt works

4.jpg

<Main.c>

1. above main()

 - I used 'callback()'

3.jpg

2. inside main()

2.jpg

 * I also used 'INT_SYS_EnableIRQ()' but CAN TX interrupt works.

5.jpg

* I refered below link but it did not work for my project.

https://community.nxp.com/message/917643?q=CAN interru

Thank you.

1 Reply

1,213 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

You should not disable MB interrupt by modifying macros in the header file.

Either write value directly into respective register, use macro properly or reuse the drive function that set the Interrupt Mask register.

 

Anyway, if driver is used, and you prepare TX MB, then within FLEXCAN_DRV_SEND the interrupt for the given MB is enabled. Once the message is successfully transmitted the interrupt is called. And if callback is defined it is called too within an interrupt function; FLEXCAN_IRQHandler().

The driver is written in this way.

 

You can use Callback function to distinguish between TX, RX, etc interrupts

 

void can_Callback(uint8_t instance, flexcan_event_type_t eventType, flexcan_state_t *flexcanState)

{

                (void)flexcanState;

                (void)instance;

 

                switch(eventType)

                {

                case FLEXCAN_EVENT_RX_COMPLETE:

                                dataReceived = true;

                                break;

                case FLEXCAN_EVENT_TX_COMPLETE:

                                break;

                default:

                                break;

                }

}

BR, Petr