Interrupts versus Tasks

cancel
Showing results for 
Search instead for 
Did you mean: 

Interrupts versus Tasks

581 Views
OldNick
Contributor IV

Is there a simple explanation of the interrupt model for MQX.

 

I have a problem - the symptoms of which look like MQX only services interrupts when it is running the task in which they were installed.

 

Is that the case?

 

If so - how to make interrupts do what they are supposed to (i.e. interrupt the current process :robotwink:)

0 Kudos
3 Replies

175 Views
MarkP_
Contributor V

Hi OldNick,

What CPU you are using?

In my project with K10 the MQX interrupts work OK: Eight tasks are running in ms timing schedule and Uart, PWM, ADC and Timer interrupts runs nicely.

The problem  is probably not in MQX (Version 3.7).

How have you decided that interrupt is not running?

What interrupt is an problem?

One way to detect interrupt is toggling an output pin in interrupt routine.

Have you used _int_disable() and _int_enable() -calls? Is the _int_:enable() missing somewhere?

One problem source may be too small task stack, causes mysterious behauviour.

Does the debugger halt and report any "Kernel data area corrupted" messages?

~Mark

 

 

0 Kudos

175 Views
kinhc138
Contributor I

Hi Mark P.

 

         I am using MQX 3.7 and MCU is MCF51JF128. I want to have a interrupt in Port E bit 2. I had already written the program for install ISR, it shows as following:

 

MY_ISR_STRUCT_PTR isr_ptr;

isr_ptr = _mem_alloc_zero((_mem_size)sizeof(MY_ISR_STRUCT));

isr_ptr->OLD_ISR_DATA = _int_get_isr_data(BSP_REMOTE_INTERRUPT_VECTOR);
isr_ptr->OLD_ISR = _int_get_isr(BSP_REMOTE_INTERRUPT_VECTOR);

_int_install_isr(BSP_REMOTE_INTERRUPT_VECTOR, REMOTE_ISR, isr_ptr);
Remote_init();

 

And the interrupt vector progam is as following:

void REMOTE_ISR(pointer user_isr_ptr)
{
MY_ISR_STRUCT_PTR isr_ptr;

// RNG_CMD |= RNG_CMD_SR_MASK; //generate SW reset
// PMC_LVDSC1 |= PMC_LVDSC1_LVDACK_MASK; //clear LVDF Low Voltage Detect Flag
isr_ptr = (MY_ISR_STRUCT_PTR)user_isr_ptr;
PCTLE_IC=PCTLE_IC&0b11111011; //clear PTIE flag
PCTLE_IF=0xff; // IF register = FF
remote_count=0;
if (Remote_Data_Receive1()==0)
{
int x;
x=0;
}

/* Chain to the previous notifier */
(*isr_ptr->OLD_ISR)(isr_ptr->OLD_ISR_DATA);

}

 

        This program can have interrupt to routine void REMOTE_ISR(pointer user_isr_ptr) when I strat the falling edge in this port. But this routine is running and then go to halt and then I run in single step the program is enter to _int_kernel_isr() routine. 

        Is any missing for this program?Please help me to solve this problem.

 

~Eric

 


0 Kudos

175 Views
MarkP_
Contributor V

Hi Eric,

What happens if you leave the chaining away by commenting the line:

//(*isr_ptr->OLD_ISR)(isr_ptr->OLD_ISR_DATA);

 

Not sure but I believe that _int_kernel_isr() should not be chain-called,

it is a default int handler for erroneous ints.

Try this:

if (isr_ptr->OLD_ISR != _int_kernel_isr) // Chain int only when not default hadnler

{

  (*isr_ptr->OLD_ISR)(isr_ptr->OLD_ISR_DATA);

}

~Mark