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?
已解决! 转到解答。
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....
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.
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
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....