problems in Shell

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

problems in Shell

跳至解决方案
2,831 次查看
eGuy
Contributor IV

Hi,

 

I am running a simple which uses Shell and another task which uses printf to print out some debug info.

 

Occasionlly, I got this on the Hyperterminal:

Terminating shell.

Shell exited, restarting.....

 

 

Does anyone know the cause of the shell restarting or point me the direction to look at it?

 

Thanks

 

Jeff

0 项奖励
回复
1 解答
1,484 次查看
eGuy
Contributor IV

PetrM,

 

Thanks for your reply.

I found the cause of my problem:

I use direct interrupt in my code. I use Event to signal other task that an interrupt has occured. This causes a lot of problems--- sometime Shell restarts, sometime unexpected exceptions........

So I changes the code to use a global variable to signal the interrupt event. below is the code snip.

 

In the MQXUG, on page154 it reads:

"It must not call any MQX functions" when user uses replacement ISR. 

 

So without using MQX Event, what is the best method to communcate between ISR and other task?

 

Regards,

 

Jeff

 

---------------------------------------------------------------------------------------------------------

__declspec(interrupt:0) void new_irq7_isr   (      pointer user_isr_ptr   )
{
   VMCF5225_STRUCT_PTR reg_ptr = (VMCF5225_STRUCT_PTR)BSP_IPSBAR;

      //switch caused IRQ
      reg_ptr->EPORT->EPFR |= MCF522XX_EPORT_EPFR_EPF7;    //DES Clear IRQ7 interrupt flag

    intcnt++;
    if ( intcnt > MAX_INT_CNT )
        intcnt =0;

 

//    _lwevent_set(&ISR7_Event,ISR7_EVENT);
}
---------------------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,484 次查看
PetrM
Senior Contributor I

I had this problem when there was not enough memory left.

There can be also problem with stack size of the shell task.

 

PetrM

 

1,485 次查看
eGuy
Contributor IV

PetrM,

 

Thanks for your reply.

I found the cause of my problem:

I use direct interrupt in my code. I use Event to signal other task that an interrupt has occured. This causes a lot of problems--- sometime Shell restarts, sometime unexpected exceptions........

So I changes the code to use a global variable to signal the interrupt event. below is the code snip.

 

In the MQXUG, on page154 it reads:

"It must not call any MQX functions" when user uses replacement ISR. 

 

So without using MQX Event, what is the best method to communcate between ISR and other task?

 

Regards,

 

Jeff

 

---------------------------------------------------------------------------------------------------------

__declspec(interrupt:0) void new_irq7_isr   (      pointer user_isr_ptr   )
{
   VMCF5225_STRUCT_PTR reg_ptr = (VMCF5225_STRUCT_PTR)BSP_IPSBAR;

      //switch caused IRQ
      reg_ptr->EPORT->EPFR |= MCF522XX_EPORT_EPFR_EPF7;    //DES Clear IRQ7 interrupt flag

    intcnt++;
    if ( intcnt > MAX_INT_CNT )
        intcnt =0;

 

//    _lwevent_set(&ISR7_Event,ISR7_EVENT);
}
---------------------------------------------------------------------------------------------------------------------------------

0 项奖励
回复
1,484 次查看
JuroV
NXP Employee
NXP Employee

Hello,

 

there is no trivial way to communicate between ISR and task without synchronization in more complicated data-access schematics.

You can for example set a flag in global variable.

If there is only one task waiting for that flag, the task can scan periodically for the "data ready" flag.

If there are more tasks waiting for data, on ColdFire you have to use TAS instruction.

 

Note that in any case, your waiting-for-signal-tasks cannot be blocked by operating system.

0 项奖励
回复