How to enable/disable CAN interrupts temporarily

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
embdev
Level 2
Level 2
First solution authored 25 sign-ins 10 replies posted

Hello,

I use AURIX TC3XX. How can I enable/disable only CAN interrupts temporarily during CAN ISR processing?

0 Likes
1 Solution
Anupama_A
Moderator
Moderator
Moderator
50 solutions authored 10 likes received 250 sign-ins

Hi @embdev ,

 

You could initially set the SRE bit to 0 and at the end of ISR, you can set it back to 1. Please let me know if it helps with your use case.

View solution in original post

0 Likes
4 Replies
Nambi
Moderator
Moderator
Moderator
50 likes received 5 likes given 100 solutions authored

Hi,

Are you using MCAL or ILLD based driver?

Best Regards.

0 Likes
Anupama_A
Moderator
Moderator
Moderator
50 solutions authored 10 likes received 250 sign-ins

Hi @embdev ,

 

You could initially set the SRE bit to 0 and at the end of ISR, you can set it back to 1. Please let me know if it helps with your use case.

0 Likes
embdev
Level 2
Level 2
First solution authored 25 sign-ins 10 replies posted

 

@Nambi 

iLLD

@Anupama_A 

Do you mean the below code? But I have many interrupts enabled(RX, TX, error etc). So how can I disable/enable all? I don't want to use global interrupt mask.

ISR

{
srcPointer = IfxCan_getSrcPointer(config->can, config->interruptConfig.tefifo.interruptLine);
IfxSrc_disable(srcPointer);

 

IfxSrc_enable(srcPointer);

}

 

0 Likes
Nambi
Moderator
Moderator
Moderator
50 likes received 5 likes given 100 solutions authored

Hi,

SRE bit is part of the SRCx register of the CAN node. Setting "SRE" bit to 0 will disable all interrupts associated with that SRCx source register. IfxSrc_disable() sets "SRE" bit to 0. 

You can make use of the SRE bit for the SRCx registers to which the interrupts you want to disable are mapped to.

Best Regards.

0 Likes