HCS12 nested interrupts

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

HCS12 nested interrupts

跳至解决方案
1,854 次查看
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.


标签 (1)
标记 (2)
1 解答
875 次查看
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


在原帖中查看解决方案

4 回复数
876 次查看
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


875 次查看
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.

875 次查看
michaelsarafidi
Contributor II

thanks Radek

0 项奖励
875 次查看
michaelsarafidi
Contributor II

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

0 项奖励