<?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のトピックRe: about using AN5201SW by S12ZVM12EVB</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/about-using-AN5201SW-by-S12ZVM12EVB/m-p/762332#M15266</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello SuBin Kim,&lt;/P&gt;&lt;P&gt;I'm not the author of the code, but let's walk through the calculation:&lt;/P&gt;&lt;P&gt;The motor speed is calculated based on the zero-cross detection of BEMF voltage on a non-active phase. These zero-cross events times are measured by capturing the TIM0CNT register at the time the ADC routine detects a zero-cross.&lt;/P&gt;&lt;P&gt;That means, the time is scaled by the TIM0 settings.&lt;/P&gt;&lt;P&gt;In the application, the zero-cross periods are captured with&amp;nbsp;&lt;STRONG&gt;periodZC_F_PhA,&amp;nbsp;periodZC_R_PhA&lt;/STRONG&gt;, etc., which are defined as tU16 (16 bit unsigned). To calculate one "electric" revolution of a motor = 6 commutations (or 6 zero-crosses), 6 periods&amp;nbsp;are summed.&amp;nbsp;For that case, the "&lt;STRONG&gt;period6ZC&lt;/STRONG&gt;" is defined, formated as tU32 (or unsigned long) to prevent an overflow if all 6 zero-cross periods are summed.&lt;/P&gt;&lt;P&gt;If you sum all the 6 zero-cross periods, you'll get the time per single "electric" revolution. That means, if the motor is 2-pole motor (1 pole-pair motor), it would be the time per single "mechanical" revolution of the rotor. You can easily get the time&amp;nbsp;per mechanical revolution for higher-pole motor simply by multipling it by number of pole-pairs.&lt;/P&gt;&lt;P&gt;Let's get back to the code: the period per 6 zero-crosses&amp;nbsp;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;period6ZC&lt;/STRONG&gt;"&lt;SPAN&gt;&amp;nbsp;is calculated on the line 813, within the 1 ms timer interrupt routine. Since the speed (rotor frequency) is just an inverted time period, it is calculated using line 814:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;actualSpeed = SPEED_CALC_NUMERATOR / period6ZC;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Now, how to read it's scale? Let's assume the "&lt;STRONG&gt;actualSpeed&lt;/STRONG&gt;" is&amp;nbsp;tFrac32 (1.31 formated signed 32bit number). It would mean the maximal fraction number is 1.0, which is&amp;nbsp;&amp;nbsp;2^31 = 2,147,483,648.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The task is to find the &lt;STRONG&gt;SPEED_CALC_NUMERATOR&lt;/STRONG&gt; for which the &lt;STRONG&gt;period6ZC&lt;/STRONG&gt; gives the number above.&lt;/P&gt;&lt;P&gt;Considering the timer TIM0 prescaler is set to 16 (TIM0TSCR2_PR = 4) and the bus clock is 12.5MHz, the timer tick is 12.5MHz / 16 = 781.25 kHz, which is 1.28us.&lt;/P&gt;&lt;P&gt;Let's assume the maximum mechanical speed of the motor is 10,000 RPM and the motor is 6-pole-pair. That would give us 10000/(60 seconds) =&amp;nbsp;166.67&amp;nbsp;revolutions per second, 166.67*(6 pole-pairs) = 1000 electrical revolutions per second, so 1000 * (6 commutations) = 6000 commutations/zero-crosses per second. That would make 1/6000 = 167.67us per one commutation. With our 1.28us timer, we can catch upto&amp;nbsp;130.28 periods at maximal speed.&lt;/P&gt;&lt;P&gt;For maximal speed, we can simply rearrange the "&lt;STRONG&gt;actualSpeed&lt;/STRONG&gt;" calulation, assuming that:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;actualSpeed&amp;nbsp;&lt;/STRONG&gt;= FRAC32(1.0) =&amp;nbsp;2,147,483,648&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;period6ZC&lt;/STRONG&gt; = 6 periods * 130 = 780&amp;nbsp;(rounded down, since the value is still an integer)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Well, the important information is hidden in the casting of the &lt;STRONG&gt;actualSpeed&lt;/STRONG&gt; from Frac32 to Frac16&amp;nbsp;at line 816:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;speedErr = requiredSpeed - (tFrac16) actualSpeed;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;That means, only the lower 16 bits are considered the speed. Therefore, for maximum speed, the "&lt;STRONG&gt;actualSpeed&lt;/STRONG&gt;" = 32767.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;32767&amp;nbsp;=&amp;nbsp;SPEED_CALC_NUMERATOR&amp;nbsp;/&amp;nbsp;780&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;SPEED_CALC_NUMERATOR&amp;nbsp; = 780 * 32767 = 25558260&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thus&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;#define&amp;nbsp;SPEED_CALC_NUMERATOR&amp;nbsp;25558260&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Using the equation from the line 814, the speed would be:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;actualSpeed&lt;/STRONG&gt; = &lt;STRONG&gt;SPEED_CALC_NUMERATOR&lt;/STRONG&gt; / &lt;STRONG&gt;period6ZC&lt;/STRONG&gt; =&amp;nbsp;25558260 / 780 = 32,767;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Masking that value by lower 15 bits and casting it as tFrac16 would make it fit the max speed range of 10,000 RPM.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;RealScaleSpeedRPM&lt;/STRONG&gt; =&amp;nbsp;&lt;STRONG&gt;actualSpeed&lt;/STRONG&gt; / 32,767 * &lt;STRONG&gt;MAX_SPEED&lt;/STRONG&gt; = &lt;STRONG&gt;actualSpeed&lt;/STRONG&gt; / 32,767 * 10,000.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If the speed scale is calculated like this, it should be reflected in the command constants as well:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;#define SPEED_SCALE 10000.0&amp;nbsp; // Used for correct calculation of the following:
#define REQUIRED_RUN_SPEED FRAC16(2000.0/SPEED_SCALE) // 2000 rpm
#define MIN_SPEED FRAC16(500.0/SPEED_SCALE) // 500 rpm minimal speed for Down button control (should be min 10% of nominal motor speed)
#define MAX_SPEED FRAC16(5000.0/SPEED_SCALE) // 5 krpm maximum speed for Up button control
#define SPEED_STEP FRAC16(100.0/SPEED_SCALE) // 100 rpm, Up/Down step for button controls&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;These scales shall&amp;nbsp;be updated in the FreeMASTER project as well. The FM scales&amp;nbsp;are:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;requiredSpeed&lt;/STRONG&gt; .... Real type transformation: Linear: a = &lt;STRONG&gt;SPEED_SCALE &lt;/STRONG&gt;= 10,000; b = 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;actualSpeed&lt;/STRONG&gt; ....... Signed int, Size = 4, Show as: REAL, Bit fields maks with: word (0xffff)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;.............................Real type transformation: Linear: a = &lt;STRONG&gt;SPEED_SCALE&lt;/STRONG&gt; / 32767.0 = 0.3051851; b = 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, let's have a look on the resolution:&lt;/P&gt;&lt;P&gt;At the full speed, if one period changes by 1 tick, then you'll get the &lt;STRONG&gt;period6ZC&lt;/STRONG&gt; from 780 to 781, which makes 12.8041 RPM difference. The higher the &lt;STRONG&gt;SPEED_SCALE&lt;/STRONG&gt; is, the higher the error is. If the assumption would be a change in all of the 6 periods (thus the &lt;STRONG&gt;period6ZC&lt;/STRONG&gt; would change from 780 to 786), the resulting change to the speed would be 76.336 RPM. That makes the speed error 10,000 RPM +- 76, which is 0.76%&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe this would make it clear. Please adjust the steps according to your case.&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>Tue, 30 Jan 2018 13:04:50 GMT</pubDate>
    <dc:creator>pachamatej</dc:creator>
    <dc:date>2018-01-30T13:04:50Z</dc:date>
    <item>
      <title>about using AN5201SW by S12ZVM12EVB</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/about-using-AN5201SW-by-S12ZVM12EVB/m-p/762331#M15265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi I'm subin Kim.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to simulate my 6-pole pairs BLDC motor&amp;nbsp;by using AN5201SW.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But in application SW there are&amp;nbsp;just 2 or 4-pole pairs motor SCALING factors(HIGH_SPEED_SCALING / LOW_SPEED_SCALING).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I moderate these codes for my motor and Can you explain how are these factors are made?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jan 2018 02:38:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/about-using-AN5201SW-by-S12ZVM12EVB/m-p/762331#M15265</guid>
      <dc:creator>subinkim</dc:creator>
      <dc:date>2018-01-29T02:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: about using AN5201SW by S12ZVM12EVB</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/about-using-AN5201SW-by-S12ZVM12EVB/m-p/762332#M15266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello SuBin Kim,&lt;/P&gt;&lt;P&gt;I'm not the author of the code, but let's walk through the calculation:&lt;/P&gt;&lt;P&gt;The motor speed is calculated based on the zero-cross detection of BEMF voltage on a non-active phase. These zero-cross events times are measured by capturing the TIM0CNT register at the time the ADC routine detects a zero-cross.&lt;/P&gt;&lt;P&gt;That means, the time is scaled by the TIM0 settings.&lt;/P&gt;&lt;P&gt;In the application, the zero-cross periods are captured with&amp;nbsp;&lt;STRONG&gt;periodZC_F_PhA,&amp;nbsp;periodZC_R_PhA&lt;/STRONG&gt;, etc., which are defined as tU16 (16 bit unsigned). To calculate one "electric" revolution of a motor = 6 commutations (or 6 zero-crosses), 6 periods&amp;nbsp;are summed.&amp;nbsp;For that case, the "&lt;STRONG&gt;period6ZC&lt;/STRONG&gt;" is defined, formated as tU32 (or unsigned long) to prevent an overflow if all 6 zero-cross periods are summed.&lt;/P&gt;&lt;P&gt;If you sum all the 6 zero-cross periods, you'll get the time per single "electric" revolution. That means, if the motor is 2-pole motor (1 pole-pair motor), it would be the time per single "mechanical" revolution of the rotor. You can easily get the time&amp;nbsp;per mechanical revolution for higher-pole motor simply by multipling it by number of pole-pairs.&lt;/P&gt;&lt;P&gt;Let's get back to the code: the period per 6 zero-crosses&amp;nbsp;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;period6ZC&lt;/STRONG&gt;"&lt;SPAN&gt;&amp;nbsp;is calculated on the line 813, within the 1 ms timer interrupt routine. Since the speed (rotor frequency) is just an inverted time period, it is calculated using line 814:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;actualSpeed = SPEED_CALC_NUMERATOR / period6ZC;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Now, how to read it's scale? Let's assume the "&lt;STRONG&gt;actualSpeed&lt;/STRONG&gt;" is&amp;nbsp;tFrac32 (1.31 formated signed 32bit number). It would mean the maximal fraction number is 1.0, which is&amp;nbsp;&amp;nbsp;2^31 = 2,147,483,648.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The task is to find the &lt;STRONG&gt;SPEED_CALC_NUMERATOR&lt;/STRONG&gt; for which the &lt;STRONG&gt;period6ZC&lt;/STRONG&gt; gives the number above.&lt;/P&gt;&lt;P&gt;Considering the timer TIM0 prescaler is set to 16 (TIM0TSCR2_PR = 4) and the bus clock is 12.5MHz, the timer tick is 12.5MHz / 16 = 781.25 kHz, which is 1.28us.&lt;/P&gt;&lt;P&gt;Let's assume the maximum mechanical speed of the motor is 10,000 RPM and the motor is 6-pole-pair. That would give us 10000/(60 seconds) =&amp;nbsp;166.67&amp;nbsp;revolutions per second, 166.67*(6 pole-pairs) = 1000 electrical revolutions per second, so 1000 * (6 commutations) = 6000 commutations/zero-crosses per second. That would make 1/6000 = 167.67us per one commutation. With our 1.28us timer, we can catch upto&amp;nbsp;130.28 periods at maximal speed.&lt;/P&gt;&lt;P&gt;For maximal speed, we can simply rearrange the "&lt;STRONG&gt;actualSpeed&lt;/STRONG&gt;" calulation, assuming that:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;actualSpeed&amp;nbsp;&lt;/STRONG&gt;= FRAC32(1.0) =&amp;nbsp;2,147,483,648&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;period6ZC&lt;/STRONG&gt; = 6 periods * 130 = 780&amp;nbsp;(rounded down, since the value is still an integer)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Well, the important information is hidden in the casting of the &lt;STRONG&gt;actualSpeed&lt;/STRONG&gt; from Frac32 to Frac16&amp;nbsp;at line 816:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;speedErr = requiredSpeed - (tFrac16) actualSpeed;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;That means, only the lower 16 bits are considered the speed. Therefore, for maximum speed, the "&lt;STRONG&gt;actualSpeed&lt;/STRONG&gt;" = 32767.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;32767&amp;nbsp;=&amp;nbsp;SPEED_CALC_NUMERATOR&amp;nbsp;/&amp;nbsp;780&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;SPEED_CALC_NUMERATOR&amp;nbsp; = 780 * 32767 = 25558260&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thus&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;#define&amp;nbsp;SPEED_CALC_NUMERATOR&amp;nbsp;25558260&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Using the equation from the line 814, the speed would be:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;actualSpeed&lt;/STRONG&gt; = &lt;STRONG&gt;SPEED_CALC_NUMERATOR&lt;/STRONG&gt; / &lt;STRONG&gt;period6ZC&lt;/STRONG&gt; =&amp;nbsp;25558260 / 780 = 32,767;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Masking that value by lower 15 bits and casting it as tFrac16 would make it fit the max speed range of 10,000 RPM.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;RealScaleSpeedRPM&lt;/STRONG&gt; =&amp;nbsp;&lt;STRONG&gt;actualSpeed&lt;/STRONG&gt; / 32,767 * &lt;STRONG&gt;MAX_SPEED&lt;/STRONG&gt; = &lt;STRONG&gt;actualSpeed&lt;/STRONG&gt; / 32,767 * 10,000.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If the speed scale is calculated like this, it should be reflected in the command constants as well:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;#define SPEED_SCALE 10000.0&amp;nbsp; // Used for correct calculation of the following:
