HCS12 nested interrupts

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

HCS12 nested interrupts

Jump to solution
1,817 Views
michaelsarafidi
Contributor II

hi there,

 

we are using mc9s12dg256 uC for our project. We have implement ISR for Port P Interrupt, CAN0, SPI1, SP2, Modulus Down Counter underflow, Port J, SCI1,SC2, TimerHandler, TC7_int, TC3_int, Real timer and XIRQ that work fine without nested interrupts.

 

What we need to do is to allow nested interrupts only at Modulus Down Counter. Thus, we added a CLI command to its ISR, but the device now is not responding. The stack seems to be empty.

 

Is it possible a nested interrupt function with this uC?

If yes, are any other settings that has to be made?

Does priority has to do anything with this?

 

Thanks in advance.


Labels (1)
Tags (2)
1 Solution
838 Views
RadekS
NXP Employee
NXP Employee

Yes, you can nested interrupt function with uC.

Yes, command asm CLI; will clear I bit and this way interrupt routine could be interrupted by another interrupt.

Prior you clear I bit, you must clear flag of current interrupt routine (Modulus Down Counter), otherwise your program will hang in entrance into interrupt routine (Modulus Down Counter). I suppose that this could be root cause of your issue.

In case S12D, interrupt priority has no influence. When you clear I bit, program can jump to any interrupt routine.

If you want drive interrupts according priority or if you want gets more information about interrupts nesting on S12 MCU, I would like recommend our application note AN2617 A Software Piority Interrupt Scheme on HCS12 Microcontrollers:

http://www.freescale.com/files/microcontrollers/doc/app_note/AN2617.pdf

software:

http://www.freescale.com/webapp/sps/download/license.jsp?colCode=AN2617SW


View solution in original post

4 Replies
839 Views
RadekS
NXP Employee
NXP Employee

Yes, you can nested interrupt function with uC.

Yes, command asm CLI; will clear I bit and this way interrupt routine could be interrupted by another interrupt.

Prior you clear I bit, you must clear flag of current interrupt routine (Modulus Down Counter), otherwise your program will hang in entrance into interrupt routine (Modulus Down Counter). I suppose that this could be root cause of your issue.

In case S12D, interrupt priority has no influence. When you clear I bit, program can jump to any interrupt routine.

If you want drive interrupts according priority or if you want gets more information about interrupts nesting on S12 MCU, I would like recommend our application note AN2617 A Software Piority Interrupt Scheme on HCS12 Microcontrollers:

http://www.freescale.com/files/microcontrollers/doc/app_note/AN2617.pdf

software:

http://www.freescale.com/webapp/sps/download/license.jsp?colCode=AN2617SW


838 Views
kef
Specialist I

Radek Sestak wrote:

Prior you clear I bit, you must clear flag of current interrupt routine (Modulus Down Counter), otherwise your program will hang in entrance into interrupt routine (Modulus Down Counter). I suppose that this could be root cause of your issue.

I recommend to clear interrupt mask (modulus down counter interrupt mask in our case), not interrupt flag. Flag may get set again quickly and will make MDC interrupt triggered, and could make stack growing again. Disabling interrupt will prevent it.

838 Views
michaelsarafidi
Contributor II

thanks Radek

0 Kudos
838 Views
michaelsarafidi
Contributor II

I have increased the stack size in case there is a stack overflow but still nothing...

0 Kudos