<?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: Module 6: Current Sensing (Part 1/2) in Model-Based Design Toolbox (MBDT)</title>
    <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781047#M2173</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;Having some doubts regarding the current sense.&lt;/P&gt;&lt;P&gt;When using dual shunt current sensing technique, we have 2 current sense resistor at the Phase A and Phase B inverter legs.The 3rd phase current can be calculated in code.&lt;/P&gt;&lt;P&gt;But ,my concern is regarding over current protection.Do we need additional current sense resistor for measuring IDC?&lt;/P&gt;&lt;P&gt;Or is it enough 2 phase currents for external overcurrent detection circuit .&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 05 Feb 2019 05:45:46 GMT</pubDate>
    <dc:creator>reema_thomas</dc:creator>
    <dc:date>2019-02-05T05:45:46Z</dc:date>
    <item>
      <title>Module 6: Current Sensing (Part 1/2)</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781020#M2146</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY&gt;&lt;TR style="height: 455px;"&gt;&lt;TD style="text-align: center; height: 455px;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;IMG alt="pastedImage_1.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49052iF6102957CD4AEB2D/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_1.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: bold; font-size: 30px; color: #333399;"&gt;&lt;STRONG&gt;INTRODUCTION&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;SPAN style="color: #333333; border: 0px; font-weight: inherit;"&gt;In this module of the&amp;nbsp;&lt;/SPAN&gt;&lt;A _jive_internal="true" data-containerid="11546" data-containertype="14" data-content-finding="Community" data-objectid="464336" data-objecttype="1" href="https://community.nxp.com/thread/464336" rel="noopener noreferrer" style="color: #2989c5; background-color: transparent; border: 0px; font-weight: inherit; padding: 1px 0px 1px calc(12px + 0.35ex);" target="_blank"&gt;3-Phase PMSM Control Workshop with NXP's Model-Based Design Toolbox&lt;/A&gt;&lt;SPAN style="color: #333333; border: 0px; font-weight: inherit;"&gt;&amp;nbsp;,&amp;nbsp;we are going to&amp;nbsp;implement and test the most critical part of the digital control system:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;motor phase current measurements&lt;/STRONG&gt;. As we have discussed in&amp;nbsp;&lt;A href="https://community.nxp.com/thread/465280" rel="noopener noreferrer" target="_blank"&gt;Module 2: PMSM and FOC Theory&lt;/A&gt;&amp;nbsp; the quintessence of Field Oriented Control (FOC) is to align the stator current vector with the PMSM rotor Q-axis and the way we can reach that goal is by measuring the actual PMSM phase currents.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;SPAN style="color: #333333; border: 0px; font-weight: inherit;"&gt;Current sensing and measuring&amp;nbsp;are one the most complex task you may have to deal with in&amp;nbsp;the motor control applications since it involve both hardware and software resources. Understanding the hardware that sense the currents and then being able to measure accurately the current values require you to have a good understanding about:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;UL style="text-align: justify;"&gt;&lt;LI style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="color: #333333;"&gt;How the current sensor works and hardware topology&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="border: 0px; font-weight: inherit; margin: 0.2em 0px;"&gt;&lt;SPAN style="color: #333333;"&gt;&lt;SPAN style="font-weight: inherit;"&gt;Delays&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;propagation and their influence on actual measurements&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="border: 0px; font-weight: inherit; margin: 0.2em 0px;"&gt;&lt;SPAN style="color: #333333;"&gt;Synchronization&lt;SPAN style="font-weight: inherit;"&gt;&amp;nbsp;between PWM commands and ADC&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #333333;"&gt;conversions&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="border: 0px; font-weight: inherit; margin: 0.2em 0px;"&gt;&lt;SPAN style="color: #333333; font-weight: inherit;"&gt;Specialized custom hardware features design to improve the overall measurement&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="border: 0px; font-weight: inherit; margin: 0.2em 0px;"&gt;&lt;SPAN style="color: #333333; font-weight: inherit;"&gt;Hardware interrupts and trigger events&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="border: 0px; font-weight: inherit; margin: 0.2em 0px;"&gt;&lt;SPAN style="color: #333333;"&gt;&lt;SPAN style="font-weight: inherit;"&gt;Software data processing and parameters&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;calculation&lt;SPAN style="font-weight: inherit;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P style="text-align: justify;"&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;&lt;SPAN style="color: #333333; font-weight: inherit;"&gt;In the next sections we are going to discuss one by one in details each of these topics. Even if the focus of the article is on S32K14x product family, most of the information provided is generic and applicable to any other digital control system the main difference being the actual Simulink implementation.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;&lt;SPAN style="color: #333333;"&gt;In Fig. 1, which represent the global application mapping diagram as discussed in&lt;/SPAN&gt;&amp;nbsp;&lt;A _jive_internal="true" data-containerid="11546" data-containertype="14" data-content-finding="Community" data-objectid="465758" data-objecttype="1" href="https://community.nxp.com/thread/465758" rel="noopener noreferrer" style="color: #5e89c1; background-color: transparent; border: 0px; font-weight: inherit; padding: 1px 0px 1px calc(12px + 0.35ex);" target="_blank"&gt;Module 3: System Partitioning&lt;/A&gt;&amp;nbsp;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #333333;"&gt;are shown the main hardware blocks that are going to be configured for PMSM phase currents measurement. We are going to reuse the model developed in&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.nxp.com/thread/467938" rel="noopener noreferrer" target="_blank"&gt;Module 5: V/F Scalar Control&lt;/A&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #333333;"&gt;which will allow us to test the measurement technique in dynamic regime.&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: transparent; border: 0px; font-weight: inherit; color: #333333;"&gt;The interactions between host PC and hardware will be done via OpenSDA serial communication that will be used to download the code generated from MATLAB and to visualize various control signals with FreeMASTER.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="height: 378px;"&gt;&lt;TD style="text-align: center; height: 378px;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_6.png"&gt;&lt;IMG alt="pastedImage_6.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49083i5842A4C1A3EAC87D/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_6.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 24px;"&gt;&lt;TD style="height: 24px; text-align: center;"&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 13px;"&gt;Fig. 1: Application Mapping -&amp;nbsp; HW &amp;amp; SW modules&amp;nbsp;used for Phase Currents measurement&amp;nbsp;are highlighted in green&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: bold; font-size: 30px; color: #333399;"&gt;&lt;STRONG&gt;CURRENT SENSING METHODS&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;SPAN style="color: #333333;"&gt;&lt;SPAN style="background-color: #ffffff;"&gt;As designers or engineers in the field of power electronics, power supplies, battery management systems, motor drives and many other areas one of the most common faced problem is the need to measure currents accurately. In general the current needs to be measured for&amp;nbsp;&lt;/SPAN&gt;fault protection or functional control. For this application we need to measure the current for three main reasons:&lt;/SPAN&gt;&lt;/P&gt;&lt;UL style="text-align: justify;"&gt;&lt;LI style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="color: #333333;"&gt;Functional - motor control feedback for FOC in order to orient the stator current vector&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="color: #333333;"&gt;Protection - against over-current and short circuit&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="color: #333333;"&gt;Information - about power consumption levels&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;SPAN style="color: #333333;"&gt;In practice, there are four major current sensing&amp;nbsp;methods commonly available. These methods are shown in table below, together with the advantages and disadvantages of each.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6;" width="100%"&gt;&lt;THEAD style="border: inherit solid inherit;"&gt;&lt;TR style="background-color: #efefef; height: 25px;"&gt;&lt;TH style="width: 18%; height: 25px;"&gt;Current Sensing Method&lt;/TH&gt;&lt;TH style="width: 22%; height: 25px;"&gt;Construction&lt;/TH&gt;&lt;TH style="width: 29.5678%; height: 25px;"&gt;Advantages&lt;/TH&gt;&lt;TH style="width: 60.4322%; height: 25px;"&gt;Disadvantages&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 18%; height: 25px;"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;Shunt Resistor&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="width: 22%; height: 25px;"&gt;&lt;P style="text-align: center;"&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;IMG alt="pastedImage_2.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49156i03EC51DADD088082/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_2.png" /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="width: 29.5678%; height: 25px;"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;Low cost;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;Provides good accuracy;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;Wide-band measurements;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="width: 60.4322%; height: 25px;"&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;High power dissipation;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;Not suitable for high current applications;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 18%; height: 25px;"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Conductor&lt;/P&gt;&lt;/TD&gt;&lt;TD style="width: 22%; height: 25px;"&gt;&lt;P style="text-align: center;"&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_3.png"&gt;&lt;IMG alt="pastedImage_3.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49186iBA20B1DA3DFE9992/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_3.png" /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="width: 29.5678%; height: 25px;"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;Small or no-cost can be implemented directly on&amp;nbsp;PCB tracks;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;Reduce BOM;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="width: 60.4322%; height: 25px;"&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;Poor accuracy due temperature variations;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;Need to be&amp;nbsp;precisely calculated from beginning for proper balance between accuracy and power dissipation;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 18%; height: 25px;"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;Hall effect sensor&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="width: 22%; height: 25px;"&gt;&lt;P style="text-align: center;"&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_5.png"&gt;&lt;IMG alt="pastedImage_5.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49187i8456B4AC23EDFD14/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_5.png" /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="width: 29.5678%; height: 25px;"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;Provides galvanic isolation;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;Low power dissipation;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="width: 60.4322%; height: 25px;"&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;High cost;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;Limited bandwidth;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;Needs additional electronic components;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 18%; height: 25px;"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;Current transformer&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="width: 22%; height: 25px;"&gt;&lt;P style="text-align: center;"&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_6.png"&gt;&lt;IMG alt="pastedImage_6.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49237i42F4F5D3F4361A16/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_6.png" /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="width: 29.5678%; height: 25px;"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;Provides galvanic isolation;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;High current sensing capabilities;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="width: 60.4322%; height: 25px;"&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;Large size &amp;amp; mass;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;Works only in AC;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;Requires special hardware to avoid magnetic saturation;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;Magnetic field susceptibility;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;SPAN style="color: #333333;"&gt;Based on the advantages of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;low cost&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;accurate wide-band measurement&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;precision shunt&amp;nbsp;resistors&lt;/STRONG&gt;, are frequently the best answer for most of the applications.&amp;nbsp; In this case,&amp;nbsp;choosing the best resistance R value is a question of balance between accuracy&amp;nbsp;vs. power dissipation.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;SPAN style="color: #333333;"&gt;Shunt resistors works on a simple principle of Ohm Law: I = U/R.&amp;nbsp;If the resistance R it is too high then power (P = I^2*R) will be wasted, excess heat&amp;nbsp; will be generated and the voltage regulation is lost due to change in R value. Consequently, if&amp;nbsp;R is too low then the sense voltage will be correspondingly low, so issues&amp;nbsp;with noise and resolution will limit the accurate measurement of current.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;SPAN style="color: #51626f;"&gt;&lt;SPAN style="color: #333333;"&gt;Another important aspect to consider when dealing with shunt resistors is the parasitic inductances that can cause wrong results. Any shunt resistor contains an inductance component that creates a voltage spike as shown in Fig. 2.&lt;/SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="width: 41.6906%; text-align: center;"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: right;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;IMG alt="pastedImage_1.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49239i5F5EDDB6AAF1584F/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_1.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="width: 55.3094%; text-align: left;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_7.png"&gt;&lt;IMG alt="pastedImage_7.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49240iCC689DAC7C5679B7/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_7.png" /&gt;&lt;/SPAN&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_7.png"&gt;&lt;IMG alt="pastedImage_7.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49244iB89D395536F3102F/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_7.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD colspan="2" style="width: 97%; text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 2: Shunt parasitic inductance effect&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;SPAN style="color: #333333;"&gt;To reduce or eliminate the effect of parasitic inductances, special resistors and PCB layouts are used. The&amp;nbsp;PCB track design around current&amp;nbsp;shunt resistors is critical for obtaining an accurate current sensing. The main difference between dealing with a shunt resistor and a normal resistor is that four rather than two tracks must be provided to form a Kelvin connection, even where the component itself has only two terminals. These 2 additional tracks (V1-V2) that forms the Kelvin connection as shown in Fig. 3 are actually used for measuring the voltage drop across the shunt resistor, which is proportional with the current that needs to be measured.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;SPAN style="color: #333333;"&gt;The scope is to minimize the conductive path shared between the current path and the sensing loop, which would increase the tolerance on temperature variation and reduce the effect of parasitic inductance.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD colspan="2" style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_12.png"&gt;&lt;IMG alt="pastedImage_12.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49249i5A175B42690A68AD/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_12.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD colspan="2" style="text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 3: PCB design used to sense the currents via shunt resistors&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: bold; font-size: 30px; color: #333399;"&gt;&lt;STRONG&gt;CURRENT MEASUREMENT STRATEGY WITH SHUNTS&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;SPAN style="color: #333333; background-color: #ffffff;"&gt;Once the current sensing method is selected, the next step is to define how and where we are going to use the&amp;nbsp;shunt resistors&amp;nbsp;to acquire the information about the current. In motor control applications there are three main strategies that can be employed to accurately measure motor phase currents and the main difference between them is the relative position of the current sensors:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6;" width="100%"&gt;&lt;THEAD style="border: inherit solid inherit;"&gt;&lt;TR style="background-color: #efefef;"&gt;&lt;TH style="width: 19%;"&gt;Current Measurement Strategy&lt;/TH&gt;&lt;TH style="width: 19.0251%;"&gt;Sensor Type&lt;/TH&gt;&lt;TH style="width: 20.9749%;"&gt;Advantages&lt;/TH&gt;&lt;TH style="width: 27%;"&gt;Disadvantages&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="width: 19%;"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Inverter current sensing shunts&lt;/P&gt;&lt;P style="text-align: left;"&gt;(Dual-Shunt technique)&lt;/P&gt;&lt;/TD&gt;&lt;TD style="width: 19.0251%;"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;IMG alt="pastedImage_1.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49252i517B539997D00BA7/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_1.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="width: 20.9749%;"&gt;&lt;P&gt;Less power dissipation since the current is not passing all the time thru it;&lt;/P&gt;&lt;P&gt;Small shunt;&lt;/P&gt;&lt;P&gt;Good balance between cost and PCB area;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="width: 27%;"&gt;&lt;P&gt;Need 3 shunts resistors, one for each phase;&lt;/P&gt;&lt;P&gt;Need to synchronize the readings with the times when lower switches are in conduction&lt;/P&gt;&lt;P&gt;EMI noise due to proximity of inverter switches&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="width: 19%;"&gt;&lt;P&gt;DC-link current sensing shunt&lt;/P&gt;&lt;P&gt;(Single-Shunt technique)&lt;/P&gt;&lt;/TD&gt;&lt;TD style="width: 19.0251%;"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;IMG alt="pastedImage_2.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49253i063D5FDE0DB16722/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_2.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="width: 20.9749%;"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Single shunt needed;&lt;/P&gt;&lt;P&gt;Small area footprint;&lt;/P&gt;&lt;P&gt;BOM optimal&lt;/P&gt;&lt;/TD&gt;&lt;TD style="width: 27%;"&gt;&lt;P&gt;Large power dissipation capabilities&lt;/P&gt;&lt;P&gt;Not suitable for high current applications&lt;/P&gt;&lt;P&gt;Need complex SW to reconstruct the 3 phase currents&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="width: 19%;"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Motor phases current sensing shunts&lt;/P&gt;&lt;/TD&gt;&lt;TD style="width: 19.0251%;"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_3.png"&gt;&lt;IMG alt="pastedImage_3.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49257i60188F7069A6AE30/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_3.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="width: 20.9749%;"&gt;&lt;P&gt;Simplifies SW measuring routines since the current flow is continuously thru the shunt&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can be swapped easily for supporting various current ranges&lt;/P&gt;&lt;/TD&gt;&lt;TD style="width: 27%;"&gt;&lt;P&gt;Very&amp;nbsp;high power dissipation&lt;/P&gt;&lt;P&gt;Large volume&lt;/P&gt;&lt;P&gt;Additional PCB components needed to interface the sensors with the MCU logic&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;The&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://www.nxp.com/support/developer-resources/hardware-development-tools/ultra-reliable-mcus-development-platform/low-cost-motor-control-solution-for-devkit-platform:DEVKIT-MOTORGD" rel="nofollow noopener noreferrer noopener noreferrer" style="color: #2989c5; text-decoration: none;" target="_blank"&gt;MotorGD DevKit&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;comes equipped by default with all that is needed to address the first two use-cases as&amp;nbsp;highlighted in Fig. 4:&lt;/SPAN&gt;&lt;/P&gt;&lt;UL style="padding: 0px 0px 0px 30px;"&gt;&lt;LI style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;SPAN style="color: #4c4c4c;"&gt;Three inverter current sensing shunts, one for each inverter phase. Since in most of the cases the PMSM forms a 3-phase symmetric isolated system instead of sampling all three shunts resistors,&amp;nbsp;you can use only 2 out of 3 to implement the standard PMSM phase current measurements which is also known as&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Dual-Shunt&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;method. The third current can be easily computed in SW since Kirchhoff circuit law states that the sum off all 3 currents is null (Ia + Ib + Ic&amp;nbsp; = 0)&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;SPAN style="color: #4c4c4c;"&gt;One DC-link current sensing shunt that will be mainly used for current protection and power consumption monitoring. The current sensing information from this DC-link shunt can be used for what is called&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Single-Shunt&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;method.&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;IMG alt="pastedImage_1.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49258i40AA32EA952D3C54/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_1.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 4: MotorGD DevKit Current measurement shunt resistors configuration&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: bold; font-size: 30px; color: #333399;"&gt;&lt;STRONG&gt;DUAL-SHUNT SENSING TECHNIQUE&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;&lt;SPAN&gt;Dual-Shunt sensing techniques is one of the most common used method to measure the phase currents in motor control applications. This method have a good balance between advantages and disadvantages being suitable to be implemented in most of the applications. As depicted in Fig. 5, we are going to use the phase A and phase B inverter shunts to measure the voltage drop across the shunt resistor.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;&lt;SPAN&gt;As it is depicted here and as mentioned before, the currents can be measured only when the lower switches are in conduction. Please notice i'm using the general naming convention as switch that incorporates a transistor and a anti-parallel diode. Depending on the load type and the commutation sequence the current may pass thru transistor or diode (for details about this please check:&amp;nbsp;&lt;A href="https://community.nxp.com/thread/466420" rel="noopener noreferrer" target="_blank"&gt;Module 4: Space Vector Modulation&lt;/A&gt;&amp;nbsp;)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_4.png"&gt;&lt;IMG alt="pastedImage_4.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49259i104B586AA14292D5/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_4.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 5: Dual-shunt current measurement topology&amp;nbsp;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE __default_attr="info" __jive_macro_name="alert" alert="info" class="jive_text_macro jive_macro_alert"&gt;&lt;P style="text-align: justify;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;As general assumption, the current that flows into the motor windings (as depicted in Fig. 5 by the current in phase A) will be considered as a positive current. Currents that flows out of the motor windings are considered to be negative current.&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt; &lt;/PRE&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;SPAN style="background-color: #ffffff; color: #4c4c4c;"&gt;Since the shunt is placed in the lower part of the inverter, the voltage potential read from the shunt terminals is negative when the current flows into the motor winding. Therefore this need to be taken into consideration in SW when we are going to read the values from ADC. A negative voltage on the shunt resistor indicates a positive current thru the motor winding.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;SPAN style="background-color: #ffffff; color: #4c4c4c;"&gt;Another important aspect of dual-shunt measurement technique is PWM critical pulse width consideration. Since the ADC acquisition of the shunt voltage drop is done when the lower switch&amp;nbsp;is activated, we need to maintain&amp;nbsp;a minimal PWM command for that transistor in order to measure a relevant information.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;SPAN style="background-color: #ffffff; color: #4c4c4c;"&gt;This critical pulse width as depicted in Fig. 6, is needed for&amp;nbsp;three main reasons:&lt;/SPAN&gt;&lt;/P&gt;&lt;UL style="padding: 0px 0px 0px 30px;"&gt;&lt;LI style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;SPAN style="color: #4c4c4c;"&gt;&lt;STRONG&gt;Voltage drop stabilization&lt;/STRONG&gt;&amp;nbsp;due to load inductance nature of motors. The effect of load inductance can be optimized but it can not be fully eliminated;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;SPAN style="color: #4c4c4c;"&gt;&lt;STRONG&gt;System propagation delays&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;between SW and HW components involved in the process. The delays form a chain that can be reduced by selecting components with fast response time but it can not be fully eliminated;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;SPAN style="color: #4c4c4c;"&gt;&lt;STRONG&gt;ADC sampling and acquisition&amp;nbsp;time&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;can be optimized at design phase but never fully eliminated;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_19.png"&gt;&lt;IMG alt="pastedImage_19.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49261iCA9169C02AFA113D/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_19.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 6: PWM critical pulse width in case of dual-shunt current measurement&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="background-color: #ffffff; color: #4c4c4c;"&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;For a better understanding off all the variables we need to take into consideration lets us have a look at a typical shunt resistor voltage drop in case of a positive current passing thru. For readability, please consider the case of the phase A current measurement as depicted in Fig. 5.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;As it shown in this Fig. 7,oscilloscope capture&amp;nbsp;using the MotorGD DevKit, with cyan we have the 10kHz PWM signal command that controls the lower inverter switch on phase A, while the yellow signal represents the voltage drop on the inverter phase A shunt resistor. When there is no current flowing thru the value of the drop voltage is zero. When the current flows thru the MOSFET the voltage drop as a stable value, while by the time the current flows thru the anti-parallel diode the voltage is slowly going down to zero.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;For more details regarding the current flows thru transistor or diode please check the training video in&amp;nbsp;&lt;A href="https://community.nxp.com/thread/466420" rel="noopener noreferrer" target="_blank"&gt;Module 4: Space Vector Modulation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;IMG alt="pastedImage_1.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49264iDEC6B8E5D56C0B27/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_1.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 7: Voltage drop across a shunt resistor placed in lower part of inverter leg in case of the positive current passing thru&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;If we zoom in a little bit we will see the effect of voltage drop stabilization time and why we need that delay when performing the current measurements. Any measurement in that region is prone to error due to current oscillations due inductance nature of the load. We have to wait until the current reaches a steady state regime thru the load and shunt before standing the ADC sampling and acquisition.&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_7.png"&gt;&lt;IMG alt="pastedImage_7.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49265i4664894B6502858B/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_7.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 8: Zoom in detail with shunt voltage drop stabilization.&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;As it is shown in Fig. 7, in order to read the current you need to know then the lower switch is in conduction and more specifically when the current flows thru the MOSFET. Bottom line for an accurate current measurement, the ADC sampling must be synchronized with the PWM commands. To better understand this concept lets consider a simple inductor as load and lets assume we want to regulate the current thru such a load.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;Fig. 9 shows the two possible scenarios that can be used for current measurement in this case and the effect of these tow scenario over the quantities acquired:&lt;/P&gt;&lt;UL style="padding: 0px 0px 0px 30px;"&gt;&lt;LI style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;In asynchronous sampling scenario, there is no correlation between the PWM signal (cyan waveform) and the ADC trigger (green waveform). The ADC conversion may happen to random time intervals as depicted in the upper case. Assuming the PWM duty factor is constant and the real current thru load varies in a saw-tooth waveform pattern, then the measured current will be wrong showing various levels depending on the moment the ADC was triggered.&lt;/LI&gt;&lt;LI style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;in the synchronized sampling scenario, the ADC conversion is triggered always in the middle of the PWM ON period. This mechanism will ensure that all the time we read the actual current thru the inductor in the same moment. The dark-red waveform shows that using this method we can read a steady average current all the time.&amp;nbsp;&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;IMG alt="pastedImage_1.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49268i01C6FDCBBE34E93D/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_1.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 9: Asynchronous vs. Synchronous current measurement ADC sampling&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;The last topic we have to discuss before implementing the actual application is the system delays that may affect the current measurements. Now that we know that we need to synchronize the PWM pulse generation with the ADC sampling we need to understand how various transformation between the moment when we compute the next PWM duty cycle until the moment we perform the measuring will affect the system. A typical processing chain is depicted in Fig. 10.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_4.png"&gt;&lt;IMG alt="pastedImage_4.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49269i6B61A616FE477FC8/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_4.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 10: Processing chain between the MCU computation and actual current measurements&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;Based on Fig. 10 system topology we can identify up to seven (yes! 7) sources of delays that add together and having a negative impact on the measurements. In the next table is shown the source of the delay, the overall impact and the typical numbers you should expect when dealing with such system topology as the one from MotorGD DevKit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="height: 218px;"&gt;&lt;TD style="text-align: center; height: 218px;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_11.png"&gt;&lt;IMG alt="pastedImage_11.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49271i038E1C5D1232ECE2/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_11.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;Lets take it one by one and see how those delays influence the current measurements:&lt;/P&gt;&lt;UL style="padding: 0px 0px 0px 30px;"&gt;&lt;LI style="margin: 0.2em 0px; text-align: justify;"&gt;PWM Dead time (DT) insertion. This is mostly given by the hardware design restrictions that needs to consider the type of load and the transistors used to switch the phase voltages. Since the transistors needs some time to enter or exit the conduction state, the SW must ensure there is no situation when both upper and lower transistors are in conduction at the same moment. A typical value for DT might be between 100ns up to 2us depending on various factors in the system.&amp;nbsp;As shown in Fig. 11, after adding the dead time for on the desired PWM waveform, what we get is shift to the right for both PWM mid point and the rising edges. Therefore, immediately after finishing computing the proper PWM via Space Vector Modulation technique, we start to see the first delay.&lt;/LI&gt;&lt;/UL&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_13.png"&gt;&lt;IMG alt="pastedImage_13.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49272iE2D7368C0D3F59E7/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_13.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 11: Delay due to Dead Time (DT) insertion&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;UL style="padding: 0px 0px 0px 30px;"&gt;&lt;LI style="margin: 0.2em 0px; text-align: justify;"&gt;Between the moment when the PWM signal is computed and available inside the MCU FTM peripheral and the moment it reaches the actual MOSFET gate, there is an additional delaying chain cause by the signal response of various opto-couples and pre-drivers that are used to condition the signal and separates the high voltage side from low voltage one. This additional delay is shown in Fig. 12 and represent another shifting to the right of the PWM commands compared with the moment when FTM internal counter was initialized.&lt;/LI&gt;&lt;/UL&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_16.png"&gt;&lt;IMG alt="pastedImage_16.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49273iF455434EC3003113/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_16.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 12: Delay due to opto-coupler and pre-drivers&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;UL style="padding: 0px 0px 0px 30px;"&gt;&lt;LI style="margin: 0.2em 0px; text-align: justify;"&gt;At this point in time the PWM command that controls the MOSFET transistor are available but all transistors have a time ON and OFF due to their intrinsic characteristics. Depending on the class of transistors you may have and the voltage level you need to switch ON/OFF, this delay may be shortef and longer. In Fig. 13, is show the entire delay (Delay2) between the theoretical switching point (marked here by the compare level CMP2) and the moment when the actual terminal voltage is switched.&lt;/LI&gt;&lt;/UL&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_19.png"&gt;&lt;IMG alt="pastedImage_19.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49276i83AF0BA129AF70ED/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_19.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 13: Delay due to transistors entering/exiting the conduction&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;UL style="padding: 0px 0px 0px 30px;"&gt;&lt;LI style="margin: 0.2em 0px; text-align: justify;"&gt;Finally we reach to the point when the transistors are in conduction and the current have a path to flow thru the shunt resistor. In Fig. 14 is depicted the moment in time when the current start to flow. At this point you can see the delay between what has been commanded as what has been actually obtained as current flow thru motor winding.&lt;/LI&gt;&lt;/UL&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;IMG alt="pastedImage_1.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49333iF0316F430F912769/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_1.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 14: Delay between desired PWM command and the moment when current flows thru the shunt resistor&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;UL style="padding: 0px 0px 0px 30px;"&gt;&lt;LI style="margin: 0.2em 0px; text-align: justify;"&gt;The last chain of delay that influence the current measurements is made of the low pass filter (LPF) shown in Fig. 10 and the amplifier slew rate as depicted in Fig. 15. As can be seen marked with a green circle the moment when the ADC can safety acquire the shunt voltage drop due to current passing thru is far to right delayed compared to the original desired PWM mid point.&amp;nbsp;&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_5.png"&gt;&lt;IMG alt="pastedImage_5.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49449i54996C97C6544F0F/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_5.png" /&gt;&lt;/SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 15: Delays due to filtering and amplifier slew rate&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;Understanding and knowing all these factors will allow us to successfully read the correct values of the motor phase currents. As you can see, it is up to the software side to compensate for all these delays and perform the actual FOC accordingly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: bold; font-size: 30px; color: #333399;"&gt;&lt;STRONG&gt;HARDWARE SUPPORT&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;&lt;SPAN&gt;Now that we know what we have to do in order to read the currents, lets see that MotorGD DevKit is offerings and how can we use the signals to convert the information from analogue to digital. As shown in Fig. 16, we are going to use the inverter phase A and B shunts to capture the value of motor phase A and phase B. Based on these 2 values we are going to compute the third current on phase C.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;IMG alt="pastedImage_2.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49537i06ACFD16BE0BCD31/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_2.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 16: MotorGD DevKit 3-phase inverter schematic&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;At this point you may ask yourself why not reading the phase C current directly since there is a shunt already available for that purpose.&amp;nbsp;That is a&amp;nbsp;legitimate question but due to the hardware constrains we are not going to use that third shunt and let me explain why.&lt;/P&gt;&lt;P style="text-align: justify;"&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;As it has been explained the delays may have an big impact on the current measurements and this effect is even more important at high speed when we need to which the PWM faster. Spinning the motor faster it means we have to supply the motor with higher voltage that can only be achieved by maintaining the upper switches in conduction for longer time periods. In Fig. 6 was explained that we need a critical time interval to keep the lower transistor ON.&lt;/P&gt;&lt;P style="text-align: justify;"&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;Therefore, considering the importance of reading the currents as closed as possible in the middle of the PWM lower switch command we would like to avoid doing multiple ADC sampling in that short time interval.&amp;nbsp;The S32K144 MCU has two ADC modules and we can route the signals from both shunts to each of the ADC in order to sample in parallel the phase A and phase B currents. Any other combination will lead to an additional delay in measuring the phase C current and Kirchhoff law is going to be violated since the sampling is done to different moments in time.&amp;nbsp;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;Expect for the phase currents that needs to be sampled in the same time, nothing prevent us for measuring additional analogue values that does not need to be synchronized with the PWM waveform. As it shown in Fig. 17, we are going to read two additional signals that will helps us with motor and drive protection in the future. These two additional signals represent the DC-link voltage and current.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;IMG alt="pastedImage_1.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49538i6054A0BF03C49E07/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_1.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 17: Analogue values to be read from MotorGD DevKit&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;This signal are routed to the S32K144 MCU via dedicated pins that reach the ADC converters as shown in Fig. 18.&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_4.png"&gt;&lt;IMG alt="pastedImage_4.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49539i4199B379BE819888/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_4.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 18: S32K144 analogue signal routing&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;By default the correspondence between the signals and the ADC instances is shown in the table below. Note that the phase currents are routed by default to the same ADC0 converter. If we leave them like this is going to complicate the application since we will have to deal with an additional delay between the sampling moment of phase A current and the moment when we sample again to read the phase B current. In this time interval the current thru phase B might change the value and the FOC may be distorted.&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_7.png"&gt;&lt;IMG alt="pastedImage_7.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49541i6B7AA3EA0F0D874D/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_7.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;To solve these kind of issues, the S32K14x product families allows you to perform ADC hardware channels interleaving as shown in Fig. 19.&amp;nbsp;In the hardware interleaved mode, a signal on the pin PTB1 can be sampled&amp;nbsp;by both ADC0 and ADC1 in the same time. The interleaved mode is enabled&amp;nbsp;by SIM_CHIPCTL[ADC_INTERLEAVE_EN] bits.&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_11.png"&gt;&lt;IMG alt="pastedImage_11.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49542i0C532DA7CE57BC9D/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_11.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 19: S32K14x ADC hardware interleaved channels&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;Using this hardware trick we are going to re-route the phase B current measurement to the ADC1 instead of ADC0 and the new analogue pin assignment will look like this:&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_14.png"&gt;&lt;IMG alt="pastedImage_14.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49544i94B5A1F43A2B6D8A/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_14.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;The last unknown piece of the puzzle is how synchronize the ADC measurement with the PWM command. Once again the S32K14x product family comes in handy with a rich feature set. The MCU contains a dedicated module for inter-connectivity of various hardware modules. This module is called TRGMUX and provides an extremely flexible mechanism for connecting various trigger&amp;nbsp;sources to multiple pins/peripherals as shown in Fig. 20.&lt;/P&gt;&lt;P style="text-align: justify;"&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;To trigger the ADC conversion we are going to use the FTM initialization trigger (INIT_TRIG) functionality. The INIT_TRIG is going to raise an event each time the PWM counter is re-initialized signaling this way the beginning of a new PWM period. This way the TRGMUX can re-route this event to the ADC modules to signal the moment when the ADC should start the acquisitions.&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_16.png"&gt;&lt;IMG alt="pastedImage_16.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49545iB7753BDD196ACD90/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_16.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 20: PWM - ADC synchronization&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;As we have found out from Dual-Shunt Sensing Technique section, apart of PWM to ADC synchronization we also need to handle various sources of delays in the system. The S32K14x MCU families have a dedicated peripheral called Programmable Delay Block (PDB) that can&amp;nbsp;trigger specific events based on a pre-condition.&amp;nbsp;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;In our case, we are going to configure the PDB instances to receive the same FTM INIT_TRIG event and to command the ADC acquisition at a specific moment in time which is delayed compared to the beginning of the PWM period. The specific delay timing intervals will be discussed in the next section.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_19.png"&gt;&lt;IMG alt="pastedImage_19.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49638iD8398EB173DE2843/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_19.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 21: PDB triggering scheme of ADC conversion using same event synchronization source INIT_TRG&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;The overall ADC triggering concept can be summarize in Fig. 22.&amp;nbsp;The FTM issue the counter initialization trigger which is&amp;nbsp;used as a trigger input of the PDB. The PDB&amp;nbsp;is then used&amp;nbsp;to trigger the ADC. Each ADC channel in the PDB module&amp;nbsp;supports up to 8 pre-triggers, which could be used as the ADC hardware channel&amp;nbsp;selection to precondition the ADC block prior to an actual trigger. After a pre-trigger, the&amp;nbsp;ADC trigger initiates the ADC conversion. When a PDB&amp;nbsp;pre-trigger starts an ADC conversion, an internal lock associated with&amp;nbsp;the corresponding pre-trigger is activated. This lock becomes inactive when receiving the conversion complete (COCO) signal from the ADC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_23.png"&gt;&lt;IMG alt="pastedImage_23.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49763iA4015B14053E0391/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_23.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 22: ADC trigger concept that implements the PWM-ADC synchronization&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P style="text-align: justify;"&gt;As can be seen from Fig. 22 the main CPU is not involved in this mechanism once the entire chain of events is configured. This leaves more resources available for the programmer to implement the application.&lt;/P&gt;&lt;P style="text-align: justify;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: bold; font-size: 30px; color: #333399;"&gt;&lt;STRONG&gt;EMBEDDED TARGET APPLICATION DEVELOPMENT&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; text-align: justify;"&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;&lt;SPAN&gt;As mentioned in the Introduction, we are going to reuse and enhance the model developed in the previous module&amp;nbsp;&lt;A href="https://community.nxp.com/thread/467938" rel="noopener noreferrer" target="_blank"&gt;Module 5: V/F Scalar Control&lt;/A&gt;&amp;nbsp;to perform:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;UL style="text-align: justify;"&gt;&lt;LI style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;&lt;SPAN&gt;Hardware configuration for a proper current sensing using PWM-PDB-ADC synchronization&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;&lt;SPAN&gt;Software computation&amp;nbsp;for scaling the ADC conversion into the real values for currents and voltages&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P style="text-align: justify;"&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;&lt;SPAN style="background-color: #ffffff; color: #4c4c4c;"&gt;The Simulink blocks that are going to be added in this module are highlighted in Fig 23, in red while the blocks that are going to contain small modifications relative to the previous module are marked with magenta.&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="border: inherit solid inherit; font-size: inherit; padding: 5px;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_10.png"&gt;&lt;IMG alt="pastedImage_10.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49764iE371D0B8B329AF54/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_10.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 23: Top level Simulink model used for ADC measurements&amp;nbsp;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;The Simulink model can be broken apart in various configuration steps as shown below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-size: 22px;"&gt;&lt;STRONG&gt;MOSFET Pre-Driver Configuration&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;The first thing we have to do is to make sure MOSFET pre-driver is configured correctly according with&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://www.nxp.com/docs/en/data-sheet/MC34GD3000.pdf" rel="nofollow noopener noreferrer noopener noreferrer" style="color: #2989c5; text-decoration: none;" target="_blank"&gt;MC34GD3000 datasheet&lt;/A&gt;. To do configure it correctly we need to perform a specific sequence of commands in order to make sure pre-driver outputs are enabled and latched prior to normal operation:&lt;/P&gt;&lt;UL style="padding: 0px 0px 0px 30px;"&gt;&lt;LI style="text-align: justify;"&gt;RST input signal goes HIGH while the EN1 and EN2 input signals remain LOW;&lt;/LI&gt;&lt;LI style="text-align: justify;"&gt;&lt;P&gt;EN1 and EN2 inputs are set to HIGH state&lt;/P&gt;&lt;/LI&gt;&lt;LI style="text-align: justify;"&gt;&lt;P&gt;PA_LS_G, PB_LS_G, and PC_LS_G outputs are toggled HIGH for about 1.0 μs (HS outputs are enabled, but not latched)&lt;/P&gt;&lt;/LI&gt;&lt;LI style="margin: 0.2em 0px;"&gt;&lt;P style="text-align: justify;"&gt;Toggle PA_HS_G, PB_HS_G, and PC_HS_G outputs LOW for dead-time periord plus at least 0.1 μs&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_12.png"&gt;&lt;IMG alt="pastedImage_12.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49765i9548133608F5844C/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_12.png" /&gt;&lt;/SPAN&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_6.png"&gt;&lt;IMG alt="pastedImage_6.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49808iE46AF4714D6A58DB/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_6.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 24: MOSFET pre-driver configuration (a) - left side shows the pre-driver signals (b) - right shows the full initialization sequence&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;The entire initialization sequence is implemented in Simulink using the State-Flow charts and triggered subsystems that mimics the sequence shown in Fig. 24b. The subsystem is implemented in the Fast Loop Control and it is executed only once after reset.&amp;nbsp;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;IMG alt="pastedImage_1.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49861i80E70770C3DD4157/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_1.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 25: Pre-driver initialization Simulink model&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;PRE __default_attr="info" __jive_macro_name="alert" alert="info" class="jive_text_macro jive_macro_alert"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;The SPI communication is not yet implemented since it is not in the purpose of this module. All the data are prepared and will be sent to the pre-driver in a future module when we will have to configure various hardware protections.&lt;/SPAN&gt;&lt;/P&gt; &lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-size: 22px;"&gt;&lt;STRONG&gt;FTM Configuration&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;The Flex Timer Module needs to be configured to:&lt;/P&gt;&lt;UL style="padding: 0px 0px 0px 30px;"&gt;&lt;LI style="text-align: justify;"&gt;perform a special PWM start-up sequence to enable the pre-driver configuration;&lt;/LI&gt;&lt;LI style="text-align: justify;"&gt;send an interrupt each time the timer is getting reinitialized in order to allow PWM-PDB-ADC syncronization&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since we have to perform a special pre-driver configuration we need to make sure we have a full control over the moments when the PWM are activated. At initialization phase we are going to deactivate the PWM signal generation&amp;nbsp;from "&lt;STRONG&gt;Start pin generation immediately after initialization&lt;/STRONG&gt;" option and disabling "&lt;STRONG&gt;Initialization Trigger&lt;/STRONG&gt;"&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_21.png"&gt;&lt;IMG alt="pastedImage_21.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49914i82E595A1E2E7D6F1/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_21.png" /&gt;&lt;/SPAN&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_23.png"&gt;&lt;IMG alt="pastedImage_23.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49985i9852848E4FA85230/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_23.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 26: FTM_Three_Phase_Output Simulink block settings&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;These two options will be enabled in the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Control_Logic/enable_pwm&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;subsystem shown in Fig. 25, where we have used an interesting combination of NXP Toolbox library blocks and Simulink Coder Custom Code blocks to call the FTM function that enables the trigger generation, as it is shown in Fig. 27.&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="width: 22%; text-align: center;"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_30.png"&gt;&lt;IMG alt="pastedImage_30.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49993i7C8D8433D8BFA130/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_30.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="width: 30.9507%; text-align: center;"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_31.png"&gt;&lt;IMG alt="pastedImage_31.png" src="https://community.nxp.com/t5/image/serverpage/image-id/49998iF69DEBFB55F6F729/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_31.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="width: 40.0493%;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_45.png"&gt;&lt;IMG alt="pastedImage_45.png" src="https://community.nxp.com/t5/image/serverpage/image-id/50000i000C19A43AAAB153/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_45.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD colspan="3" style="width: 93%; text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 27: (a) pwm_enable subsystem, (b) FTM_PWM_Disable_Enable block configuration, (c) Simulink Coder Custom Code Block to call the function that setup the FTM initialization trigger&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-size: 22px;"&gt;&lt;STRONG&gt;ADC&amp;nbsp;Configuration&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;First step in configuration of the ADC modules ADC0 and ADC1 is to configure the SIM module to interleave the ADC channels in order to allow us to read the phase current A and B in parallel on both ADC modules in the same time. Since there is no dedicated Simulink block for this we will have to write a custom piece of code that can be executed during system initialization phase. This is an easy task using the Simulink Coder dedicated blocks.&amp;nbsp;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;Using a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Model Header&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Simulink Coder block we are going to write a generic function that could be reused to setup the SIM module that handles the ADC hardware channel interleaving. This piece of code is going to be place in the beginning of the C-file that is automatically generated by Simulink for our model.&amp;nbsp;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_6.png"&gt;&lt;IMG alt="pastedImage_6.png" src="https://community.nxp.com/t5/image/serverpage/image-id/50001iF086F4B24AFC5364/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_6.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 28: SIM model interleave function body&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;All that remains now is to call this function at the initialization stage with the proper arguments that configures the PTB1 input to be sampled by the ADC1 on AD15 input channel.&amp;nbsp;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_11.png"&gt;&lt;IMG alt="pastedImage_11.png" src="https://community.nxp.com/t5/image/serverpage/image-id/50004i4D54A53FAF0E022C/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_11.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 29: ADC interleave selection for PTB1 input&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P style="text-align: justify;"&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;The initialization for both ADC modules ADC0 and ADC1 is identical. The main parameters that needs to be configured are shown in Fig. 30. For more details of each one please consult the Help.&amp;nbsp;As shown here, the ADC are configured to use the highest resolution possible and to have the conversions automatically started based on hardware event controlled by the PDB peripheral&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;IMG alt="pastedImage_1.png" src="https://community.nxp.com/t5/image/serverpage/image-id/50008i3E7758A0D3142E5B/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_1.png" /&gt;&lt;/SPAN&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;IMG alt="pastedImage_2.png" src="https://community.nxp.com/t5/image/serverpage/image-id/50009i0A6CEE17D593D24B/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_2.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 30: ADC instances configuration&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;The final ADC configuration that needs to be done is to setup the conversion channels associated with the values we want to measure. The ADC conversion results are currently read in the PDB interrupt handle which is synchronized with the FTM PWM initialization trigger.&amp;nbsp;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; border-width: 1px; border-color: #ffffff;" width="100%"&gt;&lt;TBODY style="border: inherit solid inherit;"&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_12.png"&gt;&lt;IMG alt="pastedImage_12.png" src="https://community.nxp.com/t5/image/serverpage/image-id/50012i6372377A3556C4E3/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_12.png" /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: inherit solid inherit;"&gt;&lt;TD style="text-align: center;"&gt;&lt;SPAN style="font-size: 13px;"&gt;Fig. 31: Simulink model for ADC conversion results reading&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="info" __jive_macro_name="alert" alert="info" class="jive_text_macro jive_macro_alert" modifiedtitle="true"&gt;&lt;P&gt;The second part of this article can be found here:&amp;nbsp;&lt;A href="https://community.nxp.com/thread/469526" rel="noopener noreferrer" target="_blank"&gt;https://community.nxp.com/thread/469526&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2020 14:08:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781020#M2146</guid>
      <dc:creator>Daniel_Popa</dc:creator>
      <dc:date>2020-11-02T14:08:25Z</dc:date>
    </item>
    <item>
      <title>Re: Module 6: Current Sensing (Part 1/2)</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781021#M2147</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/dumitru-daniel.popa"&gt;dumitru-daniel.popa&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first thank you again for this module which is really important to implement the FOR later on.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think with the KV4x it will be a little bit different to trigger the ADC with the PWM.&lt;/P&gt;&lt;P&gt;The currents are already matched to the two ADC modules, so no interleaving should be required ?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt.JPG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/18568i505C9665A4A2634C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt.JPG" alt="Unbenannt.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also the initialisation routine could not be the same, because there is no "PWM Enable/Disable" block in the KV4x library? The "Start pin generation immediately after initialization" option I couldn't found in the "FTM_Three_Phase_Output" or "eFlexPWM_Three_Phase_Output". What I have to consider here ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I use the "FTM_Three_Phase_Output" I principle could use your way with&amp;nbsp;Simulink Coder Custom Code blocks&amp;nbsp;to call the FTM function that enables the trigger generation ?&lt;/P&gt;&lt;P&gt;With the "eFlexPWM_Three_Phase_Output" I could use the Output trigger tab shown&amp;nbsp;below ?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt2.JPG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/18569i01A92FBBF692EE8B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt2.JPG" alt="Unbenannt2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also I have a simple question to the beginning:&lt;/P&gt;&lt;P&gt;Why you set 8000 cycles in the PDB configuration ? I think this corresponds to 10kHz ? But why ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Leon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Feb 2018 18:36:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781021#M2147</guid>
      <dc:creator>lethuer</dc:creator>
      <dc:date>2018-02-22T18:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: Module 6: Current Sensing (Part 1/2)</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781022#M2148</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Leon,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;think with the KV4x it will be a little bit different to trigger the ADC with the PWM.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;The currents are already matched to the two ADC modules, so no interleaving should be required ?&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Indeed, no interleave required in your case.In case of S32K14x and MotorGD that needs to be done since that is how the hardware was designed. In case of custom design - knowing that MCU support interleaving might save you from a lot of troubles regarding pin assignment and signal routing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Also the initialisation routine could not be the same, because there is no "PWM Enable/Disable" block in the KV4x library? The "Start pin generation immediately after initialization" option I couldn't found in the "FTM_Three_Phase_Output" or "eFlexPWM_Three_Phase_Output". What I have to consider here ?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Yes, some of the older toolboxes does not have such options. In case of KV the PWM signal generation are done at the initialization stage.&amp;nbsp;&lt;/P&gt;&lt;P&gt;That should not pose any important issues. Still make sure that at the startup the commands that are passed to the PWM are initialized with a same value that does not create a voltage potential at motor terminals. A good practice is to make sure at initialization the default duty cycle is 50% or the high and low signal are not overlapping.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, make sure the PWM block has the lowest priority in the model compared with the initialization of the other block like ADC, timers, etc.&lt;/P&gt;&lt;P&gt;Depending on the relative Simulink priority, the PWM should be the last block to be configured in Simulink initialization phase. This way to make sure that all the other blocks that depends on the PWM are not started accidentally.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;If I use the "FTM_Three_Phase_Output" I principle could use your way with&amp;nbsp;Simulink Coder Custom Code blocks&amp;nbsp;to call the FTM function that enables the trigger generation ?&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;That's a bug in our current toolbox for S32K - we can enable the trigger only once and since i need the special initialization sequence of the MC34GD3000 predriver i was forced to re-enable the trigger. I used the custom code to workaround that issue :-)&lt;/P&gt;&lt;P&gt;You do not need it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;With the "eFlexPWM_Three_Phase_Output" I could use the Output trigger tab shown&amp;nbsp;below ?&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Yes!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Why you set 8000 cycles in the PDB configuration ? I think this corresponds to 10kHz ? But why ?&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The S32K14x operates at 80MHz. To obtain a 10kHz frequency from the PWM you need a counter that counts up to 80MHz/10KHz = 8000 ticks.&lt;/P&gt;&lt;P&gt;The PDB is syncronized with PWM, therefore the PDB counter is also set to restart at 8000 counts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Feb 2018 20:12:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781022#M2148</guid>
      <dc:creator>Daniel_Popa</dc:creator>
      <dc:date>2018-02-22T20:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: Module 6: Current Sensing (Part 1/2)</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781023#M2149</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/dumitru-daniel.popa"&gt;dumitru-daniel.popa&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank a lot for your remarks ! Let me ask some things to become clearer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Still make sure that at the startup the commands that are passed to the PWM are initialized with a same value that does not create a voltage potential at motor terminals. A good practice is to make sure at initialization the default duty cycle is 50% or the high and low signal are not overlapping.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;So the only thing to do in this case is to configure the "Initial Duty Cycle A", "...B", "...C" in the "eFlexPWM_Three_Phase_Output" or "FTM_Three_Phase_Output" ?&lt;/P&gt;&lt;P&gt;At the Moment I have set 0%, so only the low side IGBT are in conduction and the terminals are&amp;nbsp;connected to ground.&lt;/P&gt;&lt;P&gt;Is that a good way or should&amp;nbsp;I set 50%&amp;nbsp;instead of&amp;nbsp;0% Initial duty cycle ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Also, make sure the PWM block has the lowest priority in the model compared with the initialization of the other block like ADC, timers, etc.&lt;/P&gt;&lt;P&gt;Depending on the relative Simulink priority, the PWM should be the last block to be configured in Simulink initialization phase. This way to make sure that all the other blocks that depends on the PWM are not started accidentally.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The only way I know is to set priorities in the block properties ? With this it is possible to Change the execution order.&lt;/P&gt;&lt;P&gt;Is this the way you&amp;nbsp;suggest ? Or is there another way to influence the initialization phase&amp;nbsp;?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;we can enable the trigger only once and since i need the special initialization sequence of the MC34GD3000 predriver i was forced to re-enable the trigger. I used the custom code to workaround that issue :-)&lt;/P&gt;&lt;P&gt;You do not need it.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;The KV4x "FTM_Three_Phase_Output" has no "Output Trigger" tab like "eFlexPWM_Three_Phase_Output". &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;H&lt;SPAN&gt;ow could I&amp;nbsp; generate&amp;nbsp;a trigger with FTM_Three_Phase_Output every PWM sequence with KV4x?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;S32K Toolbox has no "eFlexPWM_Three_Phase_Output", so for working with KV4x I should simply use this to use the Trigger event ?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Best regards&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Leon&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Feb 2018 08:03:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781023#M2149</guid>
      <dc:creator>lethuer</dc:creator>
      <dc:date>2018-02-23T08:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: Module 6: Current Sensing (Part 1/2)</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781024#M2150</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Next question...&lt;/P&gt;&lt;P&gt;I found that you now used "Periodic&amp;nbsp;Interrupt Timer" instead&amp;nbsp;of&amp;nbsp;"Function Call Generator" with specified Sample Time S_LST = 1ms and C_LST = 0.1ms to call the Slow and Fast Loop Subsystems.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I right that this was done because the PIT is synchronized with PWM Timing ?&lt;/P&gt;&lt;P&gt;Function Call Generator block is periodic but not necessarily synchronized with the PWM&amp;nbsp;?&lt;/P&gt;&lt;P&gt;With KV4x&amp;nbsp;there also&amp;nbsp;isn't the "Start Counter immediately after initialization" Option in the PIT block like I mentioned before with the "eFlexPWM_Three_Phase_Output" and &lt;SPAN&gt;"FTM_Three_Phase_Output".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Does this make any Problems ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Also the ISR priorities are not clear for me.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;PIT Channel 1 - priority 4 (Fast Loop)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;PIT Channel&amp;nbsp;2 - priority 4 (Slow Loop)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;PDB1 - priority 1 (Module 1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;PDB0 - priority 10 (Module 0)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Feb 2018 09:02:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781024#M2150</guid>
      <dc:creator>lethuer</dc:creator>
      <dc:date>2018-02-23T09:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: Module 6: Current Sensing (Part 1/2)</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781025#M2151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Leon,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Indeed, I switched to PIT timers in preparation for the next modules (M7-M10) that will use the function calls. The original function call was used only in M5 as a way to have a comparison between the Simulation vs. Hardware since for simulation i can't use PIT block.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The generated code for the function call is a bit ugly and that is why i preferred to switch to PIT - timer interrupts since it is easy to read the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyhow, there is no issue with the synchronization since Simulink Step Function where all the computation are updated is in sync with the rest of the clocks PWM/ADC/PIT. It is the same clock source used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;With KV4x&amp;nbsp;there also&amp;nbsp;isn't the "Start Counter immediately after initialization" Option in the PIT block like I mentioned before with the "eFlexPWM_Three_Phase_Output" and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;"FTM_Three_Phase_Output".&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;Does this make any Problems ?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;It should not be. As i explained before - i was bounded to the HW implementation and the initialization of the MC34GD pre-driver. I could probably move that all together in the Simulink Initialization Function but one of the reasons behind these training is to advertise different functionalities the toolbox is capable off.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;Also the ISR priorities are not clear for me.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;PIT Channel 1 - priority 4 (Fast Loop)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;PIT Channel&amp;nbsp;2 - priority 4 (Slow Loop)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;PDB1 - priority 1 (Module 1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;PDB0 - priority 10 (Module 0)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Thank for highlighting this. It's my fault. it should be: PDB1, PIT1, PIT2, PDB0 priority order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Feb 2018 09:46:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781025#M2151</guid>
      <dc:creator>Daniel_Popa</dc:creator>
      <dc:date>2018-02-23T09:46:34Z</dc:date>
    </item>
    <item>
      <title>Re: Module 6: Current Sensing (Part 1/2)</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781026#M2152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Daniel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with FTM_CHN_ISR block I'm now able to generate a Trigger Event at the Moment the lower IGBT is in conduction.&lt;/P&gt;&lt;P&gt;but with the stateflow diagram&amp;nbsp;below&amp;nbsp;of course the pin only&amp;nbsp;switches every time the trigger occurs.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/18839i104E877BBDB1C683/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt.PNG" alt="Unbenannt.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Could you Show me your example to Switch back the testpin before a new Trigger Input occurs ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with eFlexPWM_Interrupt I get this message...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt1.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/18885i5E8D1BFB43314212/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt1.PNG" alt="Unbenannt1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;It is just copied out of the "kv4xf_eflexpwm_isr" example and also worked in another model.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt2.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/18886iC01252021082A6B4/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt2.PNG" alt="Unbenannt2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Function Call Subsystem:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt3.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/18887i74D4161F25630960/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt3.PNG" alt="Unbenannt3.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Do you have an idea to fix this&amp;nbsp;?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Feb 2018 11:30:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781026#M2152</guid>
      <dc:creator>lethuer</dc:creator>
      <dc:date>2018-02-23T11:30:01Z</dc:date>
    </item>
    <item>
      <title>Re: Module 6: Current Sensing (Part 1/2)</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781027#M2153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Leon,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Could you Show me your example to Switch back the testpin before a new Trigger Input occurs ?&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I'm not sure i understand. All the code is shared as part of the M6.zip here:&lt;A href="https://community.nxp.com/thread/469526"&gt;Module 6: Current Sensing (Part 2/2)&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;with eFlexPWM_Interrupt I get this message...&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;That is a consistency check error because the toolbox has detected that you are using an interrupt from an uninitialized block. Make sure you have the same selection of &lt;STRONG&gt;Sub-module&lt;/STRONG&gt; in both PWM and ISR Simulink Blocks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Feb 2018 14:46:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781027#M2153</guid>
      <dc:creator>Daniel_Popa</dc:creator>
      <dc:date>2018-02-23T14:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: Module 6: Current Sensing (Part 1/2)</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781028#M2154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;I'm not sure i understand. All the code is shared as part of the M6.zip here:&lt;A _jive_internal="true" data-containerid="11546" data-containertype="14" data-objectid="469526" data-objecttype="1" href="https://community.nxp.com/thread/469526"&gt;&lt;SPAN style="color: #0066cc; text-decoration: underline;"&gt;Module 6: Current Sensing (Part 2/2)&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I just want to switch on a testpin for a short Moment and not for a complete PWM cycle. Just like you did in "Fig. 32: Synchronization between PWM command for the lower switch (cyan) and PDB Interrupt (yellow) as result of FTM initialization Trigger". This code isn't in the M6 part 2/2 I think. With my stateflow model the testpin only switches at every&amp;nbsp;point of the Trigger Event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;That is a consistency check error because the toolbox has detected that you are using an interrupt from an uninitialized block. Make sure you have the same selection of &lt;STRONG&gt;Sub-module&lt;/STRONG&gt; in both PWM and ISR Simulink Blocks.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Of course there are the same Sub modules, you can see it&amp;nbsp;on the Picture:&lt;/P&gt;&lt;P&gt;- eFlexPWM Three Phase: Sub Module 0 1 2&lt;/P&gt;&lt;P&gt;- eFlexPWM Interrupt: Sub Module 0&lt;/P&gt;&lt;P&gt;&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;Leon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Feb 2018 07:43:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781028#M2154</guid>
      <dc:creator>lethuer</dc:creator>
      <dc:date>2018-02-26T07:43:47Z</dc:date>
    </item>
    <item>
      <title>Re: Module 6: Current Sensing (Part 1/2)</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781029#M2155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/dumitru-daniel.popa"&gt;dumitru-daniel.popa&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;of course I have some further questions with configuring the PDB/ADC/FTM.&lt;/P&gt;&lt;P&gt;I will try to do this step by step...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Your "FTM_Three_Phase_Output" is Module 3, why you have Chosen "FTM2 External Trigger" in your PDB0 and PDB1&amp;nbsp;init blocks ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) I understand that you Trigger the ADC samples at different timing Points of one PWM cycle. For that you use the pre-Trigger Option in the PDB blocks. Your ADC sensing is done in a PDB_ISR. How do you know which ADC sample is done&amp;nbsp;with which pre-trigger ?&lt;/P&gt;&lt;P&gt;It should be:&lt;/P&gt;&lt;P&gt;PDB0 - Delay6900&amp;nbsp;- Pre-trigger0 --&amp;gt; ADC0, Ia (Interleaving activated)&lt;/P&gt;&lt;P&gt;PDB1 - Delay0 -&amp;nbsp;Pre-trigger0 --&amp;gt; ADC1 Vdc&lt;/P&gt;&lt;P&gt;PDB1 - Delay4100 -&amp;nbsp;Pre-trigger1 --&amp;gt; ADC1, Idc&lt;/P&gt;&lt;P&gt;PDB1 - Delay6900&amp;nbsp;-&amp;nbsp;Pre-trigger2 --&amp;gt; ADC1, Ib&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) For the delays you set this:&lt;/P&gt;&lt;P&gt;Ia, Ib --&amp;gt; 6900/8000 = 86,25us&lt;/P&gt;&lt;P&gt;Idc --&amp;gt; 4100/8000 = 51,25us - In your Fig. 35 you pointed at the Peak of dc link current, which is at 70us ??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) With KV4x the adc configuration block is a Little bit different. I have configured this to trigger the adc via PDB and use the simultaneous mode. Because of the simultaneous mode I think that I only Need the PDB0 which then will Trigger&amp;nbsp;ADC0 and ADC1 together at the same time ?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/21153iAECE26C36FE3B4CC/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt.PNG" alt="Unbenannt.PNG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt2.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/21198iF8CBDCDBAA3D3F9A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt2.PNG" alt="Unbenannt2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I use the "FTM_Three_Phase_Output" Module 0, so I have set "FTM0 Init and Channel Match" in the PDB_Config. Is that correct ?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt3.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/21247i911179B988014E09/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt3.PNG" alt="Unbenannt3.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The PDB0-interrupt handler subsystem&amp;nbsp;should then contain all the ADC Read blocks for ADCA and ADCB ? You can see themin the Image below:&lt;/P&gt;&lt;P&gt;Here is the same question like above: How do I know at which timing the ADC is read ?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt5.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/19470iE2FD5E03912D99A3/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt5.PNG" alt="Unbenannt5.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In case of KV4x PDB config, It is&amp;nbsp;only possible to configure 4 pre trigger. So I have to use 3 of them at the Moment because I have 6 measurements (U_dcb, I_phA, I_dcb, Temp_IPM, I_phB, I_phC):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt4.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/21289i21045EBAF5BB2024/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt4.PNG" alt="Unbenannt4.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Is that an accurate way or should I&amp;nbsp;better deactivate the simultaneous mode in adc config, then&amp;nbsp;trigger ADC0 with PDB0 and ADC1 with PDB1 (PDB config would be the same for both&amp;nbsp;- FTM0 as trigger source like&amp;nbsp;shown above) and use two PDB_interrupt handler Subsystems ?&amp;nbsp;Each of them would contain three ADC Read blocks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understand that It would be better to calculate I_phC in Software. Anyway I Need&amp;nbsp;5 measurements in my case&amp;nbsp;(U_dcb, I_phA, I_dcb, Temp_IPM, I_phB), so 3 samples are needed.&lt;/P&gt;&lt;P&gt;Any recommendation to improve this ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Leon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Feb 2018 13:07:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781029#M2155</guid>
      <dc:creator>lethuer</dc:creator>
      <dc:date>2018-02-26T13:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: Module 6: Current Sensing (Part 1/2)</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781030#M2156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have found out that the eFlexPWM Interrupt works if I use three complementary pwm Output blocks (module 0, module 1 and module 2)&amp;nbsp;instead of one three Phase Output block... is that a bug ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Feb 2018 13:10:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781030#M2156</guid>
      <dc:creator>lethuer</dc:creator>
      <dc:date>2018-02-26T13:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: Module 6: Current Sensing (Part 1/2)</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781031#M2157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Leon,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;1) Your "FTM_Three_Phase_Output" is Module 3, why you have Chosen "FTM2 External Trigger" in your PDB0 and PDB1&amp;nbsp;init blocks ?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Nope, i've selected the FTM3 Initialization trigger. You can see that selection in&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Fig. 37: PDB0 and PDB1 global configurations: trigger source, external trigger type and PDB counter value within&amp;nbsp;&lt;A href="https://community.nxp.com/thread/469526"&gt;Module 6: Current Sensing (Part 2/2)&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Also, &lt;span class="lia-inline-image-display-wrapper" image-alt="211126_211126.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/123278iB0AE98E6726694A6/image-size/large?v=v2&amp;amp;px=999" role="button" title="211126_211126.png" alt="211126_211126.png" /&gt;&lt;/span&gt;you can see the FTM3 Initialization trigger selection. Perhaps something went wrong during import of the slx in your environment.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;Your ADC sensing is done in a PDB_ISR. How do you know which ADC sample is done&amp;nbsp;with which pre-trigger ?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;There is a specific HW arrangement that "connects" each PDB pre-trigger to each ADC hardware channel.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_5.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/19161i8A0F77B5A577FC88/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_5.png" alt="pastedImage_5.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;The actual pre-trigger vs. ADC channel pairing is done via SC1 Register selection.&amp;nbsp;If you wish to have a particular order in which you capture the analogue conversions then you simply assign the appropiate latter A, B, C, D, etc to the conversion block: A corresponds to R0, B to R2 and so on.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;Idc --&amp;gt; 4100/8000 = 51,25us - In your Fig. 35 you pointed at the Peak of dc link current, which is at 70us ??&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;You do not need the peak value - but rather the average since we are dealing with very short bursts due to PWM.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Regarding the KV4x specifics i'm not 100% aware off since i've not practice using it. As far as i remember there was an older thread you have opened in which you managed to measure the currents.&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;How do I know at which timing the ADC is read ?&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I used an oscilloscope to verify when the last ADC conversion happens. For that i've activated the ADC ISR for that particular conversion and i toggled a GPO in that ISR handler - in my case the IB current. Then I've checked that GPO against the actual PWM Low Signal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyhow - in case the timings are not correct you will get PDB errors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;understood that It would be better to calculate I_phC in Software. How I have to configure the adc to make 5 instead of 6 measurements (ADCA: U_dcb, I_phA, I_dcb - ADCB: Temp_IPM, I_phB) ?&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Yes, it is better to read just 2 currents because due to conversion delay you might end up with ia+ib+ic != 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Feb 2018 07:37:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781031#M2157</guid>
      <dc:creator>Daniel_Popa</dc:creator>
      <dc:date>2018-02-27T07:37:30Z</dc:date>
    </item>
    <item>
      <title>Re: Module 6: Current Sensing (Part 1/2)</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781032#M2158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;again a Long post, but I think with important Content to understand the PWM, ADC Trigger Timing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="color: #51626f;"&gt;Perhaps something went wrong during import of the slx in your Environment.&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;Only for your info. I downloaded the example again and if I&amp;nbsp;open it then there is "FTM2 External Trigger" configured.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;I do not have the "FTM3 &lt;STRONG&gt;Initialize&lt;/STRONG&gt; Trigger" Option, only "FTM3 &lt;STRONG&gt;Internal&lt;/STRONG&gt; Trigger" or "FTM3 &lt;STRONG&gt;External&lt;/STRONG&gt; Trigger"&amp;nbsp;for S32K.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;I think "FTM3 &lt;SPAN style="color: #51626f;"&gt;&lt;STRONG&gt;Internal&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #51626f;"&gt; Trigger" would be the same&amp;nbsp;like "FTM3 &lt;SPAN style="color: #51626f;"&gt;&lt;STRONG&gt;Initialize&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #51626f;"&gt; Trigger"&lt;/SPAN&gt; ?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;Maybe this is because you saved the model in 2015b ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;The actual pre-trigger vs. ADC channel pairing is done via SC1 Register selection.&amp;nbsp;If you wish to have a particular order in which you capture the analogue conversions then you simply assign the appropiate latter A, B, C, D, etc to the conversion block: A corresponds to R0, B to R2 and so on.&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Ok I think I understand, your PDB1_IRQHandler:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt6.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/19030i064C5D3F76880062/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt6.PNG" alt="Unbenannt6.PNG" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;ADC0, Pre-trigger0 - SCI Register A - Ia (6900 cycles) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;ADC1, Pre-trigger0&amp;nbsp;- SCI Register A - Vdc (0 cycles)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;ADC1, Pre-trigger1 - SCI Register B - Idc (4100 cycles)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;ADC1, Pre-trigger2 - SCI Register C - Ib (6900 cycles) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;&lt;STRONG&gt;Now KV4x&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;With KV4x It is only possible to configure the sample indes and I don't have this SCI Register Options like you see here:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt7.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/19112i5A5195996F3995BB/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt7.PNG" alt="Unbenannt7.PNG" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;Also in the ADC Sample or ADC Config block I didn't found this SCI Option. So how do I know which ADC pair is read with which pre-trigger here?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;Actual I use one PDB_config (module 0) and adc works i&lt;SPAN style="color: #51626f;"&gt;n simultaneous mode. So I would expect this:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;Pre-trigger0 - ADCA Sample Index 0, ADCB Sample Index 8&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;Pre-trigger1- ADCA Sample Index 1, ADCB Sample Index 9&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;Pre-trigger2 - ADCA Sample Index 2, ADCB Sample Index 10&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;Is that correct or am I wrong ? I also have looked in the KV4x Reference Manual, but it is not specially announced here which pre-trigger is for which adc sample.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;The PDB config:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt8.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/19113i8E3C463A4CA08D7F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt8.PNG" alt="Unbenannt8.PNG" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt9.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/19163i644CEB05B881228A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt9.PNG" alt="Unbenannt9.PNG" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;The PDB_Interrupt only works if I activate the external Trigger Option in the FTM_Three_phase_Output block.&amp;nbsp;&lt;SPAN style="color: #51626f;"&gt;Ch[1] Trigger should be the Moment of the LowSide IGBT A is in conduction ? This would be valid for I_phA but not for I_phB and I_phC ? Or should I configure "Initialization Trigger" ?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;You don't have activated this Option in your s32k model...? But maybe because you was able to choose &lt;SPAN style="color: #51626f;"&gt;"FTM3 &lt;/SPAN&gt;&lt;SPAN style="color: #51626f;"&gt;&lt;STRONG&gt;Initialize&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #51626f;"&gt; Trigger" in the PDB config ?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt10.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/19298i7856E4D19081CD4E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt10.PNG" alt="Unbenannt10.PNG" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;Obviously I don't exactly understand the Connection between "External Trigger" in FTM_Three_Phase_Output, PDB Trigger Input Source "FTM0 Init and Channel Match", PDB &lt;SPAN style="color: #51626f;"&gt;Pre-trigger 0,1,2 and ADC Sample. Could you explain that for me for KV4 ?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="color: #51626f;"&gt;I used an oscilloscope to verify when the last ADC conversion happens. For that i've activated the ADC ISR for that particular conversion and i toggled a GPO in that ISR handler - in my case the IB current. Then I've checked that GPO against the actual PWM Low Signal.&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;In your case with s32k you might use this one so you could configure a specific ADC and SC1 Register. So you could see the exact time of the adc conversation you want to see.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt11.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/20100iCAB727FEB2A1E284/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt11.PNG" alt="Unbenannt11.PNG" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;In Kv4 Toolbox I found this, so I could only see the end of scan is complete. I do not exactly know which ADC Sample pair (in simultaneous mode) was read.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;I checked this with a testpin and it changes the state three times in one pwm cycle period.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;Also I'm able to manipulate the time of switching the state with the pre Trigger value.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;Still the question which pre-trigger is connected to which adc sample pair. (see above)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt12.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/19917i23B83F39D7DED570/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt12.PNG" alt="Unbenannt12.PNG" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="color: #51626f;"&gt;Yes, it is better to read just 2 currents because due to conversion delay you might end up with ia+ib+ic != 0&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN style="color: #51626f;"&gt;I understand that It would be better to calculate I_phC in Software. Anyway I Need&amp;nbsp;5 measurements in my case&amp;nbsp;(U_dcb, I_phA, I_dcb, Temp_IPM, I_phB), so 3 samples are needed in simultaneous mode.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Any recommendation to improve this or would a reduction of 1 sample necessary lead to give up one additional&amp;nbsp;measurement (e.g. IPM Temp).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Leon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Feb 2018 10:23:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781032#M2158</guid>
      <dc:creator>lethuer</dc:creator>
      <dc:date>2018-02-27T10:23:10Z</dc:date>
    </item>
    <item>
      <title>Re: Module 6: Current Sensing (Part 1/2)</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781033#M2159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Leon,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think i know what's going on. During the workshop development i found an issue with FTM initialization triggers. To fix that you will need S32K1xx v3.0.0 and the software path:&amp;nbsp;&lt;A href="https://community.nxp.com/thread/467438"&gt;https://community.nxp.com/thread/467438&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After that you should be able to see it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/mariuslucianandrei"&gt;mariuslucianandrei&lt;/A&gt;‌ can you have a look over the ADC settings for Kinetics. I know you have done some investigation in the past.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Feb 2018 08:18:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781033#M2159</guid>
      <dc:creator>Daniel_Popa</dc:creator>
      <dc:date>2018-02-28T08:18:54Z</dc:date>
    </item>
    <item>
      <title>Re: Module 6: Current Sensing (Part 1/2)</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781034#M2160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you are right !&lt;/P&gt;&lt;P&gt;With the Hotfix I'm now I am able to choose "FTM3 Initial Trigger" Option with S32k&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I have to choose in the external Trigger tab with kv4 ?&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;Leon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Feb 2018 09:17:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781034#M2160</guid>
      <dc:creator>lethuer</dc:creator>
      <dc:date>2018-02-28T09:17:03Z</dc:date>
    </item>
    <item>
      <title>Re: Module 6: Current Sensing (Part 1/2)</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781035#M2161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/dumitru-daniel.popa"&gt;dumitru-daniel.popa&lt;/A&gt;‌&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;I&amp;nbsp;just want to switch on a testpin for a short Moment and not for a complete PWM cycle. Just like you did in "Fig. 32: Synchronization between PWM command for the lower switch (cyan) and PDB Interrupt (yellow) as result of FTM initialization Trigger". This code isn't in the M6 part 2/2 I think. With my stateflow model the testpin only switches at every&amp;nbsp;point of the Trigger Event.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pic_24_2.bmp"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/20925iC0B0ADCB3C9069F6/image-size/large?v=v2&amp;amp;px=999" role="button" title="pic_24_2.bmp" alt="pic_24_2.bmp" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This is the Image I'm talking about. Your testpin (yellow)&amp;nbsp;switches on for a short Moment (a&amp;nbsp;pulse of&amp;nbsp;something like 4us) with falling edge PWM command Cyan.&lt;/P&gt;&lt;P&gt;My testpin only Switches the state with every falling edge of pwm, so it requires something to Switch back without having a new Trigger Input.&lt;/P&gt;&lt;P&gt;Does this make it more understandable what I mean ?&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;Leon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Feb 2018 09:31:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781035#M2161</guid>
      <dc:creator>lethuer</dc:creator>
      <dc:date>2018-02-28T09:31:35Z</dc:date>
    </item>
    <item>
      <title>Re: Module 6: Current Sensing (Part 1/2)</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781036#M2162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/dumitru-daniel.popa"&gt;dumitru-daniel.popa&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think I have made it with KV4, so I want to Show it here !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all the three PWM low side igbt signals:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="PWM AL, BL, CL.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/23400i2A3724FFFDF8FEA9/image-size/large?v=v2&amp;amp;px=999" role="button" title="PWM AL, BL, CL.PNG" alt="PWM AL, BL, CL.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I have set the Initialization Trigger in the external Trigger tab of "FTM Three&amp;nbsp;Phase Output", which should be exactly in the middle of PWM low side Signal.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt11.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/23737i89C5CFC123C77D48/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt11.PNG" alt="Unbenannt11.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/23882i0FC8015C4D2C2216/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt.PNG" alt="Unbenannt.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;With the Timer Overflow I checked the time of the initialization with a testpin&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt2.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/23929iA5C19E4816C30602/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt2.PNG" alt="Unbenannt2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;TOF Interrupt handler:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt3.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/23514iF9E742F8883FC0BB/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt3.PNG" alt="Unbenannt3.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the PDB config block I have configured "FTM0 Init and Channel Match"&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt7.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/23692i0B0FC7E966C2C17A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt7.PNG" alt="Unbenannt7.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I only configured one Pre-Trigger in the Channel 0 configuration without any delay.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt8.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/22989i68393E839B508D61/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt8.PNG" alt="Unbenannt8.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The ADC(in simultaneous mode) is triggered from the PDB0&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt10.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/23969iB051DD544F6699C6/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt10.PNG" alt="Unbenannt10.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The configured ADC samples:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt9.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/23096i6E97E48D0A49A6A6/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt9.PNG" alt="Unbenannt9.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt6.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/24052iAA96046EF96BC752/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt6.PNG" alt="Unbenannt6.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After the PDB triggeres the ADC all ADC samples are read !&lt;/P&gt;&lt;P&gt;After the end of scan I checked this with a second testpin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt4.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/24108iDEF1584006C95BA6/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt4.PNG" alt="Unbenannt4.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;End of Scan Interrupt handler&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Unbenannt5.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/24178iC5B3D42C79CADB32/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt5.PNG" alt="Unbenannt5.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here you can see the PWM A low side (red) Timer Overflow (blue) and ADC End of Scan (black) with pre Trigger delay 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="PWM AL, Init Trigger, ADC on End Pre-Trigger 0.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/23739i6A226C972C87F7A5/image-size/large?v=v2&amp;amp;px=999" role="button" title="PWM AL, Init Trigger, ADC on End Pre-Trigger 0.PNG" alt="PWM AL, Init Trigger, ADC on End Pre-Trigger 0.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The same with pre-Trigger 3000, you see the time of switching the state of the black Signal is later (this would lead to Problems because the low side IGBT isn't in conduction over the&amp;nbsp;complete measurement.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="PWM AL, Init Trigger, ADC on End Pre-Trigger 3000.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/23780i2206D54A5588C0ED/image-size/large?v=v2&amp;amp;px=999" role="button" title="PWM AL, Init Trigger, ADC on End Pre-Trigger 3000.PNG" alt="PWM AL, Init Trigger, ADC on End Pre-Trigger 3000.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The currents in freemaster:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Phasenströme Ia, Ib, Ic bei 1000rpm FreeMASTER.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/22990i873F55CDF95FCB40/image-size/large?v=v2&amp;amp;px=999" role="button" title="Phasenströme Ia, Ib, Ic bei 1000rpm FreeMASTER.PNG" alt="Phasenströme Ia, Ib, Ic bei 1000rpm FreeMASTER.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now let me ask something.&lt;/P&gt;&lt;P&gt;Obviously all the configured ADC samples are read if the pdb triggeres the adc in the middle of pwm low side Signal.&lt;/P&gt;&lt;P&gt;So also U_dcb, IPM_Temp and I dcb are read here, which requires sample time.&lt;/P&gt;&lt;P&gt;To improve the measurement it would be better only to measure I_phA and I_phB&amp;nbsp;directly with the Initialization Trigger.&lt;/P&gt;&lt;P&gt;The measurement&amp;nbsp;of the other samples U_dcb, IPM_Temp could be leter in the pwm cycle&lt;/P&gt;&lt;P&gt;Do you know a way for this, so to seperate the Timing&amp;nbsp;of reading the different samples ?&lt;/P&gt;&lt;P&gt;I'm not quite sure with I_dcb, at which Point of one PWM cycle this should be read ?&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;Leon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Mar 2018 10:17:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781036#M2162</guid>
      <dc:creator>lethuer</dc:creator>
      <dc:date>2018-03-01T10:17:22Z</dc:date>
    </item>
    <item>
      <title>Re: Module 6: Current Sensing (Part 1/2)</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781037#M2163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Leon,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Congrats!!! You current measurements looks very good/clean. In my case i had to deal with various sources of measurements noise - but in your case i see the results are quite perfect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Do you know a way for this, so to separate the Timing&amp;nbsp;of reading the different samples ?&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Yes, you can do that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;I'm not quite sure with I_dcb, at which Point of one PWM cycle this should be read ?&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;There is no bullet prof method. As for the currents you need to perform some tests to see where you can read the correct values. In general the ADC reads are quite fast so you should have plenty of time to complete the acquisition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my case on S32K i had to choose the delay by comparing the ADC acquisitions against the DC current read with an AmpMeter in series with the source.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think it would be a good idea to present your work in a separated thread once you have completed the model. We encourage everyone to do so and if you think it is appropriate you could also share your final model in that thread - its up to your if you want to give it for free or not - but i think is a good opportunity to promote your work in this space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Daniel&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Mar 2018 13:23:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781037#M2163</guid>
      <dc:creator>Daniel_Popa</dc:creator>
      <dc:date>2018-03-01T13:23:12Z</dc:date>
    </item>
    <item>
      <title>Re: Module 6: Current Sensing (Part 1/2)</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781038#M2164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P style="border: 0px currentColor; color: #51626f; background-color: #ffffff;"&gt;Do you know a way for this, so to separate the Timing&amp;nbsp;of reading the different samples ?&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Yes, you can do that.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Maybe you could show me how to do that with KV4 ?&lt;/P&gt;&lt;P&gt;With an additional pre-Trigger the End of Scan Interrupt occures two times, so with every pre Trigger all samples are read in the Moment. This might be worse for I dcb, because it would also be read while the pwm low side igbt is in conduction. I did not check the correct moment for&amp;nbsp;this measurement&amp;nbsp;quite now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;In my case on S32K i had to choose the delay by comparing the ADC acquisitions against the DC current read with an AmpMeter in series with the source&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Okay thank you for this ! If I would be&amp;nbsp;able to seperate the samples I could configure a different Moment for the I dcb sample.&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;Leon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Mar 2018 14:21:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781038#M2164</guid>
      <dc:creator>lethuer</dc:creator>
      <dc:date>2018-03-01T14:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: Module 6: Current Sensing (Part 1/2)</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781039#M2165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Leon.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry - i was rushing and i messed up.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wanted to say that you do as you planed: read the VDC and temp after reading the currents.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In theory you could do also different ADC sampling but that would require a different ADC module. In the MATLAB toolbox we only initialize the ADC once - and can't change those global setting during the run time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Mar 2018 14:30:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Module-6-Current-Sensing-Part-1-2/m-p/781039#M2165</guid>
      <dc:creator>Daniel_Popa</dc:creator>
      <dc:date>2018-03-01T14:30:31Z</dc:date>
    </item>
  </channel>
</rss>

