<?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>S12 / MagniV MicrocontrollersのトピックBLDC Motors  param</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/BLDC-Motors-param/m-p/700944#M14539</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I reference the document&amp;nbsp;&lt;SPAN&gt;AN4704 and code to &amp;nbsp;do research of&amp;nbsp;Sensorless Control of BLDC Motors use&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;MC9S12ZVM&lt;/SPAN&gt;&amp;nbsp;.And in the code as follow: &amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not know:&amp;nbsp;why&amp;nbsp;&lt;STRONG&gt;SPEED_CALC_NUMERATOR=16777216? &amp;nbsp;1431.655765 = 1000 rpm? How to calculation it ?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;Thanks!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#ifdef _HIGH_SPEED_SCALING&lt;BR /&gt;/***** High speed scaling *********************&lt;BR /&gt; * For 4 pole-pairs motors&lt;BR /&gt; * Boundary values for 1.28 us timer period:&lt;BR /&gt; * - Minimal speed: 60 rpm&lt;BR /&gt; * - Minimal speed scaled: 86&lt;BR /&gt; * - Maximal speed: 22887 rpm&lt;BR /&gt; * - Maximal speed scaled: 32767&lt;BR /&gt; *********************************************/&lt;BR /&gt;&lt;STRONG&gt;#define SPEED_CALC_NUMERATOR 16777216&lt;/STRONG&gt;&lt;BR /&gt;#define STALLCHECK_MIN_CMT_PERIOD 97 // 97 = 125 us (20 krpm on 4 pole-pairs motor), min value = 85 (22.89 krpm)&lt;BR /&gt;&lt;STRONG&gt;#define REQUIRED_RUN_SPEED 1432 // &amp;nbsp; 1431.655765 = 1000 rpm&lt;/STRONG&gt;&lt;BR /&gt;#define MIN_SPEED (1432/2) // 500 rpm minimal speed for Down button control (should be min 10% of nominal motor speed)&lt;BR /&gt;#define MAX_SPEED (1432*13) // 13 krpm maximum speed for Up button control&lt;BR /&gt;#define SPEED_STEP (1432/2) // 500 rpm, Up/Down step for button controls&lt;BR /&gt;//*****&lt;BR /&gt;#endif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;period6ZC = periodZC_F_PhA + periodZC_R_PhA + periodZC_F_PhB + periodZC_R_PhB + periodZC_F_PhC + periodZC_R_PhC;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; actualSpeed = SPEED_CALC_NUMERATOR / period6ZC;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 12 Sep 2017 14:22:11 GMT</pubDate>
    <dc:creator>sufree</dc:creator>
    <dc:date>2017-09-12T14:22:11Z</dc:date>
    <item>
      <title>BLDC Motors  param</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/BLDC-Motors-param/m-p/700944#M14539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I reference the document&amp;nbsp;&lt;SPAN&gt;AN4704 and code to &amp;nbsp;do research of&amp;nbsp;Sensorless Control of BLDC Motors use&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;MC9S12ZVM&lt;/SPAN&gt;&amp;nbsp;.And in the code as follow: &amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not know:&amp;nbsp;why&amp;nbsp;&lt;STRONG&gt;SPEED_CALC_NUMERATOR=16777216? &amp;nbsp;1431.655765 = 1000 rpm? How to calculation it ?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;Thanks!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#ifdef _HIGH_SPEED_SCALING&lt;BR /&gt;/***** High speed scaling *********************&lt;BR /&gt; * For 4 pole-pairs motors&lt;BR /&gt; * Boundary values for 1.28 us timer period:&lt;BR /&gt; * - Minimal speed: 60 rpm&lt;BR /&gt; * - Minimal speed scaled: 86&lt;BR /&gt; * - Maximal speed: 22887 rpm&lt;BR /&gt; * - Maximal speed scaled: 32767&lt;BR /&gt; *********************************************/&lt;BR /&gt;&lt;STRONG&gt;#define SPEED_CALC_NUMERATOR 16777216&lt;/STRONG&gt;&lt;BR /&gt;#define STALLCHECK_MIN_CMT_PERIOD 97 // 97 = 125 us (20 krpm on 4 pole-pairs motor), min value = 85 (22.89 krpm)&lt;BR /&gt;&lt;STRONG&gt;#define REQUIRED_RUN_SPEED 1432 // &amp;nbsp; 1431.655765 = 1000 rpm&lt;/STRONG&gt;&lt;BR /&gt;#define MIN_SPEED (1432/2) // 500 rpm minimal speed for Down button control (should be min 10% of nominal motor speed)&lt;BR /&gt;#define MAX_SPEED (1432*13) // 13 krpm maximum speed for Up button control&lt;BR /&gt;#define SPEED_STEP (1432/2) // 500 rpm, Up/Down step for button controls&lt;BR /&gt;//*****&lt;BR /&gt;#endif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;period6ZC = periodZC_F_PhA + periodZC_R_PhA + periodZC_F_PhB + periodZC_R_PhB + periodZC_F_PhC + periodZC_R_PhC;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; actualSpeed = SPEED_CALC_NUMERATOR / period6ZC;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Sep 2017 14:22:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/BLDC-Motors-param/m-p/700944#M14539</guid>
      <dc:creator>sufree</dc:creator>
      <dc:date>2017-09-12T14:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: BLDC Motors  param</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/BLDC-Motors-param/m-p/700945#M14540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The numbers make the connection between the commutation time and speed in terms of Timer ticks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the floating point representation is used, it's agreed that the math between speed and commutation period is given:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Speed_RPS = 1 / (CommutationPeriod * PolePairs)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;CommutationPeriod = 1 / (Speed_RPS * PolePairs)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Speed_RPS&amp;nbsp;=&amp;nbsp;Speed_RPM / 60&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In 1.15 fractional implementation &amp;lt;-1.0, 1.0), the situation is scaled to a "numerator", which helps the calculation to stay within the scale, considering integer type casting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;tFrac16_Speed = tU32_Numerator / (tU16_CommutationPeriod * tU16_PolePairs)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;tU16_CommutationPeriod = tU32_Numerator / (tFrac16_Speed * tU16_PolePairs)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;While we typically use higher pole-paired motors,&amp;nbsp;the numerator should be calculated based on the pole-pairs.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Some advanced math behind:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;We can start with the maximal speed, let's say MaxSpeed = 15000 RPM and PolePairs = 4. That means, the CommutationPeriod = 1 / (15000/60 * 4) = 1&amp;nbsp;ms&lt;/P&gt;&lt;P&gt;Let's set the minimum number of timer ticks per one commutation, which gives us a precission of the commutation:&lt;/P&gt;&lt;P&gt;MinTicksPerCommutation = 512&lt;/P&gt;&lt;P&gt;Now, our system uses 1.15 fraction format, which means the maximum integer number is ideally 32768. This gives us the base for our Numerator:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;tU32_Numerator&amp;nbsp;= MinTicksPerCommutation&amp;nbsp;* 32768&amp;nbsp;= 16777216&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;With the minimal&amp;nbsp;&lt;SPAN&gt;CommutationPeriod&amp;nbsp;= 0.5&amp;nbsp;ms and&amp;nbsp;MinTicksPerCommutation&amp;nbsp;= 512, we can calculate the timer domain:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;MaxTickTime = MinCommutationPeriod&lt;SPAN&gt;&amp;nbsp;/&amp;nbsp;MinTicksPerCommutation&lt;SPAN&gt;&amp;nbsp;= 1.9...&amp;nbsp;us. Now, the fBus divider is calculated, based on the fBus = 50 MHz&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;TimerDivider ~&amp;nbsp;MaxTickTime&amp;nbsp;*&amp;nbsp;fBus&amp;nbsp;= 96., thus nearest TimerDivider&amp;nbsp;= 64&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;TimerTickFrequency = fBus /&amp;nbsp;TimerDivider&amp;nbsp;= 781.25 kHz&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;TickTime = 1.28 us&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Since we have selected a different TimerDivider, the scale is slightly different for corner case:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Min&lt;SPAN&gt;CommutationPeriod&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;= TickTime&amp;nbsp;* MinTicksPerCommutation&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;= 1.28us * 512 = 0,655&amp;nbsp;ms&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;MaxSpeed =&amp;nbsp;1 / (Min&lt;SPAN&gt;CommutationPeriod&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;/ 60 * 4) = 22 900&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;In the example, the speed is calculated simply by adding all the commutation periods and recalculating using the formula above.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the speed scale, just consider following:&lt;/P&gt;&lt;P&gt;tFrac16 maximum is 32767&lt;/P&gt;&lt;P&gt;MaxSpeed is 22900&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If the required speed is 1000 RPM, its integer representation is then 32768 / 22900 * 1000 RPM = 1431 RPM&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it will help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Matej&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Sep 2017 11:42:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/BLDC-Motors-param/m-p/700945#M14540</guid>
      <dc:creator>pachamatej</dc:creator>
      <dc:date>2017-09-13T11:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: BLDC Motors  param</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/BLDC-Motors-param/m-p/700946#M14541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #edf8ca;"&gt;Hello &amp;nbsp;Matej,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #edf8ca;"&gt;Thank you very much!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Sep 2017 06:39:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/BLDC-Motors-param/m-p/700946#M14541</guid>
      <dc:creator>sufree</dc:creator>
      <dc:date>2017-09-17T06:39:31Z</dc:date>
    </item>
  </channel>
</rss>

