6015 views|2 replies

1140

Posts

0

Resources
The OP
 

The use and explanation of TMS320F28335 interrupt priority and interrupt nesting [Copy link]

When using interrupts, it is necessary to deal with nested interrupts. Let's take a look at how 28335 implements nested interrupts.

1,28335 interrupts are disabled by default.

After entering the interrupt, the CPU turns off the global interrupt by default, saves the IER, enters the ISR, restores the IER after execution, and then turns on the global interrupt.

However, interrupt nesting can be enabled through software. That is, in the interrupt service function, the software enables the corresponding interrupt IER and executes EINT, that is, opens a global interrupt, so that interrupt nesting can be realized.

The following Timer0 interrupt can be nested by the Timer1 interrupt to achieve the flashing of the LED light.

interrupt void TINT0_ISR(void) // CPU-Timer 0
{
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; //Writing 1 to clear flag,must be needed
CpuTimer0Regs.TCR.bit.TIF=1; //Writing 1 to this bit clears the flag

IER |= M_INT13;//enable timer1 interrupt
EINT;

while(1);
}

interrupt void INT13_ISR(void) // INT13 or CPU-Timer1
{
CpuTimer1Regs.TCR.bit.TIF=1; //Writing 1 to this bit clears the flag


LED1_TOG;
}

Note: Since the IER is saved when entering the interrupt, it does not matter how the IER changes during this process, it will be restored when exiting the interrupt.

2. Interrupt priority

2.1 The PIE interrupt priority we usually talk about is that when several interrupts send requests at the same time, the CPU responds to the high-priority interrupt first, and after processing the interrupt service function, responds to the low-priority interrupt. This is done on the basis of no interrupt nesting. 2.2, when interrupt nesting is turned on, any enabled interrupt can be responded to by the CPU, that is, a low-priority interrupt can also interrupt a high-priority interrupt. This is the biggest difference from other MCUs.

Therefore, when enabling interrupt nesting, you must consider carefully and only enable the interrupts that need to be nested. Control the relationship between interrupt nesting to avoid mutual nesting problems.

This post is from Microcontroller MCU

Latest reply

Thank you for sharing your experience.  Details Published on 2024-8-7 21:46
 

2618

Posts

0

Resources
2
 

Nice, thanks for sharing.

This post is from Microcontroller MCU
 
 

2

Posts

0

Resources
3
 
Thank you for sharing your experience.
This post is from Microcontroller MCU
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list