MQX RTOS Halt issue

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

MQX RTOS Halt issue

832 Views
ashigupta1990
Contributor I

Hello,

I am using MQX RTOS for my application and have almost 30 task with different time slices. I am facing issue that after some time all task in MQX get halt. I didnt found any thing in code. Can you help me what can be the issue. I have changed the MQX time tick for default 5ms to 1ms in BSP.

0 Kudos
5 Replies

519 Views
ashigupta1990
Contributor I

I have tested my code many times, i am using light weight events, interrupts, CAN, UART, Ethernet, data logging in different task. I have checked stack size allotted to each task and assigned 50% extra of total consumption but still MQX halt issue is there. Then i reverted my BSP change to modify MQX time tick from 1ms to 5ms back, and noticed MQX halt issue at 5ms time tick as well.

In MQX halt condition, all task get halt so i am not able to check any data on any communication line, also i am running code in flash mode. Is there is any way how to find the issue. In debug mode i noticed it goes in dispatch.S and never returns.

0 Kudos

519 Views
soledad
NXP Employee
NXP Employee

Hello Ashi,

In my opinion this issue could be related with the memory, you can use the Task Aware Debugging to review how much memory is using each of the tasks. Go to the MQX menu in CodeWarrior and click in the task summary option when you pause the debugger. There you will find in percentage how much memory are using the task and if some of them got out of memory. From here you could do your calculation and see how much you have free that you could not assign to the task size.

Let me give you what I have seen in my experience: If you think that you will need 1K of stack then I will tell you set to 50% more than what you expect to need then you will have to set 1.5K. Remember that you can calculate that by looking the amount of variables or arrays that you are defining in the task. The minimum that you should give to a task for the TaskControlBlock (TCB) is about 300 bytes. That is why you will give another 50% or 30%.


Have a great day,
Sol

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

519 Views
ashigupta1990
Contributor I

Hi Sol,

I have checked stack usage  for all my task, it was arnd 18% or 20% used so i reduced the stack size allotted and kept 50% more apart from usage. But still i am facing this issue, after some time all task are halting, i am using Ethernet, CAN, USB, UART, ADC and other periferals. I am running code in flash mode and that is why not able to check where the MQX execution is going. In debug mode, it shows the execution in dispatch.S file and is not coming out of that and hence no task is getting execute. I am still finding how to overcome from this problem.

0 Kudos

519 Views
DavidS
NXP Employee
NXP Employee

Hi Ashi,

What MQX version?  What device? What tool chain?

Are you using interrupts?  If yes, please make sure hardware interrupt priorities are 9 or higher and odd valued.

For task priorities, please have then 8 or higher (higher in value which correlates to lower priority) and even numbered.

A good document to refer too:

MQX interrupt demistify

Also Section 3.8 in C:\Freescale\KSDK_1.2.0\doc\rtos\mqx\MQX RTOS for Kinetis SDK User's Guide.pdf .

Regards,

David

0 Kudos

519 Views
ashigupta1990
Contributor I

Hi David,

I am using MQX version 4.0 on a cold fire processor. Yes I am using interrupts and have given different priorities to all task. I will read the document u have mentioned and try to find the problem.

Regards,

Ashi

0 Kudos