#define REQUIRED_RUN_SPEED FRAC16(2000.0/SPEED_SCALE) // 2000 rpm
#define MIN_SPEED FRAC16(500.0/SPEED_SCALE) // 500 rpm minimal speed for Down button control (should be min 10% of nominal motor speed)
#define MAX_SPEED FRAC16(5000.0/SPEED_SCALE) // 5 krpm maximum speed for Up button control
#define SPEED_STEP FRAC16(100.0/SPEED_SCALE) // 100 rpm, Up/Down step for button controls&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;These scales shall&amp;nbsp;be updated in the FreeMASTER project as well. The FM scales&amp;nbsp;are:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;requiredSpeed&lt;/STRONG&gt; .... Real type transformation: Linear: a = &lt;STRONG&gt;SPEED_SCALE &lt;/STRONG&gt;= 10,000; b = 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;actualSpeed&lt;/STRONG&gt; ....... Signed int, Size = 4, Show as: REAL, Bit fields maks with: word (0xffff)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;.............................Real type transformation: Linear: a = &lt;STRONG&gt;SPEED_SCALE&lt;/STRONG&gt; / 32767.0 = 0.3051851; b = 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, let's have a look on the resolution:&lt;/P&gt;&lt;P&gt;At the full speed, if one period changes by 1 tick, then you'll get the &lt;STRONG&gt;period6ZC&lt;/STRONG&gt; from 780 to 781, which makes 12.8041 RPM difference. The higher the &lt;STRONG&gt;SPEED_SCALE&lt;/STRONG&gt; is, the higher the error is. If the assumption would be a change in all of the 6 periods (thus the &lt;STRONG&gt;period6ZC&lt;/STRONG&gt; would change from 780 to 786), the resulting change to the speed would be 76.336 RPM. That makes the speed error 10,000 RPM +- 76, which is 0.76%&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe this would make it clear. Please adjust the steps according to your case.&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>Tue, 30 Jan 2018 13:04:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/about-using-AN5201SW-by-S12ZVM12EVB/m-p/762332#M15266</guid>
      <dc:creator>pachamatej</dc:creator>
      <dc:date>2018-01-30T13:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: about using AN5201SW by S12ZVM12EVB</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/about-using-AN5201SW-by-S12ZVM12EVB/m-p/762333#M15267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have realized that it would be better to keep this in a single document rather than letting it fade in the history of questions. So I did one, based on this answer and the link is this:&amp;nbsp;&lt;A href="https://community.nxp.com/docs/DOC-340132"&gt;https://community.nxp.com/docs/DOC-340132&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jan 2018 11:40:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/about-using-AN5201SW-by-S12ZVM12EVB/m-p/762333#M15267</guid>
      <dc:creator>pachamatej</dc:creator>
      <dc:date>2018-01-31T11:40:10Z</dc:date>
    </item>
  </channel>
</rss>

