<?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>topic Re: Is there an example available for creating a motor control application with Kinetis Motor Suite that is not using the Motion Planner? in Kinetis Motor Suite</title>
    <link>https://community.nxp.com/t5/Kinetis-Motor-Suite/Is-there-an-example-available-for-creating-a-motor-control/m-p/778786#M538</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Philip,&lt;/P&gt;&lt;P&gt;Yes, I am aware of that fact.&amp;nbsp; I was holding down the switch continuously.&amp;nbsp; In fact holding down the switch when I have the commented USER_RUN_PLAN does indeed work, and the motor stops when I release the button.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately the same thing does not happen when I use USER_RUN_SPEED instead, which is puzzling me.&amp;nbsp; Is there anything else I need to set to use USER_RUN_SPEED instead of USER_RUN_PLAN?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Paul Tan.&lt;/P&gt;&lt;P&gt;Exadler Technologies Inc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Mar 2018 16:52:03 GMT</pubDate>
    <dc:creator>PaulTan</dc:creator>
    <dc:date>2018-03-08T16:52:03Z</dc:date>
    <item>
      <title>Is there an example available for creating a motor control application with Kinetis Motor Suite that is not using the Motion Planner?</title>
      <link>https://community.nxp.com/t5/Kinetis-Motor-Suite/Is-there-an-example-available-for-creating-a-motor-control/m-p/778781#M533</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;I have used KMS to identify my motor parameters and create a simple motion plan using the USER_RUN_PLAN command that I successfully downloaded and ran on my eval platform.&amp;nbsp; I now would like to create an application using the USER_RUN_SPEED command and cannot get the motor to turn.&amp;nbsp; Is there an example of creating a project for applications other than running a motion plan?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Feb 2018 13:41:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Motor-Suite/Is-there-an-example-available-for-creating-a-motor-control/m-p/778781#M533</guid>
      <dc:creator>randyfields</dc:creator>
      <dc:date>2018-02-02T13:41:10Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an example available for creating a motor control application with Kinetis Motor Suite that is not using the Motion Planner?</title>
      <link>https://community.nxp.com/t5/Kinetis-Motor-Suite/Is-there-an-example-available-for-creating-a-motor-control/m-p/778782#M534</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have been experimenting with exactly this for a couple of days.&amp;nbsp; I will show you what I have in hope that it helps.&lt;/P&gt;&lt;P&gt;In the KMS_API document the user block is defined.&lt;/P&gt;&lt;P&gt;The user.states definitions are in the user.h file&lt;/P&gt;&lt;P&gt;Before you change a user state there are parameters you can modify.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To set the user state to run speed you would write:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small;"&gt; user.&lt;/SPAN&gt;&lt;SPAN style="color: #0000c0; font-size: small;"&gt;state&lt;/SPAN&gt;&lt;SPAN style="font-size: small;"&gt;= &lt;/SPAN&gt;&lt;EM style="color: #0000c0; font-size: small;"&gt;USER_RUN_SPEED&lt;/EM&gt;&lt;SPAN style="font-size: small;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small;"&gt;if you want to idle the motor you would write:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small;"&gt;user.&lt;/SPAN&gt;&lt;SPAN style="color: #0000c0; font-size: small;"&gt;state&lt;/SPAN&gt;&lt;SPAN style="font-size: small;"&gt;= &lt;/SPAN&gt;&lt;EM style="color: #0000c0; font-size: small;"&gt;USER_IDLE&lt;/EM&gt;&lt;SPAN style="font-size: small;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small;"&gt;You then need to drive a target speed by setting user.command.targetSpeed.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small;"&gt;The KMS code uses QMath in the calculations and the conversion of a float to a LQ type is easy to do but not obvious.&amp;nbsp;Check out Chapter 24 Math for the details&amp;nbsp;on the QMath library. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small;"&gt;If you use the feedback_3ph.c as an example&amp;nbsp; piece of code the raw ADC reading is converted to a _sq with the use of the function (_sq):&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: small;"&gt;tempSQ = (&lt;/SPAN&gt;&lt;SPAN style="color: #005032; font-size: small;"&gt;_sq&lt;/SPAN&gt;&lt;SPAN style="font-size: small;"&gt;)(&lt;/SPAN&gt;&lt;SPAN style="font-size: small;"&gt;adcResults-&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000c0; font-size: small;"&gt;phaseBCurrent &lt;/SPAN&gt;&lt;SPAN style="font-size: small;"&gt;- v-&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000c0; font-size: small;"&gt;calib&lt;/SPAN&gt;&lt;SPAN style="font-size: small;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #0000c0; font-size: small;"&gt;offsetIb&lt;/SPAN&gt;&lt;SPAN style="font-size: small;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small;"&gt;Likewise the conversion of the RAW ADC result to LQ&amp;nbsp;is accomplished using the (_lq) function.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small;"&gt;&lt;SPAN style="font-size: small;"&gt;In the following code&amp;nbsp;an ADC input is used to control the speed.&lt;/SPAN&gt; B&lt;/SPAN&gt;&lt;SPAN style="font-size: small;"&gt;efore you would call the code below something like this &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small;"&gt;adc0Results[0] = (_lq) adc0RawResults[0]; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small;"&gt;conversion to type _lq &lt;/SPAN&gt;&lt;SPAN style="font-size: small;"&gt;would have to be done and would be dependent on the conversion you want to make. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small;"&gt;/* code start */&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;// declare these as global variables in main.c&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;_lq adcSpeed = 0;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;_lq adcSpeedAccum = 0;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;_lq adcSpeedAvg = 0;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;uint16_t speedUpdateCounter = 0;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;// this code takes the ADC reading, downshifts it by 4 to remove noise and uses that as a percentage of the maximum applicaton speed (in this case 20krpm)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;adcSpeed = _LQmpyLQX((adc0Results[0] &amp;gt;&amp;gt; 4), 8, _LQ(20000.0/FULL_SCALE_SPEED_RPM), 24);&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;adcSpeed = _LQsat(adcSpeed, _LQ(1.0), _LQ(0.0));&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;// this code averages the adc reading over 125 samples before setting it to user.command.targetSpeed&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;// it will also handle setting the control mode if the commanded speed is larger than 0&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;if(adcSpeed &amp;gt; _LQ(0.0))&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;{&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; user.state= USER_RUN_SPEED;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(speedUpdateCounter &amp;gt;= 125)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; speedUpdateCounter = 0;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; adcSpeedAvg = (adcSpeedAccum / 125) &amp;amp; 0x00FF0000;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; user.command.targetSpeed = adcSpeedAvg;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; adcSpeedAccum = 0;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; adcSpeedAccum = adcSpeed + adcSpeedAccum;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; speedUpdateCounter++;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;}&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;else&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;{&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; user.state= USER_IDLE;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; adcSpeedAccum = 0;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; adcSpeedAvg = 0;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; speedUpdateCounter = 0;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;}&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When&amp;nbsp;we have a good example of this we will post a document about it.&lt;/P&gt;&lt;P&gt;Happy motoring,&lt;/P&gt;&lt;P&gt;Philip&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Feb 2018 20:58:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Motor-Suite/Is-there-an-example-available-for-creating-a-motor-control/m-p/778782#M534</guid>
      <dc:creator>philip_drake</dc:creator>
      <dc:date>2018-02-02T20:58:04Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an example available for creating a motor control application with Kinetis Motor Suite that is not using the Motion Planner?</title>
      <link>https://community.nxp.com/t5/Kinetis-Motor-Suite/Is-there-an-example-available-for-creating-a-motor-control/m-p/778783#M535</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Randy,&lt;/P&gt;&lt;P&gt;Were you successful in creating a non -Motion Planner control interface? I found a example how one engineer use the position input from a master controller to control a 3D printer x or y position.&amp;nbsp; The same code was put into two different MCUs, one was X and the other Y.&lt;/P&gt;&lt;P&gt;Notice the conversion of the command to set the variables of the command.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;// Expected format: xAAAAAAAABBBBBBBBX&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;// Wait for initial 'x' or 'y', remember to set this in axis variable&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;GPIOC_PSOR=(1&amp;lt;&amp;lt;3); //set buffer ready&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;do {cin=UART1_CharIn();} while (cin!=axis);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;// Read AAAAAAAA (dx as a float)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;mem=(byte *)&amp;amp;f1; for (i=0;i&amp;lt;4;i++) {*mem=UART1_ByteIn(); mem++;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;// Read BBBBBBBB (dy as a float)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;mem=(byte *)&amp;amp;f2; for (i=0;i&amp;lt;4;i++) {*mem=UART1_ByteIn(); mem++;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;// Wait for final 'X' or 'Y': if not an 'X' or 'Y', ignore message&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;cin=UART1_CharIn();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;if (cin==axis-32)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp; GPIOC_PCOR=(1&amp;lt;&amp;lt;3);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp;UART_CharOut(axis);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp; // Valid Message, go ahead and execute&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp; // ROTATION: extract integer part of rotation&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp; value=(int)f1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp; &lt;STRONG&gt;user.command.posStepInt_mrev=value;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp; //UART_TextOut("IntRotation=");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp; UART_DbleOut(value,4,1);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp; // ROTATION: extract fractional part of rotation&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp; &lt;STRONG&gt;user.command.posStepFrac_mrev=_LQ(f1-value);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp; //UART_TextOut("FracRotation=");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp; UART_DbleOut(f1-value,4,4);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp; // SPEED: extract integer part of rotation&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp; f2=f2/4000.0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp; &lt;STRONG&gt;user.command.limitVel=_LQ(f2);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp; //UART_TextOut("SpeedRPM=");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp; UART_DbleOut(f2,4,4);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp; GPIOC_PSOR=(1&amp;lt;&amp;lt;6);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp; // Wait for Sync&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp; while (((GPIOE_PDIR&amp;amp;(1&amp;lt;&amp;lt;6))==0));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp; GPIOC_PCOR=(1&amp;lt;&amp;lt;6);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp; flag=0; mike=1; &lt;STRONG&gt;user.command.runTrajectory=1;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp; while (mike==1) {UART_CharOut('1');}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp; GPIOC_PSOR=(1&amp;lt;&amp;lt;6);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In drv.c of the project this was added to identify when the movement was complete.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; /* if position move has completed, turn off trajectory generator */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if((DRV_isTrajectoryEnabled(&amp;amp;user)) &amp;amp;&amp;amp; (trajpos.output.status == TRAJPOS_IDLE))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; user.command.runTrajectory = false;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mike=false;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Philip&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Mar 2018 15:36:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Motor-Suite/Is-there-an-example-available-for-creating-a-motor-control/m-p/778783#M535</guid>
      <dc:creator>philip_drake</dc:creator>
      <dc:date>2018-03-02T15:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an example available for creating a motor control application with Kinetis Motor Suite that is not using the Motion Planner?</title>
      <link>https://community.nxp.com/t5/Kinetis-Motor-Suite/Is-there-an-example-available-for-creating-a-motor-control/m-p/778784#M536</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Philip,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry to hijack this thread, but I have a similar requirement.&amp;nbsp; I tried your suggestion, but I can't seem to get it working.&amp;nbsp; My code snippet is below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;if (GPIO_ReadPinInput(BOARD_SW2_GPIO, BOARD_SW2_GPIO_PIN) == 0) {&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;running = 1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;user.command.targetSpeed = 100;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;user.state = USER_RUN_SPEED;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;//user.state = USER_RUN_PLAN;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;} else {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;if (running == 1) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;user.state = USER_IDLE;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;running = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;/* Service SoftReset Requests from KMS */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I used USER_RUN_PLAN it works, but when I try USER_RUN_SPEED, it does not work.&amp;nbsp; What am I missing here?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Background:&lt;/P&gt;&lt;P&gt;Project created using KMS as Sensorless Velocity HALL, working under MCUXpresso.&amp;nbsp; Board is FRDM-KV31F with FRDM-MC-LVPMSM board.&amp;nbsp; KMS controls the motor fine, I can start and stop the motor using the KMS dashboard.&amp;nbsp; I made a motion plan with KMS, and that works fine when I set the user.state to USER_RUN_PLAN.&amp;nbsp; USER_RUN_SPEED just does not work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Paul Tan.&lt;/P&gt;&lt;P&gt;Exadler Technologies Inc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Mar 2018 23:29:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Motor-Suite/Is-there-an-example-available-for-creating-a-motor-control/m-p/778784#M536</guid>
      <dc:creator>PaulTan</dc:creator>
      <dc:date>2018-03-07T23:29:00Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an example available for creating a motor control application with Kinetis Motor Suite that is not using the Motion Planner?</title>
      <link>https://community.nxp.com/t5/Kinetis-Motor-Suite/Is-there-an-example-available-for-creating-a-motor-control/m-p/778785#M537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The community is made for this kind of sharing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Easy&amp;nbsp;mistake.&amp;nbsp; The lab guide is a good place to review this kind of code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The switch on the FRDM-KV31F board is momentary. Your code, in the true state, is only executing when the button is pushed and held&amp;nbsp;(the switch grounds the input). When you let off the switch is executes the else.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code you should create might&amp;nbsp;toggle a flag when the button pushed.&amp;nbsp;The first time the button&amp;nbsp;is pushed the flag would set and run the plan.&amp;nbsp; The next time it could clear the flag and the plan could stop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Philip&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Mar 2018 15:51:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Motor-Suite/Is-there-an-example-available-for-creating-a-motor-control/m-p/778785#M537</guid>
      <dc:creator>philip_drake</dc:creator>
      <dc:date>2018-03-08T15:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an example available for creating a motor control application with Kinetis Motor Suite that is not using the Motion Planner?</title>
      <link>https://community.nxp.com/t5/Kinetis-Motor-Suite/Is-there-an-example-available-for-creating-a-motor-control/m-p/778786#M538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Philip,&lt;/P&gt;&lt;P&gt;Yes, I am aware of that fact.&amp;nbsp; I was holding down the switch continuously.&amp;nbsp; In fact holding down the switch when I have the commented USER_RUN_PLAN does indeed work, and the motor stops when I release the button.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately the same thing does not happen when I use USER_RUN_SPEED instead, which is puzzling me.&amp;nbsp; Is there anything else I need to set to use USER_RUN_SPEED instead of USER_RUN_PLAN?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Paul Tan.&lt;/P&gt;&lt;P&gt;Exadler Technologies Inc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Mar 2018 16:52:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Motor-Suite/Is-there-an-example-available-for-creating-a-motor-control/m-p/778786#M538</guid>
      <dc:creator>PaulTan</dc:creator>
      <dc:date>2018-03-08T16:52:03Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an example available for creating a motor control application with Kinetis Motor Suite that is not using the Motion Planner?</title>
      <link>https://community.nxp.com/t5/Kinetis-Motor-Suite/Is-there-an-example-available-for-creating-a-motor-control/m-p/778787#M539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Paul,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The key issue is this line:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;user.command.targetSpeed = 100;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;In KMS all values are normalized fixed-point.&amp;nbsp; So setting&amp;nbsp;&lt;SPAN&gt;user.command.targetSpeed to 100 is setting the target speed to a very small value (&amp;lt;&amp;lt; 1RPM).&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f;"&gt;You need to convert from RPM into the normalized fixed point used by KMS.&amp;nbsp; See example below:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f;"&gt;&lt;SPAN&gt;user.command.targetSpeed = _LQ(100.0 /&amp;nbsp;FULL_SCALE_SPEED_RPM);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f;"&gt;&lt;SPAN&gt;In the above line, &lt;SPAN style="background-color: #ffffff;"&gt;FULL_SCALE_SPEED_RPM&amp;nbsp;represents the maximum possible speed in the system.&amp;nbsp; Dividing the input speed of 100.0 by this value will convert your input into a normalized value.&amp;nbsp; Since KMS is also fixed point, we need to convert this normalized floating point number.&amp;nbsp; The macro _LQ will convert from floating point into fixed point at the default Qness.&amp;nbsp; The variable&amp;nbsp;user.command.targetSpeed is defined as an _lq variable.&amp;nbsp; This means it is a 32-bit container with a Qness of 24 (24 bits after the decimal point).&amp;nbsp; By default all _lq variables at Q24 unless otherwise noted in the variable name.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f;"&gt;&lt;/SPAN&gt;Hope that helps explain why you don't see any motion.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Mar 2018 17:32:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Motor-Suite/Is-there-an-example-available-for-creating-a-motor-control/m-p/778787#M539</guid>
      <dc:creator>linestream-adam</dc:creator>
      <dc:date>2018-03-08T17:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an example available for creating a motor control application with Kinetis Motor Suite that is not using the Motion Planner?</title>
      <link>https://community.nxp.com/t5/Kinetis-Motor-Suite/Is-there-an-example-available-for-creating-a-motor-control/m-p/778788#M540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank You!&amp;nbsp; That was indeed the problem!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I now have a working motor controller!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul Tan.&lt;/P&gt;&lt;P&gt;Exadler Technologies Inc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Mar 2018 18:57:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Motor-Suite/Is-there-an-example-available-for-creating-a-motor-control/m-p/778788#M540</guid>
      <dc:creator>PaulTan</dc:creator>
      <dc:date>2018-03-08T18:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an example available for creating a motor control application with Kinetis Motor Suite that is not using the Motion Planner?</title>
      <link>https://community.nxp.com/t5/Kinetis-Motor-Suite/Is-there-an-example-available-for-creating-a-motor-control/m-p/778789#M541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Philip,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, I had found that the speed command that I was providing was incorrect.&amp;nbsp; I was providing a raw uint32_t value, instead I needed to use the defined scaling macro VEL_PU(value) when supplying a velocity.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Randy Fields&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Mar 2018 15:06:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Motor-Suite/Is-there-an-example-available-for-creating-a-motor-control/m-p/778789#M541</guid>
      <dc:creator>randyfields</dc:creator>
      <dc:date>2018-03-30T15:06:50Z</dc:date>
    </item>
  </channel>
</rss>

