MQX 3.8 system blocks after a while when enabled external IRQ3

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

MQX 3.8 system blocks after a while when enabled external IRQ3

1,005 Views
rhelfan
Contributor I

I'm using MPC8309 and MQX 3.8 version. In our board there is one FPGA interrupt connected in IRQ3 pin. The interrupt period is about 25ms.

I initialized four tasks.

          The first task is to install FPGA ISR and enable interrupt.  In FPGA ISR function, there is one counter increasing with one interrupt.

          The second task setup one software watchdog to light on/off the LED on the board.

          The third task is to use one _time_delay(1000) and then print the counter in FPGA to the serial console and  in a while(1).

          The four task is one shell task for debug and can get current counter value.

when these three tasks begin, at first the counter value can be output on the console. but after a while, there no any output on the console.  The LED in the board blinks normally. I can get the counter value changing from shell debug command.  It shows the system and FPGA ISR work, but the third task blocks.  I try several times. Although the times is random, but the third task always blocks at last.

I don't know where the problem is. _time_delay(), interrupt or task schedule? 


Can anyone give me some suggestion? Thanks.

0 Kudos
Reply
2 Replies

795 Views
soledad
NXP Employee
NXP Employee

Hello Ryan,

Could you please share your code in order to check it??

Regards

Soledad

0 Kudos
Reply

795 Views
rhelfan
Contributor I

Hi Soledad,

      Thanks.

        After I changed project code structure and got more debug log about this issue. This issue may be caused by interrupt context switch.

        I checked _int_kernel_isr() function in the file mqx/source/psp/powerpc/dispatch.s.  When external interrupt IRQ3 occurs, the _int_kernel_isr() firstly executed. it will call the installed IRQ3 user interrupt handler. After that, it will check current task ready-Q. If there is one high priority task than interrupted task, _int_kernel_isr() function will call _int_kernel_isr_context_switch().

        From my debug log,  i have one monitor task to display current stack usage periodically. This task has the lowest priority. When interrupt IRQ3 comes, the console display is interrupted. The IRQ3 interrupt handler will release one semaphore. There is another task (named card_loop) waiting for the semaphore. Its priority is higher than monitor task. So return from interrupt handler will switch to card_loop task. After card_loop task process, it will wait the semaphore again. Then next interrupt IRQ3 comes, the card_loop task executed again. But the monitor task did not run again, because there are nothing console display. So I think that task context switch in interrupt may have some bug.

        I'm not sure whether the guess is correct. So could you give some help? Thanks again.

        Attached file is dispatch.s.

Ryan

0 Kudos
Reply