<?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>LPC Microcontrollers中的主题 Re: LPC54608 to manage acceleration and deceleration with a stepper motor</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54608-to-manage-acceleration-and-deceleration-with-a-stepper/m-p/1855430#M55934</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/207201"&gt;@AntoineB&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If using LPC54608 control motor, recommend you use SCTIMER. How about using it, check whether can resolve your issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Alice&lt;/P&gt;</description>
    <pubDate>Fri, 26 Apr 2024 07:55:05 GMT</pubDate>
    <dc:creator>Alice_Yang</dc:creator>
    <dc:date>2024-04-26T07:55:05Z</dc:date>
    <item>
      <title>LPC54608 to manage acceleration and deceleration with a stepper motor</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54608-to-manage-acceleration-and-deceleration-with-a-stepper/m-p/1853414#M55912</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I need to generate a signal from a CTIMER to feed a stepper motor drive to control the speed of the motor and to being able to count the number of pulse I generated and stop the signal when an number of pulses have been reach.&lt;/P&gt;&lt;P&gt;I succeed to do it at constant speed (when I don't need to change the frequency of my signal) by doing like this :&lt;/P&gt;&lt;P&gt;// To start my timer&lt;/P&gt;&lt;P&gt;CTIMER_StopTimer(CTIMER1);&lt;/P&gt;&lt;P&gt;CTIMER_Reset(CTIMER1);&lt;BR /&gt;CTIMER_SetupPwm(CTIMER1, CTIMER_MAT_OUT, 50, freq, CTIMER1_TICK_FREQ, false);&lt;BR /&gt;CTIMER_StartTimer(CTIMER1);&lt;/P&gt;&lt;P&gt;// To count the number of pulses before to stop motor&lt;/P&gt;&lt;P&gt;void CTIMER1_Callback_interrupt(uint32_t flags)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;countIncMotor++;&lt;BR /&gt;if( countIncMotor &amp;gt;= M1_stepsNumberToRun) // arret moteur nombre de pas atteint&lt;BR /&gt;{&lt;BR /&gt;Moteurs.b.bOnOffM1 = false;&lt;BR /&gt;CTIMER_StopTimer(CTIMER1);&lt;BR /&gt;GPIO_PinWrite(GPIO, MOTOR1_INIT_ENABLE_PORT, MOTOR1_INIT_ENABLE_PIN, 1);&lt;BR /&gt;printf("Pulse motor stop, pulse idx =%d\n",countIncMotor );&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;When I don't change the frequency signal during motor is on, no problem the number of speed counted by the&amp;nbsp;CTIMER1_Callback_interrupt correspond to the number of pulses observed on the oscilloscope and the motor stop at expected position.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when I had some acceleration and deceleration during motor movement the motor finished always with a position with more steps than expected almost like if the callback missed some pulses during PMW reinitialization. Do you see any work around to avoid this problem?&lt;/P&gt;&lt;P&gt;How I do to change the frequency :&lt;/P&gt;&lt;P&gt;// loop task&amp;nbsp;&lt;BR /&gt;while(1)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;DelayMS(TIME_BETWEEN_FREQ_CHANGE_IN_MS);&lt;BR /&gt;if(Moteurs.b.bOnOffM1)&lt;BR /&gt;{&lt;BR /&gt;if( nbLoopOccured == 0 ) M1_currentFreq = M1_miniFreq;&lt;BR /&gt;if( nbLoopOccured &amp;lt; (M1_maxFreq - M1_miniFreq)/M1_freqDiff)&amp;nbsp; // acceleration&lt;BR /&gt;{&lt;BR /&gt;CTIMER_StopTimer(CTIMER1);&lt;BR /&gt;CTIMER_Reset(CTIMER1);&lt;BR /&gt;M1_currentFreq = M1_currentFreq + M1_freqDiff;&lt;BR /&gt;CTIMER_SetupPwm(CTIMER1, CTIMER_MAT_OUT, 50, M1_currentFreq, CTIMER1_TICK_FREQ, false);&lt;BR /&gt;CTIMER_StartTimer(CTIMER1);&lt;BR /&gt;printf("acceleration %d &amp;lt; %d freq:%d\n", (nbLoopOccured), (M1_maxFreq - M1_miniFreq)/M1_freqDiff , M1_currentFreq);&lt;BR /&gt;}&lt;BR /&gt;else&amp;nbsp; // deceleration&lt;BR /&gt;{&lt;BR /&gt;if( M1_currentFreq&amp;gt; M1_miniFreq)&lt;BR /&gt;{&lt;BR /&gt;CTIMER_StopTimer(CTIMER1);&lt;BR /&gt;CTIMER_Reset(CTIMER1);&lt;BR /&gt;M1_currentFreq = M1_currentFreq - M1_freqDiff;&lt;BR /&gt;CTIMER_SetupPwm(CTIMER1, CTIMER_MAT_OUT, 50, M1_currentFreq, CTIMER1_TICK_FREQ, false);&lt;BR /&gt;CTIMER_StartTimer(CTIMER1);&lt;BR /&gt;printf("deceleration %d &amp;lt; %d freq:%d\n", (nbLoopOccured), (M1_maxFreq - M1_miniFreq)/M1_freqDiff , M1_currentFreq);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2024 11:30:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54608-to-manage-acceleration-and-deceleration-with-a-stepper/m-p/1853414#M55912</guid>
      <dc:creator>AntoineB</dc:creator>
      <dc:date>2024-04-24T11:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: LPC54608 to manage acceleration and deceleration with a stepper motor</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54608-to-manage-acceleration-and-deceleration-with-a-stepper/m-p/1855430#M55934</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/207201"&gt;@AntoineB&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If using LPC54608 control motor, recommend you use SCTIMER. How about using it, check whether can resolve your issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Alice&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2024 07:55:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54608-to-manage-acceleration-and-deceleration-with-a-stepper/m-p/1855430#M55934</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2024-04-26T07:55:05Z</dc:date>
    </item>
  </channel>
</rss>

