MQX_OUT_OF_MEMORY Error at _event_open_fast

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

MQX_OUT_OF_MEMORY Error at _event_open_fast

跳至解决方案
1,161 次查看
hard_ware
Contributor III

I'm useing CW 10.1 and MQX 3.7.

 

I Use an fast auto clear event to syncronize between an ISR and a Task that is called every 250ms.

 

Everything is working fine for the first 50 seconds, after that time, every time i call

err = _event_open_fast(1, &i2c_event_ptr);

I get MQX_OUT_OF_MEMORY.

I am not useing any dynamic memory in my task and my task stack is at 6%.

 

Any ideas where to look for the reason of the error?

1 解答
761 次查看
hard_ware
Contributor III

Thank for the help,

I found out in the MQX Memory Pool - Box that my RAM gets filled with a lot of Event connections Objects.

My ISR looked like this:

 

void I2C_Sensor_OnMasterBlockReceived(LDD_TUserData *UserDataPtr)
{
    pointer i2c_isr_event_ptr;
    _event_open_fast(1, &i2c_isr_event_ptr);
    _event_set(i2c_isr_event_ptr, 0x02);
}

 

So every time i get an Interrupt I opened a new event connection.

So i know what the problem is, but the _event_close funktion is not allowed to be called from an ISR.

I tried to make the event handler a public variable and open it only at the init of my task, that worked, but i think there must be a better way than a global variable....

 

 

在原帖中查看解决方案

0 项奖励
回复
3 回复数
761 次查看
timias
Contributor IV

You might not be using memory, but an MQX driver might be trying to allocate some memory.

If your task stack usage is at 6% likely it should be shrunk, since it would seem (based on the limited info I have)that it is way to big. ( My stacks are around 50% utilization)

 

You can also check the MQX->Lightweight Memory Blocks and see what your total RAM usage is, it is listed at the bottom.

 

761 次查看
DavidS
NXP Employee
NXP Employee

Hi Guys,

Open the intflash.lcf and increase the interrupt stack size:

   __DEFAULT_INTERRUPT_STACK_SIZE = 1024;

 

It is located in the FSLMQX\lib\twrk60n512.cw10\bsp folder.

 

Hope this helps.

Regards,

David

0 项奖励
回复
762 次查看
hard_ware
Contributor III

Thank for the help,

I found out in the MQX Memory Pool - Box that my RAM gets filled with a lot of Event connections Objects.

My ISR looked like this:

 

void I2C_Sensor_OnMasterBlockReceived(LDD_TUserData *UserDataPtr)
{
    pointer i2c_isr_event_ptr;
    _event_open_fast(1, &i2c_isr_event_ptr);
    _event_set(i2c_isr_event_ptr, 0x02);
}

 

So every time i get an Interrupt I opened a new event connection.

So i know what the problem is, but the _event_close funktion is not allowed to be called from an ISR.

I tried to make the event handler a public variable and open it only at the init of my task, that worked, but i think there must be a better way than a global variable....

 

 

0 项奖励
回复