Ken Armitage

Error Code: Out of Memory (0x0004), State Blocked

Discussion created by Ken Armitage on Jun 27, 2019
Latest reply on Jul 1, 2019 by Daniel Chen

I have an MQX4.1 application running under Codewarrior V10.6 on a K60 processor. It's a custom card and we're using the USB port as a device to connect the equipment to a PC.


The PC isn't connected at the moment and the application runs for varying amounts of time - 5 minutes to hours, but will suddenly stop. Not all the tasks running on the processor have stopped and after some probing we can see the USB task has thrown an error indicating it is out of memory.


TASK_TEMPLATE_STRUCT MQX_template_list[] =
/* Task number, Entry point, Stack, Pri, String, Auto? */
{MAIN_TASK, Main_task, 2000, 9, "main", MQX_AUTO_START_TASK},
{MENU_TASK, Menu_task, 2000, 9, "menu", 0},
{READ_TASK, Read_task, 2000, 9, "read", 0},//Reads from the touch screen
{ USB_MAIN_TASK, USB_Main_Task, 2*3000L, 9, "USBMainTask", 0, 0, 0},
{ SDCARD_TASK, sdcard_task, 2000, 11, "SDcard", MQX_AUTO_START_TASK, 0, 0 },
{READ_TASK2, read_task2, 2000, 9, "readtask2",0, 0, 0},
{0, 0, 0, 0, 0, 0, }


I've checked the size of the stack and usage is about 6% - so should be ok there I think...?


It's not a "heavy application" in total there are 5 or 6 tasks running, but when the system seems to halt - it invariably tracks back to the USB, so I'm thinking we're doing something wrong there.


Has anyone else seen this problem or have any ideas....?