<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>MQX Software Solutions中的主题 Re: Multithread with MQX on KL25Z</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/Multithread-with-MQX-on-KL25Z/m-p/367039#M12117</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In fact KL25Z is single core MCU, therefore core could execute just one task at the same time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Typical solution is that all tasks running in endless loops:&lt;/P&gt;&lt;P&gt;While(1){&lt;/P&gt;&lt;P&gt;//task code&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately MQX Lite doesn’t offer Round Robin (Time Slice) scheduling option. Task switching mechanism is based on priority – higher priority=lower priority number runs first.&lt;/P&gt;&lt;P&gt;Therefore you need synchronization objects.&lt;/P&gt;&lt;P&gt;If your tasks runs at the same priority, you can simple call _sched_yield() function for move current task to end of ready queue and execute next task.&lt;/P&gt;&lt;P&gt;Other option is _time_delay_for()/_time_delay_until() functions – it suspends the active task for/until the specified time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However most important synchronization objects are Lightweight events, Lightweight semaphores, Lightweight messages and Mutexes.&lt;/P&gt;&lt;P&gt;These synchronization objects could be used for task switching between active/blocked and ready states.&lt;/P&gt;&lt;P&gt;For example _lwevent_wait_for() function will cause switch active tasks to blocked state, until appropriate bit will be set (by _lwevent_set() function) or until specific time (in ticks). In that case another ready task with highest priority will be executed…&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The easiest way how to start with MQX Lite operating system is through example applications.&lt;/P&gt;&lt;P&gt;CodeWarrior examples are available at:&lt;/P&gt;&lt;P&gt;CodeWarrior}\MCU\CodeWarrior_Examples\Processor_Expert\MQXLite directory.&lt;/P&gt;&lt;P&gt;In KDS:&lt;/P&gt;&lt;P&gt;KDS_2.0.0\eclipse\ProcessorExpert\Projects\Kinetis\MQXLite\..&lt;/P&gt;&lt;P&gt;In KSDK (If you use MQX for KSDK with Lite configuration):&lt;/P&gt;&lt;P&gt;KSDK_1.1.0\rtos\mqx\mqx\examples\&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See also MQX Lite User Guide:&lt;/P&gt;&lt;P&gt;&lt;A class="unlinked" title="http://cache.freescale.com/files/soft_dev_tools/doc/user_guide/MQXLITEUG.pdf?fsrch=1"&gt;http://www.freescale.com/files/soft_dev_tools/doc/user_guide/MQXLITEUG.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;and MQX Lite Reference Manual:&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://www.freescale.com/files/32bit/doc/ref_manual/MQXLITE_RM.pdf" target="_blank"&gt;http://www.freescale.com/files/32bit/doc/ref_manual/MQXLITE_RM.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;RadekS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Feb 2015 17:51:26 GMT</pubDate>
    <dc:creator>RadekS</dc:creator>
    <dc:date>2015-02-11T17:51:26Z</dc:date>
    <item>
      <title>Multithread with MQX on KL25Z</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Multithread-with-MQX-on-KL25Z/m-p/367038#M12116</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everybody !&lt;/P&gt;&lt;P&gt;I have some trouble with Multithreading settings on Kinetis Design Studio. In fact, I have the KL25Z board and I need for my project to have several threads running at the same time. I am using the Processor Expert Mode on Kinetis, have added MQXLite component and have created few tasks.&lt;/P&gt;&lt;P&gt;But on running step, the tasks runs consecutively (one after the other). What I want is each tasks runs at the same time (for example, several quantum for the first tasks executed followed by several quantum for the second tasks with a scheduling algorithm).&lt;/P&gt;&lt;P&gt;Do you have any ideas or maybe some example ?&lt;/P&gt;&lt;P&gt;Thanks :smileywink:&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 13:34:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Multithread-with-MQX-on-KL25Z/m-p/367038#M12116</guid>
      <dc:creator>ise1</dc:creator>
      <dc:date>2015-02-11T13:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: Multithread with MQX on KL25Z</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Multithread-with-MQX-on-KL25Z/m-p/367039#M12117</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In fact KL25Z is single core MCU, therefore core could execute just one task at the same time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Typical solution is that all tasks running in endless loops:&lt;/P&gt;&lt;P&gt;While(1){&lt;/P&gt;&lt;P&gt;//task code&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately MQX Lite doesn’t offer Round Robin (Time Slice) scheduling option. Task switching mechanism is based on priority – higher priority=lower priority number runs first.&lt;/P&gt;&lt;P&gt;Therefore you need synchronization objects.&lt;/P&gt;&lt;P&gt;If your tasks runs at the same priority, you can simple call _sched_yield() function for move current task to end of ready queue and execute next task.&lt;/P&gt;&lt;P&gt;Other option is _time_delay_for()/_time_delay_until() functions – it suspends the active task for/until the specified time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However most important synchronization objects are Lightweight events, Lightweight semaphores, Lightweight messages and Mutexes.&lt;/P&gt;&lt;P&gt;These synchronization objects could be used for task switching between active/blocked and ready states.&lt;/P&gt;&lt;P&gt;For example _lwevent_wait_for() function will cause switch active tasks to blocked state, until appropriate bit will be set (by _lwevent_set() function) or until specific time (in ticks). In that case another ready task with highest priority will be executed…&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The easiest way how to start with MQX Lite operating system is through example applications.&lt;/P&gt;&lt;P&gt;CodeWarrior examples are available at:&lt;/P&gt;&lt;P&gt;CodeWarrior}\MCU\CodeWarrior_Examples\Processor_Expert\MQXLite directory.&lt;/P&gt;&lt;P&gt;In KDS:&lt;/P&gt;&lt;P&gt;KDS_2.0.0\eclipse\ProcessorExpert\Projects\Kinetis\MQXLite\..&lt;/P&gt;&lt;P&gt;In KSDK (If you use MQX for KSDK with Lite configuration):&lt;/P&gt;&lt;P&gt;KSDK_1.1.0\rtos\mqx\mqx\examples\&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See also MQX Lite User Guide:&lt;/P&gt;&lt;P&gt;&lt;A class="unlinked" title="http://cache.freescale.com/files/soft_dev_tools/doc/user_guide/MQXLITEUG.pdf?fsrch=1"&gt;http://www.freescale.com/files/soft_dev_tools/doc/user_guide/MQXLITEUG.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;and MQX Lite Reference Manual:&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://www.freescale.com/files/32bit/doc/ref_manual/MQXLITE_RM.pdf" target="_blank"&gt;http://www.freescale.com/files/32bit/doc/ref_manual/MQXLITE_RM.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;RadekS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 17:51:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Multithread-with-MQX-on-KL25Z/m-p/367039#M12117</guid>
      <dc:creator>RadekS</dc:creator>
      <dc:date>2015-02-11T17:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: Multithread with MQX on KL25Z</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Multithread-with-MQX-on-KL25Z/m-p/367040#M12118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your help RadekS ! :smileywink:&lt;BR /&gt;Now I get how MQX Lite works !&lt;BR /&gt;Nevertheless, I have found an other way to resolve my problem: my main task is the blinking of LEDs which are managed using a PWM.&lt;/P&gt;&lt;P&gt;So I will initialize my PWM with a specific intensity and frequency, and my other tasks will be executed consecutively at the same time (in a while(1)) without stopping the blinking of my LEDs: That's what I wanted to do !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Feb 2015 11:48:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Multithread-with-MQX-on-KL25Z/m-p/367040#M12118</guid>
      <dc:creator>ise1</dc:creator>
      <dc:date>2015-02-12T11:48:48Z</dc:date>
    </item>
  </channel>
</rss>

