<?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 arm_rms_q15 in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/arm-rms-q15/m-p/178970#M1653</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; I'm in fixed-point trouble... I'm using the DSP on a twr-k60n512, here is what i wrote:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// define some values:&lt;/P&gt;&lt;P&gt;#define VECTOR_SIZE 40&lt;/P&gt;&lt;P&gt;float32_t inputU[VECTOR_SIZE] = {0.909663738089 ,&amp;nbsp; 0.169819655916 ,&amp;nbsp; 0.268918462228 ,&amp;nbsp; 0.405608980659 ,&amp;nbsp; 0.694552034332 ,&amp;nbsp; 0.213238658369 ,&amp;nbsp; 0.746090714595 ,&amp;nbsp; 0.146591804815 ,&amp;nbsp; 0.581591611035 ,&amp;nbsp; 0.00824751271313 ,&amp;nbsp; 0.815848907608 ,&amp;nbsp; 0.28001570888 ,&amp;nbsp; 0.459783555723 ,&amp;nbsp; 0.251290291806 ,&amp;nbsp; 0.677502043376 ,&amp;nbsp; 0.80253906042 ,&amp;nbsp; 0.817930529136 ,&amp;nbsp; 0.968525553535 ,&amp;nbsp; 0.428420247333 ,&amp;nbsp; 0.256734208324 ,&amp;nbsp; 0.62360547369 ,&amp;nbsp; 0.294399769527 ,&amp;nbsp; 0.56524282032 ,&amp;nbsp; 0.228892907349 ,&amp;nbsp; 0.00193085195605 ,&amp;nbsp; 0.906498765728 ,&amp;nbsp; 0.754109326089 ,&amp;nbsp; 0.347481953721 ,&amp;nbsp; 0.616133190588 ,&amp;nbsp; 0.7399958052 ,&amp;nbsp; 0.898959525768 ,&amp;nbsp; 0.849186403099 ,&amp;nbsp; 0.219555894784 ,&amp;nbsp; 0.635015634272 ,&amp;nbsp; 0.0762971785054 ,&amp;nbsp; 0.0306477419895 ,&amp;nbsp; 0.490306877931 ,&amp;nbsp; 0.954647274336 ,&amp;nbsp; 0.765811989471};&lt;BR /&gt;q15_t qinputU[VECTOR_SIZE];&lt;BR /&gt;arm_float_to_q15(inputU, qinputU, VECTOR_SIZE);&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Then, I used the arm_mult_q15 and arm_mean_q15 functions and the results were correct, but when I try:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;q15_t urms;&lt;/P&gt;&lt;P&gt;arm_rms_q15(inputU, VECTOR_SIZE, &amp;amp;urms);&lt;/P&gt;&lt;P&gt;float32_t display;&lt;/P&gt;&lt;P&gt;arm_q15_to_float(&amp;amp;urms, &amp;amp;display, 1);&lt;BR /&gt;printf("urms = %f\n", display);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It outputs rms = 0.277112, but it should be around 0.588939 (from my python script which I'm quite sure is correct).&lt;BR /&gt;&lt;BR /&gt;What do you think ? Is there a problem with this arm_rms_q15 function or I'm doing something wrong ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;Emilien&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Jul 2012 16:44:34 GMT</pubDate>
    <dc:creator>emilien</dc:creator>
    <dc:date>2012-07-12T16:44:34Z</dc:date>
    <item>
      <title>arm_rms_q15</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/arm-rms-q15/m-p/178970#M1653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; I'm in fixed-point trouble... I'm using the DSP on a twr-k60n512, here is what i wrote:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// define some values:&lt;/P&gt;&lt;P&gt;#define VECTOR_SIZE 40&lt;/P&gt;&lt;P&gt;float32_t inputU[VECTOR_SIZE] = {0.909663738089 ,&amp;nbsp; 0.169819655916 ,&amp;nbsp; 0.268918462228 ,&amp;nbsp; 0.405608980659 ,&amp;nbsp; 0.694552034332 ,&amp;nbsp; 0.213238658369 ,&amp;nbsp; 0.746090714595 ,&amp;nbsp; 0.146591804815 ,&amp;nbsp; 0.581591611035 ,&amp;nbsp; 0.00824751271313 ,&amp;nbsp; 0.815848907608 ,&amp;nbsp; 0.28001570888 ,&amp;nbsp; 0.459783555723 ,&amp;nbsp; 0.251290291806 ,&amp;nbsp; 0.677502043376 ,&amp;nbsp; 0.80253906042 ,&amp;nbsp; 0.817930529136 ,&amp;nbsp; 0.968525553535 ,&amp;nbsp; 0.428420247333 ,&amp;nbsp; 0.256734208324 ,&amp;nbsp; 0.62360547369 ,&amp;nbsp; 0.294399769527 ,&amp;nbsp; 0.56524282032 ,&amp;nbsp; 0.228892907349 ,&amp;nbsp; 0.00193085195605 ,&amp;nbsp; 0.906498765728 ,&amp;nbsp; 0.754109326089 ,&amp;nbsp; 0.347481953721 ,&amp;nbsp; 0.616133190588 ,&amp;nbsp; 0.7399958052 ,&amp;nbsp; 0.898959525768 ,&amp;nbsp; 0.849186403099 ,&amp;nbsp; 0.219555894784 ,&amp;nbsp; 0.635015634272 ,&amp;nbsp; 0.0762971785054 ,&amp;nbsp; 0.0306477419895 ,&amp;nbsp; 0.490306877931 ,&amp;nbsp; 0.954647274336 ,&amp;nbsp; 0.765811989471};&lt;BR /&gt;q15_t qinputU[VECTOR_SIZE];&lt;BR /&gt;arm_float_to_q15(inputU, qinputU, VECTOR_SIZE);&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Then, I used the arm_mult_q15 and arm_mean_q15 functions and the results were correct, but when I try:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;q15_t urms;&lt;/P&gt;&lt;P&gt;arm_rms_q15(inputU, VECTOR_SIZE, &amp;amp;urms);&lt;/P&gt;&lt;P&gt;float32_t display;&lt;/P&gt;&lt;P&gt;arm_q15_to_float(&amp;amp;urms, &amp;amp;display, 1);&lt;BR /&gt;printf("urms = %f\n", display);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It outputs rms = 0.277112, but it should be around 0.588939 (from my python script which I'm quite sure is correct).&lt;BR /&gt;&lt;BR /&gt;What do you think ? Is there a problem with this arm_rms_q15 function or I'm doing something wrong ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;Emilien&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2012 16:44:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/arm-rms-q15/m-p/178970#M1653</guid>
      <dc:creator>emilien</dc:creator>
      <dc:date>2012-07-12T16:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: arm_rms_q15</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/arm-rms-q15/m-p/178971#M1654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, if I do this instead:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arm_mult_q15(inputU, inputU, temp, VECTOR_SIZE);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; q15_t ums;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arm_mean_q15(temp, VECTOR_SIZE, &amp;amp;ums);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arm_sqrt_q15(ums, &amp;amp;urms);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then it works... but I would prefer using the provided rms function, if somoene figures out what's wrong with it please let me know : )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2012 17:06:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/arm-rms-q15/m-p/178971#M1654</guid>
      <dc:creator>emilien</dc:creator>
      <dc:date>2012-07-12T17:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: arm_rms_q15</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/arm-rms-q15/m-p/178972#M1655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try to align your inputU array as your working method doesn't need it, but your prefered method does since the rms function uses __SIMD32 followed by __SMLALD to speed things up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#pragma data_alignment=8&lt;/P&gt;&lt;P&gt;q15_t inputU[VECTOR_SIZE];&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jul 2012 06:51:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/arm-rms-q15/m-p/178972#M1655</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2012-07-13T06:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: arm_rms_q15</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/arm-rms-q15/m-p/178973#M1656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Thanks for the help, my arrays are 8 bytes aligned with or without the pragma instruction, but the arm_rms_q15 still gives an erroneous result : /, any ideas left?&lt;/P&gt;&lt;P&gt;Moreover I have another question about the arm_mult_q15 function: I can see it outputs a vector of q15_t values, what if I want a vector of q31_t values instead ? (Multiplying two q1.15 values should output a q2.30 value isnt'it ?).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jul 2012 15:25:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/arm-rms-q15/m-p/178973#M1656</guid>
      <dc:creator>emilien</dc:creator>
      <dc:date>2012-07-13T15:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: arm_rms_q15</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/arm-rms-q15/m-p/178974#M1657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The mixed bag of Q formatted outputs is one of the reasons the CMSIS is a bit lacking. &amp;nbsp;Most DSP cores will contain both a fixed point multiply that recovers the radix point&amp;nbsp;(Q31 = Q15 x Q15 &amp;lt;&amp;lt; 1)&amp;nbsp;and an integer multiply which does not need to recover the radix. &amp;nbsp;If you need Q31 results, you have to either convert your data to Q31 values (memory wasteful or cycles wasted moving data) or write you own version of a function which is rather easy, but takes some tweaks to get the performance required at times. &amp;nbsp;The arm_mult_q15 extracts the Q15 value from a Q2.30 value with saturation, but the rms functions doesn't extract and saturate until preparing for the mean divide before the squareroot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Aligning all the radix points is something that I've had to adjust to with the CMSIS. &amp;nbsp;But, the FFT functions are probably the biggest hurdle I've ran across thus far since they skip 128 point optimized capability. &amp;nbsp;Not having complex filters is another hugely missing feature.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I get a chance, I'll put your data through a test and see if anything jumps out at me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jul 2012 20:50:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/arm-rms-q15/m-p/178974#M1657</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2012-07-13T20:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: arm_rms_q15</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/arm-rms-q15/m-p/178975#M1658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok. there is a bug in arm_rms_q15 that saturates the sum before dividing for the mean...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;00107 /* Truncating and saturating the accumulator to 1.15 format */00108 sum = __SSAT((q31_t) (sum &amp;gt;&amp;gt; 15), 16);00109 00110 in1 = (q15_t) (sum / blockSize);00111 00112 /* Store the result in the destination */00113 arm_sqrt_q15(in1, pResult);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;00136 /* Truncating and saturating the accumulator to 1.15 format */00137 sum = __SSAT((q31_t) (sum &amp;gt;&amp;gt; 15), 16);00138 00139 in = (q15_t) (sum / blockSize);00140 00141 /* Store the result in the destination */00142 arm_sqrt_q15(in, pResult);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;should be changed to this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    /* Truncating and saturating the accumulator to 1.15 format */    in = (q31_t) (sum &amp;gt;&amp;gt; 15);    in1 = __SSAT((in / blockSize), 16);    /* Store the result in the destination */    arm_sqrt_q15(in1, pResult);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, I noticed your vector is one value short of 40 values.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:28:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/arm-rms-q15/m-p/178975#M1658</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2020-10-29T09:28:12Z</dc:date>
    </item>
    <item>
      <title>Re: arm_rms_q15</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/arm-rms-q15/m-p/178976#M1659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; It works now. I also rewrote the mult and rms functions so that it can output a q1.31 result: for example I did this, which seems to output a correct result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; q31_t in;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; in = __SSAT(((sum / blockSize) &amp;lt;&amp;lt; 1), 32);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arm_sqrt_q31(in, pResult);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the rms function is really faster than using mult, then mean, then sqrt : )&lt;/P&gt;&lt;P&gt;Many thanks for the bug fix.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jul 2012 15:36:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/arm-rms-q15/m-p/178976#M1659</guid>
      <dc:creator>emilien</dc:creator>
      <dc:date>2012-07-16T15:36:47Z</dc:date>
    </item>
  </channel>
</rss>

