<?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>Kinetis MicrocontrollersのトピックControlling a Servo Motor with PWM - FRDM-KL43Z</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Controlling-a-Servo-Motor-with-PWM-FRDM-KL43Z/m-p/896609#M52869</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So, basically, I'm trying to control a servo motor which pulse have 20ms, like the picture below:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Micro Servo 9g" class="image-1 jive-image j-img-original" src="https://www.sumozade.com/sg90-9g-micro-servo-motor-servo-motors-1900-62-B.gif" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I setup my PWM to 50 Hz, but when I'm updating the duty cycle (with the function &lt;EM&gt;TPM_UpdatePwmDutycycle&lt;/EM&gt;), I can only work with percent changes, which give me like 10 differents angles (from varying the duty cycle from 1% to 10%, because 2 ms equals to 10% of the pulse), since &lt;SPAN style="font-size: 15px;"&gt;the function exp&lt;/SPAN&gt;ects an integer parameter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;EM&gt;void TPM_UpdatePwmDutycycle(TPM_Type *base, tpm_chnl_t chnlNumber, tpm_pwm_mode_t currentPwmMode, uint8_t dutyCyclePercent)&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;How can I work around it?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 May 2019 01:01:26 GMT</pubDate>
    <dc:creator>zezao</dc:creator>
    <dc:date>2019-05-16T01:01:26Z</dc:date>
    <item>
      <title>Controlling a Servo Motor with PWM - FRDM-KL43Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Controlling-a-Servo-Motor-with-PWM-FRDM-KL43Z/m-p/896609#M52869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So, basically, I'm trying to control a servo motor which pulse have 20ms, like the picture below:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Micro Servo 9g" class="image-1 jive-image j-img-original" src="https://www.sumozade.com/sg90-9g-micro-servo-motor-servo-motors-1900-62-B.gif" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I setup my PWM to 50 Hz, but when I'm updating the duty cycle (with the function &lt;EM&gt;TPM_UpdatePwmDutycycle&lt;/EM&gt;), I can only work with percent changes, which give me like 10 differents angles (from varying the duty cycle from 1% to 10%, because 2 ms equals to 10% of the pulse), since &lt;SPAN style="font-size: 15px;"&gt;the function exp&lt;/SPAN&gt;ects an integer parameter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;EM&gt;void TPM_UpdatePwmDutycycle(TPM_Type *base, tpm_chnl_t chnlNumber, tpm_pwm_mode_t currentPwmMode, uint8_t dutyCyclePercent)&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;How can I work around it?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 May 2019 01:01:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Controlling-a-Servo-Motor-with-PWM-FRDM-KL43Z/m-p/896609#M52869</guid>
      <dc:creator>zezao</dc:creator>
      <dc:date>2019-05-16T01:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling a Servo Motor with PWM - FRDM-KL43Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Controlling-a-Servo-Motor-with-PWM-FRDM-KL43Z/m-p/896610#M52870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;SPAN class=""&gt;&lt;STRONG&gt;&lt;A _jive_internal="true" data-avatarid="-1" data-content-finding="Community" data-userid="341472" data-username="zezao" href="https://community.nxp.com/people/zezao"&gt;José Baretta&lt;/A&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;，&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; The &lt;SPAN style="font-size: 12px;"&gt;&lt;EM&gt;dutyCyclePercent&lt;/EM&gt;&lt;/SPAN&gt; in the API &lt;SPAN style="font-size: 12px;"&gt;&lt;EM&gt; TPM_UpdatePwmDutycycle(TPM_Type *base, tpm_chnl_t chnlNumber, tpm_pwm_mode_t currentPwmMode, uint8_t dutyCyclePercent)&lt;/EM&gt;&lt;/SPAN&gt; just used to change the dutyCyclePercent.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; The value is from 0-100. If you want the duty cycle is 1-2ms, then you can use 5% to 10%.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If you don't want to use the percent change, you also can calculate the according duty data, then input it in the TPM_CnV register.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; More details, you can refer to the KL43 reference manual.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; BTW, the KL43 is 3.3V chip, if you want to output 5V, you need external transform circuit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wish it helps you!&lt;/P&gt;&lt;P&gt;If you still have question about it, please kindly let me know.&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt; Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 May 2019 10:31:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Controlling-a-Servo-Motor-with-PWM-FRDM-KL43Z/m-p/896610#M52870</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2019-05-16T10:31:58Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling a Servo Motor with PWM - FRDM-KL43Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Controlling-a-Servo-Motor-with-PWM-FRDM-KL43Z/m-p/896611#M52871</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The problem is with that function I can only vary my pulse from 0.2 to 0.2 ms (I can't get 1.05 ms, for example). I think I'll have to use the&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;TPM_CnV register anyway.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;BTW, I'm powering the servo with 5V, only my PWM is 3.3V, and it seems to work fine.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Thank you for the reply!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 May 2019 11:49:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Controlling-a-Servo-Motor-with-PWM-FRDM-KL43Z/m-p/896611#M52871</guid>
      <dc:creator>zezao</dc:creator>
      <dc:date>2019-05-16T11:49:03Z</dc:date>
    </item>
  </channel>
</rss>

