<?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 Re: S12ZVM BLDC Adc Problem in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12ZVM-BLDC-Adc-Problem/m-p/835831#M15987</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;the answer is not so simple.&lt;/P&gt;&lt;P&gt;The thing is, the BLDC motor control is a combination of synchronous events (driven by the PWM switching) and asynchronous commutation (driven by the hall sensors or backEMF zero-crossing events). Therefore, at certain points, the ADC acquisition may be aborted in order to re-schedule and restart the PWM-PTU-ADC chain once the asynchronous commutation event occurs.&lt;/P&gt;&lt;P&gt;Once the concerns about the sample timing and asynchronous conversion abort are discussed and resolved, there are several steps to do:&lt;/P&gt;&lt;P&gt;- The ADC triggers are programmed using the&amp;nbsp;PTUTriggerEventList. There are two sub-lists, one for ADC0 - PTUTriggerEventList[0], the other one for ADC1 -&amp;nbsp;PTUTriggerEventList[1]. The delays between the LOADOK and the triggers is not fixed and is moving with the PWM edges - updated within&amp;nbsp;void UpdateDutycycle(void). Any subsequent trigger needs to be placed after the last trigger in the list with an additional delay (to let the ADC channel complete the conversion and be prepared for the next conversion - approx. 2.5 us). This means, that any additional trigger delay would change every time the previous trigger delays are changed. The easiest way would be to define a delay between the last BLDC-related and your custom sample trigger "&lt;SPAN&gt;myDelay"&lt;/SPAN&gt; and then simply do something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PTUTriggerEventList[0][0][2] = &lt;SPAN&gt;PTUTriggerEventList[0][0][&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;] + myDelay&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- The ADC commands have to be programmed, matching the trigger. In other words - every single non-zero trigger should have corresponding non-void ADC command record and also ADC result register value.&lt;/P&gt;&lt;P&gt;- the program should consider that the sampling might be aborted and that the value might not be available periodically (e.g. when the commutation event overlaps with the PWM&amp;nbsp;edge).&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>Thu, 04 Oct 2018 11:06:27 GMT</pubDate>
    <dc:creator>pachamatej</dc:creator>
    <dc:date>2018-10-04T11:06:27Z</dc:date>
    <item>
      <title>S12ZVM BLDC Adc Problem</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12ZVM-BLDC-Adc-Problem/m-p/835830#M15986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi，I use AN4718SW develop BLDC.Now the motor can run well. But I have a problem about ADC sample.&lt;/P&gt;&lt;P&gt;Based on AN4718SW demo, I can sample DC current , DC voltage , phase voltage , but beside these analog&lt;/P&gt;&lt;P&gt;input, I want to sample fouth&amp;nbsp;analog input. I tried a lot of&amp;nbsp; manners , but all failed . I read the demo AN5168SW&lt;/P&gt;&lt;P&gt;, but it is&amp;nbsp;different from AN4718SW. could you tell me how to sample the fouth or the fifth&amp;nbsp;analog input? based&lt;/P&gt;&lt;P&gt;on AN4718SW. Thanks very much.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Sep 2018 06:43:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12ZVM-BLDC-Adc-Problem/m-p/835830#M15986</guid>
      <dc:creator>dmeng1</dc:creator>
      <dc:date>2018-09-18T06:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: S12ZVM BLDC Adc Problem</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12ZVM-BLDC-Adc-Problem/m-p/835831#M15987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;the answer is not so simple.&lt;/P&gt;&lt;P&gt;The thing is, the BLDC motor control is a combination of synchronous events (driven by the PWM switching) and asynchronous commutation (driven by the hall sensors or backEMF zero-crossing events). Therefore, at certain points, the ADC acquisition may be aborted in order to re-schedule and restart the PWM-PTU-ADC chain once the asynchronous commutation event occurs.&lt;/P&gt;&lt;P&gt;Once the concerns about the sample timing and asynchronous conversion abort are discussed and resolved, there are several steps to do:&lt;/P&gt;&lt;P&gt;- The ADC triggers are programmed using the&amp;nbsp;PTUTriggerEventList. There are two sub-lists, one for ADC0 - PTUTriggerEventList[0], the other one for ADC1 -&amp;nbsp;PTUTriggerEventList[1]. The delays between the LOADOK and the triggers is not fixed and is moving with the PWM edges - updated within&amp;nbsp;void UpdateDutycycle(void). Any subsequent trigger needs to be placed after the last trigger in the list with an additional delay (to let the ADC channel complete the conversion and be prepared for the next conversion - approx. 2.5 us). This means, that any additional trigger delay would change every time the previous trigger delays are changed. The easiest way would be to define a delay between the last BLDC-related and your custom sample trigger "&lt;SPAN&gt;myDelay"&lt;/SPAN&gt; and then simply do something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PTUTriggerEventList[0][0][2] = &lt;SPAN&gt;PTUTriggerEventList[0][0][&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;] + myDelay&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- The ADC commands have to be programmed, matching the trigger. In other words - every single non-zero trigger should have corresponding non-void ADC command record and also ADC result register value.&lt;/P&gt;&lt;P&gt;- the program should consider that the sampling might be aborted and that the value might not be available periodically (e.g. when the commutation event overlaps with the PWM&amp;nbsp;edge).&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>Thu, 04 Oct 2018 11:06:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12ZVM-BLDC-Adc-Problem/m-p/835831#M15987</guid>
      <dc:creator>pachamatej</dc:creator>
      <dc:date>2018-10-04T11:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: S12ZVM BLDC Adc Problem</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12ZVM-BLDC-Adc-Problem/m-p/835832#M15988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear matej:&lt;/P&gt;&lt;P&gt;Thanks very much for your replay. I am not very clear about your explain.but I tried another way to solve the problem.&lt;/P&gt;&lt;P&gt;I just modify the array&amp;nbsp;&lt;SPAN&gt;ADC0CommandList. like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;volatile char ADC0CommandList[6][4] =&lt;BR /&gt;{&lt;BR /&gt; {0x40,0xD0,0x00,0x00}, // end of sequence + int [41], current sense channel [D0], 4 clock cycles sample time [00],&lt;BR /&gt; &lt;STRONG&gt;&lt;EM&gt;{0x00,0xCB,0x00,0x00}, // end of list + no int [C0], HD voltage [CB], 4 clock cycles sample time [00]&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt; {0xC0,0xC8,0x00,0x00},&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt; {0x00,0x00,0x00,0x00},&lt;BR /&gt; {0x00,0x00,0x00,0x00},&lt;BR /&gt; {0x00,0x00,0x00,0x00}&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;and then I read the&amp;nbsp;ADC0ResultList[2] value in ADC0done_ISR. and motor can run normal.&lt;/P&gt;&lt;P&gt;besides I didn't change anything.&lt;/P&gt;&lt;P&gt;I can read the value from&amp;nbsp;&lt;SPAN&gt;ADC0ResultList[2]&amp;nbsp;.but I don't know if&amp;nbsp;I am right .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;could you tell me if I can modify the program like this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f;"&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f;"&gt;David&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Oct 2018 07:27:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12ZVM-BLDC-Adc-Problem/m-p/835832#M15988</guid>
      <dc:creator>dmeng1</dc:creator>
      <dc:date>2018-10-08T07:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: S12ZVM BLDC Adc Problem</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12ZVM-BLDC-Adc-Problem/m-p/835833#M15989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;it seems ok to me, the 0x00 command at the second line says "normal conversion", thus the 0xCB (HD pin voltage) is measured first and then the 0xC8 (internal temperature sensor) is measured as a part of this sequence. This way it will work. In case you need to set precise timing of the ADC sampling for your additional channel (e.g. if it should be synchronized with the PWM signal), please follow my original post.&lt;/P&gt;&lt;P&gt;In any case, just make sure the ADC results array is defined for 6 results according to your example (most probably it is).&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, 10 Oct 2018 06:56:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12ZVM-BLDC-Adc-Problem/m-p/835833#M15989</guid>
      <dc:creator>pachamatej</dc:creator>
      <dc:date>2018-10-10T06:56:23Z</dc:date>
    </item>
    <item>
      <title>Re: S12ZVM BLDC Adc Problem</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12ZVM-BLDC-Adc-Problem/m-p/835834#M15990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;Dear matej:&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;Thanks very very much for your replay. I have success run the motor and sample the fourth ADC data use your method.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Oct 2018 06:45:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12ZVM-BLDC-Adc-Problem/m-p/835834#M15990</guid>
      <dc:creator>dmeng1</dc:creator>
      <dc:date>2018-10-18T06:45:18Z</dc:date>
    </item>
  </channel>
</rss>

