<?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 Resolver project, Matlab library set for MPC 5748G in S32 Design Studio</title>
    <link>https://community.nxp.com/t5/S32-Design-Studio/Resolver-project-Matlab-library-set-for-MPC-5748G/m-p/1133334#M6736</link>
    <description>&lt;P&gt;I'm trying to use MPC5748G for my Resolver-to-Digital-Converter project. Basically reading the Sin and Cos waveform from the resolver of DC motor by ADC module, and calculate the angle by Atan of (sin/cos). I'm also planning to implement PI control and FIR filter later, so I choose to use Matlab library set. Then I have the problems as below.&lt;/P&gt;&lt;P&gt;There are two types of functions available in the Matlab library, which are "GFLIB_Atan" and "GFLIB_AtanYX". This time I use "GFLIB_Atan_F16" as an example:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;tFrac16 GFLIB_Atan_F16(tFrac16 f16In, const GFLIB_ATAN_T_F16&amp;nbsp;*const pParam);&lt;/P&gt;&lt;P&gt;where the input "f16In" range is [0,1). When I physically connected the resolver to the board, the result of this function remains unchanged. The reason causes the problem is the quotient of 2 ADC readout is always greater than 1, and it causes saturation(at lease this is what I saw in the Expressions windows when I pause). While EWL_C library doesn't have such this issue, but&amp;nbsp;AMMCLIB and EWL_C can not use together. Does anyone have a solution?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void ADC1_Read_Chan (void) { /* Read conversion results */&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Result_sin= ADC_1.CDR[8].B.CDATA; /* Read channel 9 conversion result data ; channel 8 -&amp;gt;PD8 */&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Result_cos= ADC_1.CDR[7].B.CDATA; /* PD[7] */&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;while(1) {&lt;BR /&gt;if (ADC_1.ISR.B.ECH) { /* If normal scan channels finished converting */&lt;BR /&gt;&amp;nbsp; &amp;nbsp; ADC1_Read_Chan(); /* Read conversion Results */&lt;BR /&gt;&amp;nbsp; &amp;nbsp; f16Input1 = (tFrac16)(Result_sin);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; f16Input2 = (tFrac16)(Result_cos);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; f16Angle = GFLIB_Atan_F16(f16Input1/f16Input2,GFLIB_ATAN_DEFAULT_F16);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; ADC_1.ISR.R = 0x00000001; /* Clear End of CHain (ECH) status bit */&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 01 Sep 2020 20:28:07 GMT</pubDate>
    <dc:creator>jzhang1</dc:creator>
    <dc:date>2020-09-01T20:28:07Z</dc:date>
    <item>
      <title>Resolver project, Matlab library set for MPC 5748G</title>
      <link>https://community.nxp.com/t5/S32-Design-Studio/Resolver-project-Matlab-library-set-for-MPC-5748G/m-p/1133334#M6736</link>
      <description>&lt;P&gt;I'm trying to use MPC5748G for my Resolver-to-Digital-Converter project. Basically reading the Sin and Cos waveform from the resolver of DC motor by ADC module, and calculate the angle by Atan of (sin/cos). I'm also planning to implement PI control and FIR filter later, so I choose to use Matlab library set. Then I have the problems as below.&lt;/P&gt;&lt;P&gt;There are two types of functions available in the Matlab library, which are "GFLIB_Atan" and "GFLIB_AtanYX". This time I use "GFLIB_Atan_F16" as an example:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;tFrac16 GFLIB_Atan_F16(tFrac16 f16In, const GFLIB_ATAN_T_F16&amp;nbsp;*const pParam);&lt;/P&gt;&lt;P&gt;where the input "f16In" range is [0,1). When I physically connected the resolver to the board, the result of this function remains unchanged. The reason causes the problem is the quotient of 2 ADC readout is always greater than 1, and it causes saturation(at lease this is what I saw in the Expressions windows when I pause). While EWL_C library doesn't have such this issue, but&amp;nbsp;AMMCLIB and EWL_C can not use together. Does anyone have a solution?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void ADC1_Read_Chan (void) { /* Read conversion results */&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Result_sin= ADC_1.CDR[8].B.CDATA; /* Read channel 9 conversion result data ; channel 8 -&amp;gt;PD8 */&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Result_cos= ADC_1.CDR[7].B.CDATA; /* PD[7] */&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;while(1) {&lt;BR /&gt;if (ADC_1.ISR.B.ECH) { /* If normal scan channels finished converting */&lt;BR /&gt;&amp;nbsp; &amp;nbsp; ADC1_Read_Chan(); /* Read conversion Results */&lt;BR /&gt;&amp;nbsp; &amp;nbsp; f16Input1 = (tFrac16)(Result_sin);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; f16Input2 = (tFrac16)(Result_cos);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; f16Angle = GFLIB_Atan_F16(f16Input1/f16Input2,GFLIB_ATAN_DEFAULT_F16);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; ADC_1.ISR.R = 0x00000001; /* Clear End of CHain (ECH) status bit */&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2020 20:28:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-Design-Studio/Resolver-project-Matlab-library-set-for-MPC-5748G/m-p/1133334#M6736</guid>
      <dc:creator>jzhang1</dc:creator>
      <dc:date>2020-09-01T20:28:07Z</dc:date>
    </item>
  </channel>
</rss>

