How to do multithreading using the MQX RTOS on the K70?

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

How to do multithreading using the MQX RTOS on the K70?

2,515 Views
omkardixit
Contributor III

Hi

I have developed an application in which four tasks are running one by one(thanks to the scheduler!).

Now the customer is asking me to write the same application using multiple threads.

So basically, my dought is, how can we implement multithreading using MQX RTOS??. Is there any example available of the multithreading is done using the MQX RTOS??

Any help will be really appreciated!!

Regards,

Omkar DIxit

0 Kudos
6 Replies

2,440 Views
m4l490n
Contributor V

I definitely agree with @myke_predko MQX is not the best option here. We are using it and it is cumbersome and not that straightforward. Also, If you get stuck then good luck because support is not good.

I would also recommend FreeRTOS. It is very easy to use and there are a lot of resources for learning. Additionally, if you are using MCUXpresso, the very examples NXP includes are based on FreeRTOS and you can jumpstart from there.

And if you get stuck with FreeRTOS you can ask anywhere, not only NXP forum and you'll get an answer and help much faster. Whereas with MXQ you are stuck with the little help you can get only here in the NXP forum.

0 Kudos

2,430 Views
danielchen
NXP TechSupport
NXP TechSupport

Currently the recommended RTOS from NXP side is FreeRTOS. MQX RTOS is a third party OS from Embedded Access.  http://embedded-access.com/

 

2,448 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Omkar DIxit:

The default MQX scheduling policy is FIFO, with FIFO scheduling, the tasks runs next is the highest-priority tasks that has been waiting the longest time.

Maybe the multi-threading you mentioned the Roubin robin , with  Round Robin scheduling, tasks of the same priority can share the processor in a time-equitable manner.

you need to set the MQX_TIME_SLICE_TASK attribute in the task's template.

The task's time slice is determined by the value of the template's DEFAULT_TIME_SLICE.

 

Regards

Daniel

0 Kudos

2,508 Views
myke_predko
Senior Contributor III

@omkardixit 

Can I ask why you're looking at MQX?  It is a fine RTOS (that I used in a fairly major product) but there are licensing costs associated with it which may be an okay thing but what I find is that when a company starts doing that, support becomes something you have to pay for as the company wants to consult on application development.  You can get more information here: Embedded Access 

Would you consider FreeRTOS?  Examples are available for the K70 as part of the SDK and there's a lot more support available as well as there are no licensing costs.  

I'm sure @mjbcswitzerland would introduce you to utasker and give you a helping hand to start off.  It's licenced software, but has great support.  

Based on your questions, I think you're looking a tough learning curve and you should consider how you are going to get help to get started as well as get help for architecting your application.  

myke

2,493 Views
omkardixit
Contributor III

@myke_predko 

Before also someone suggested me to use uTASK os instead of MQX, I tried the same but I found it a bit difficult(maybe was wrong!) as compared to MQX. 

When I moved to the MQX RTOS 4.1, I found so many documents about the same which made my work easy. Whenever I got confused, I followed the documents provided in the MQX RTOS.

But, if I get time in the future I will definitely like to work on uTASK os.

Regards,

Omkar Dixit

0 Kudos

2,485 Views
myke_predko
Senior Contributor III

Hi @omkardixit 

[EDIT: I realized that I didn't list what I consider to be the most important feature of an RTOS]

What is your experience level with working with RTOSes?  I'm asking because I would be hesitant to consider MQX as a starting point or as the RTOS for a new product.  

It's not that it isn't a good quality product but with it's change in licensing (around five years ago) to a pay licensing model on line support by other users has dried up. I still support products written with MQX so these comments are not coming from a position of ignorance.  I'm surprised that the documentation is still there, I guess that's a residual of NXP (Freescale actually) actively promoting their products with MQX from 10 years ago.  My biggest concern with MQX is that there aren't examples with NXP's SDK and when I worked with it, I had to write/support drivers (that are freely available in the SDK) by hand which ended up being a lot more work.  There are KSDK (Freescale's "Kinetis SDK") MQX code and examples available but KSDK is no longer actively supported.  

To net it out, I would consider MQX to be a suboptimal RTOS for learning and/or creating new applications.  

To be honest, there is very little difference in the different RTOSes available for Kinetis (or really any MCU).  In all of them provide a level of basic functionality with standard resources and while there are differences in performance/overhead/code size they all require the same thought processes. 

When you're selecting an RTOS, I would consider the three four most important criteria to be:

  1. Execution Monitoring.  I think it's absolutely imperitive to have the ability to see the execution state of the application tasks as well as stack, queue, semaphore, etc. information.  Very helpful in finding inefficiencies in an application as well as debugging.  As far as I know, this is not available with MQX.  
  2. Cost. This is licensing and support costs.  If this is a one off hobby project, then licensing cost isn't an issue - but if you're creating a new product, the cost can be significant.  
  3. On line support.  If other people are using the RTOS, then they are producing new code and probably have experienced the same issues you have.  Even if they aren't a quick question can lead to somebody helping you to an answer.  
  4. Driver availability and support.  As I said, when I've done MQX applications I've had to create the driver code myself - life is too short to recreate code somebody else has working and is being used and validated by many other people.  

Let me know if you want to talk more about this.  

myke

0 Kudos