<?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: Events Synchronization using CTU in MPC57x (Model Based) in Model-Based Design Toolbox (MBDT)</title>
    <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Events-Synchronization-using-CTU-in-MPC57x-Model-Based/m-p/896905#M3136</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear&amp;nbsp;&lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/mariuslucianandrei"&gt;mariuslucianandrei&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The current challenge I am facing now is with CTU1. I understand that there are no external interrupts for CTU1 in&lt;/P&gt;&lt;P&gt;MPC5744P 144LQFP package but the internal interrupts should works for ADC conversion.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/72400iB8365A0798663EE5/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I selected ADC2_AN4 to test if I can start conversion from CTU1, but I failed to do so.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_3.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/73712iA9377FF866879F7E/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_3.png" alt="pastedImage_3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I tried to get the FIFO overflow event use it to toggle a GPIO but it does not work.&lt;/P&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 src="https://community.nxp.com/t5/image/serverpage/image-id/72371iC30F6FE8FC01A201/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have attached the model for you.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 May 2019 12:40:34 GMT</pubDate>
    <dc:creator>abhishek_kumar1</dc:creator>
    <dc:date>2019-05-09T12:40:34Z</dc:date>
    <item>
      <title>Events Synchronization using CTU in MPC57x (Model Based)</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Events-Synchronization-using-CTU-in-MPC57x-Model-Based/m-p/896901#M3132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have been trying to catch events from CTU where the origin in PWM and I want o start ADC conversion as following below. The model is attached.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Read PWM ABC and Fire PWM @ 20kHz =&amp;gt; T = 1/20000 = 50μs &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;a. Fire an interrupt (1) with delay of T/2 (for Centrally aligned PWM), using CTU (I cannot find Delay block or option &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for firing interrupt in CTU)&lt;BR /&gt;2. Catch the interrupt (1), start ADC conversion for Phase Currents &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;a. Fire an interrupt for End of Conversion (2)&lt;BR /&gt;3. Catch Interrupt (2) and Trigger Calculation to update PWM A B C&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;Issues&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;To see if the CTU is firing the Interrupt I made a counter to see how many times the interrupt were fired, and a GPIO to see what is the delay between PWM Edge and Start of conversion of ADC.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;Also, I was end able to find End of Conversion Interrupt in ADC which was there in previous version. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;I have attached the model for you. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;I have checked the model in Samples and was not clear for me, so I try to build my own to understand it better.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;Abhishek&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Apr 2019 07:55:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Events-Synchronization-using-CTU-in-MPC57x-Model-Based/m-p/896901#M3132</guid>
      <dc:creator>abhishek_kumar1</dc:creator>
      <dc:date>2019-04-16T07:55:39Z</dc:date>
    </item>
    <item>
      <title>Re: Events Synchronization using CTU in MPC57x (Model Based)</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Events-Synchronization-using-CTU-in-MPC57x-Model-Based/m-p/896902#M3133</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/abhishek.kumar@chassisbrakes.com"&gt;abhishek.kumar@chassisbrakes.com&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry for my delayed answer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your requirements you want to use just a half of one hardware chain PWM-&amp;gt;PDB-&amp;gt;ADC which is independent by the mcu and can provide more precise timing. In my opinion there’s no need to insert an interrupt in which to start an ADC conversion by software and to wait until the conversions are done. Besides, you can start the both ADC converters at once, so you actually can convert two different channels at the same time, but about this will talk later.&lt;/P&gt;&lt;P&gt;Let’s take it step by step.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PWM&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;To achieve the right moment when the ADC conversions must be started, you need to keep in mind the PWM period in ticks. To obtain a frequency of 20kHz the counter must have a period of 4000 ticks with no prescaling. In order to trigger an interrupt at T/2, the CTU must be delayed with 2000 ticks, since peripherals uses the same clock. So, we need to keep in mind the value 2000 for the PDB.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/80897iB16889ED48A45F5F/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The hardware also gives the ability to set the PWM Reload frequency. In all motor control examples from this toolbox you will find the reload frequency of 2. So every second reload point the PWM triggers the CTU. This value can be changed from the “Reload frequency” field in the PWM Config Block.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_3.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/80898i00FF119EEB75DFBA/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_3.png" alt="pastedImage_3.png" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;And just a little remark here: By default, the submodules of a PWM module are not synchronized together because they are using different counters. This can be a nightmare when you need to control a motor. In order to sync them, you need to set them like so: submodule 0 must have the Counter init field as “Local sync” and the others must have the “Sub-module 0 master sync” option selected.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_4.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/80900i3D85F554E095DF63/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_4.png" alt="pastedImage_4.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;CTU&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Here we need explain a little bit how it works and where to insert the delay: each CTU module acts like this: when the trigger appears, it starts a counter incremented by the same clock as the PWM. The prescaler is 1, the same with the one used fot the PWM. So we need to wait 2000 ticks in order to trigger the ADC at the exactly T/2 period. Now, the CTU can have 8 different triggers. For this example we will choose the Triggered mode. We can start all three ADC channels conversion from the same trigger.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_6.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/80901iDA19F50BE43B6185/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_6.png" alt="pastedImage_6.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;We enabled the Trigger 0 and set the compare value at 2000. So, when the PWM triggers the CTU, it will start counting and when matches the 2000 value it will trigger the ADC conversions with the index between Start and Stop. The pin PTC14 from the Pins tab is enabled to be toggled by the Trigger 0 by checking the “External Output enable” checkbox.&lt;/P&gt;&lt;P&gt;If the “ADC enable” is also checked, you need to set an &lt;EM&gt;Index Start&lt;/EM&gt; and an &lt;EM&gt;Index Stop&lt;/EM&gt;.&amp;nbsp; Now, you need to think like this: In the ADC Commands tab, it can be inserted up to 24 ADC commands. Imagine all those 24 commands like an array of ADC Commands. So the Index start and Stop represents the ADC Index which will be converted first and the ADC index which will be last converted.&lt;/P&gt;&lt;P&gt;For example if the Index start is 0 and Index stop is 2 it will convert the ADC Index 0 configuration, the ADC index 1 config and last ADC Index 2 config.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_9.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/80902iE3F5223325AF1BE2/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_9.png" alt="pastedImage_9.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Each ADC index Configuration can set the following: the FIFO index in which the conversion result will be stored, if is Single conversion ( Port A – ADC0, Port B – ADC1) and the channel port (ADC_AN11 -11 must be typed there) or Double conversion in which you need to provide the channels ports for each ADC0 and ADC1.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_10.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/80903i583241CC9E6F3C3A/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_10.png" alt="pastedImage_10.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Now, the Fifo configurations gives the opportunity to set a threshold number of values&amp;nbsp;over which to get an&amp;nbsp;interrupt whenever the overflow appears. You know that you have 3 values to convert, so when the fifo contains 3 values it will trigger an interrupt.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ADC&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;Must be set in the CTU control mode and all the channels selected in order to initialize the pins. Now, to get all the converted values, you must use the CTU Get Converstion Result block. This pop a result from the selected Fifo and must be used for each value needed. For example for 3 conversion results you need to use this block three times in the same interrupt. It also can retuen the ADC port and the Channel Number to know exactly which value you've pop.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_12.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/80904i06C108F8A608631E/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_12.png" alt="pastedImage_12.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Another thing I have found is that you need to set the block priorities in order to generate the ADC code before the CTU.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Marius&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Apr 2019 07:13:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Events-Synchronization-using-CTU-in-MPC57x-Model-Based/m-p/896902#M3133</guid>
      <dc:creator>mariuslucianand</dc:creator>
      <dc:date>2019-04-25T07:13:18Z</dc:date>
    </item>
    <item>
      <title>Re: Events Synchronization using CTU in MPC57x (Model Based)</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Events-Synchronization-using-CTU-in-MPC57x-Model-Based/m-p/896903#M3134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/mariuslucianandrei"&gt;mariuslucianandrei&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;Thank you for the answer, I was trying o open the model you attached but it seems it was created in 2019a.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;Is it possible for you to send be 2018b model? You can just export in older version. I do not have 2019a&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;There are a few things I do not understand in the explanation of your answer. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background: yellow; font-size: 11.5pt;"&gt;&lt;EM&gt;Now, the CTU can have 8 different triggers. For this example we will choose the Triggered mode. We can start all three ADC channels conversion from the same trigger.&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background: white; font-size: 11.5pt;"&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;What are these triggers? And which one shall I chose for ADC 0 conversion and ADC 1 Conversion etc…? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;Below is CTU Diagram. Form this I cannot make out which Trigger corresponds to which ADC channel. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/70262i23BC0A866B52A15F/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background: white;"&gt;&lt;SPAN style="color: #51626f; background: yellow; font-size: 11.5pt;"&gt;&lt;EM&gt;Each ADC index Configuration can set the following: the FIFO index in which the conversion result will be stored, if is Single conversion ( Port A – ADC0, Port B – ADC1) and the channel port (ADC_AN11 -11 must be typed there) or Double conversion in which you need to provide the channels ports for each ADC0 and ADC1.&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background: white;"&gt;&lt;SPAN style="color: #51626f; background: yellow; font-size: 11.5pt;"&gt;&lt;EM&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_10.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/70356iBED55109328EC7AA/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_10.png" alt="pastedImage_10.png" /&gt;&lt;/span&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background: white;"&gt;&lt;SPAN style="color: #51626f; background: yellow; font-size: 11.5pt;"&gt;&lt;EM&gt;Now, the Fifo configurations gives the opportunity to set a threshold number of values&amp;nbsp;over which to get an&amp;nbsp;interrupt whenever the overflow appears. You know that you have 3 values to convert, so when the fifo contains 3 values it will trigger an interrupt.&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;What is the need for this overflow interrupt, when there already an interrupt after 2000 ticks?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;I have followed your instructions and created a model (as attached)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;On&amp;nbsp;PWMA, I provide 100% duty cycle so you can see the deadtime (as seen in screenshot below)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;And I toggle GPO on and Off (blue graph in screenshot below) when CTU fires interrupt for ADC Command)&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;SPAN style="color: #1f497d; text-decoration: underline;"&gt;My observation&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;When I measure the time between deadtime and start of GPO Toggle, I seen 29ms (which is not the half of 50 ms (20 kHz))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;There is a delay of 4 ms in processing of the interrupt.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;What could be the reason for this?&lt;/SPAN&gt;&lt;/P&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 src="https://community.nxp.com/t5/image/serverpage/image-id/73182iD06D935EC8EF356D/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;Abhishek&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Apr 2019 13:27:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Events-Synchronization-using-CTU-in-MPC57x-Model-Based/m-p/896903#M3134</guid>
      <dc:creator>abhishek_kumar1</dc:creator>
      <dc:date>2019-04-29T13:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: Events Synchronization using CTU in MPC57x (Model Based)</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Events-Synchronization-using-CTU-in-MPC57x-Model-Based/m-p/896904#M3135</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/abhishek.kumar@chassisbrakes.com"&gt;abhishek.kumar@chassisbrakes.com&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry for adding the model in 2019a version, I've attached the model for the previous response exported in 2018b version.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the model attached, unfortunately right now I don't have a scope, so I will be able to have a look on it on Monday, when I get back to the office.&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I'll try to respond your wuestions:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;What are these triggers? And which one shall I chose for ADC 0 conversion and ADC 1 Conversion etc…? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;Below is CTU Diagram. Form this I cannot make out which Trigger corresponds to which ADC channel. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/75564i5AEAA2DB6D41207F/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;In the RM at &lt;STRONG&gt;41.6.1 Trigger Generator subunit (TGS)&lt;/STRONG&gt; it says that in&amp;nbsp;&lt;STRONG&gt;Triggered mode&lt;/STRONG&gt;: each event source generates up to eight trigger event outputs. This means that each CTU module is able to provide 8 different actions (triggers) like triggering an ADC conversion.&amp;nbsp; But for ADC you can have a list of commands and every command to have one channel from ADC A or ADC B (ADC0 and ADC1) or two channels in Double conversion, each from ADCA or ADCB.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;And this is happening like this: Let's say you have enabled Trigger 0 (Compare Value: 1000) and Trigger 1(Compare Value: 2000). When the Input Trigger appear ( the reload of the PWM) the CTU counter starts and when it reaches the value 1000, it takes the actions from Trigger 0 (start converting the ADC list). The CTU counter continue counting and when it reaches value 2000 it takes the Trigger 1 actions.&amp;nbsp;&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 style="background: white;"&gt;&lt;SPAN style="color: #51626f; background: yellow; font-size: 11.5pt;"&gt;&lt;EM&gt;Each ADC index Configuration can set the following: the FIFO index in which the conversion result will be stored, if is Single conversion ( Port A – ADC0, Port B – ADC1) and the channel port (ADC_AN11 -11 must be typed there) or Double conversion in which you need to provide the channels ports for each ADC0 and ADC1.&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background: white;"&gt;&lt;SPAN style="color: #51626f; background: yellow; font-size: 11.5pt;"&gt;&lt;EM&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_10.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/75532i783EDBB15DD40F87/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_10.png" alt="pastedImage_10.png" /&gt;&lt;/span&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background: white;"&gt;&lt;SPAN style="color: #51626f; background: yellow; font-size: 11.5pt;"&gt;&lt;EM&gt;Now, the Fifo configurations gives the opportunity to set a threshold number of values&amp;nbsp;over which to get an&amp;nbsp;interrupt whenever the overflow appears. You know that you have 3 values to convert, so when the fifo contains 3 values it will trigger an interrupt.&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;What is the need for this overflow interrupt, when there already an interrupt after 2000 ticks?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;I have followed your instructions and created a model (as attached)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;On&amp;nbsp;PWMA, I provide 100% duty cycle so you can see the deadtime (as seen in screenshot below)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;And I toggle GPO on and Off (blue graph in screenshot below) when CTU fires interrupt for ADC Command)&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;SPAN style="color: #1f497d; text-decoration: underline;"&gt;My observation&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;When I measure the time between deadtime and start of GPO Toggle, I seen 29ms (which is not the half of 50 ms (20 kHz))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;There is a delay of 4 ms in processing of the interrupt.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;What could be the reason for this?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;I think I know where the misunderstanding is: The trigger event is different than the Overflow interrupt! So when the Trigger 0 matches the value with the CTU Counter 2000, in that moment the CTU starts the ADC Conversion. This is, let's say, the 2000 interrupt. I advise you to use the Overflow Interrupt on FiFo instead, because it is triggered a bit later than the 2000 value, when you have all the ADC values converted and ready to be used. I don;t know on which channel&amp;nbsp; it triggers the ADC interrupt since you enabled in your second model on each of then, but you need to consider also the ADC conversion time.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;Hope this helps you,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;Marius&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Apr 2019 17:55:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Events-Synchronization-using-CTU-in-MPC57x-Model-Based/m-p/896904#M3135</guid>
      <dc:creator>mariuslucianand</dc:creator>
      <dc:date>2019-04-30T17:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: Events Synchronization using CTU in MPC57x (Model Based)</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Events-Synchronization-using-CTU-in-MPC57x-Model-Based/m-p/896905#M3136</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear&amp;nbsp;&lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/mariuslucianandrei"&gt;mariuslucianandrei&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The current challenge I am facing now is with CTU1. I understand that there are no external interrupts for CTU1 in&lt;/P&gt;&lt;P&gt;MPC5744P 144LQFP package but the internal interrupts should works for ADC conversion.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/72400iB8365A0798663EE5/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I selected ADC2_AN4 to test if I can start conversion from CTU1, but I failed to do so.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_3.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/73712iA9377FF866879F7E/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_3.png" alt="pastedImage_3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I tried to get the FIFO overflow event use it to toggle a GPIO but it does not work.&lt;/P&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 src="https://community.nxp.com/t5/image/serverpage/image-id/72371iC30F6FE8FC01A201/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have attached the model for you.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 May 2019 12:40:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Events-Synchronization-using-CTU-in-MPC57x-Model-Based/m-p/896905#M3136</guid>
      <dc:creator>abhishek_kumar1</dc:creator>
      <dc:date>2019-05-09T12:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: Events Synchronization using CTU in MPC57x (Model Based)</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Events-Synchronization-using-CTU-in-MPC57x-Model-Based/m-p/896906#M3137</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/abhishek.kumar@chassisbrakes.com"&gt;abhishek.kumar@chassisbrakes.com&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are trying to achieve the following chain FlexPWM0-&amp;gt;CTU1-&amp;gt;ADC2 which I think is wrong.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you are trying to use the FlexPWM1-&amp;gt;CTU1-&amp;gt;ADC2, then the chain is valid and the board is measuring the ADC value.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A&amp;nbsp;real explanation of the FlexPWM0/1 to CTU0/1 relation in this&amp;nbsp;&amp;nbsp;&lt;A href="https://www.nxp.com/docs/en/application-note/AN12017.pdf"&gt;Application note&lt;/A&gt;&amp;nbsp;@ page 15 :&lt;/P&gt;&lt;P&gt;"The MRS signal generated from the FlexPWM_0 0 and FlexPWM_1 module is internally routed to the CTU_0 and CTU_1 module respectively."&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, in the Reference Manual &lt;STRONG&gt;Figure 7-6. CTU inter-module connections -&amp;nbsp;Chapter 7 Chip Configuration -&amp;nbsp;MPC5744P Reference Manual, Rev. 6, 06/2016&amp;nbsp;&lt;/STRONG&gt;you can find an schematic.&amp;nbsp;&lt;/P&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 src="https://community.nxp.com/t5/image/serverpage/image-id/80367i0A512EDA091D26F3/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Marius&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 May 2019 17:44:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Events-Synchronization-using-CTU-in-MPC57x-Model-Based/m-p/896906#M3137</guid>
      <dc:creator>mariuslucianand</dc:creator>
      <dc:date>2019-05-09T17:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: Events Synchronization using CTU in MPC57x (Model Based)</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Events-Synchronization-using-CTU-in-MPC57x-Model-Based/m-p/896907#M3138</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello，Marius&lt;/P&gt;&lt;P&gt;I have a little confuse about the&amp;nbsp; compare value between the general&amp;nbsp; and triggers configuration， like following：&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/109856iED38B7734A0DD8F3/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;the value here 4000 means that the counter will up to 4000 and reload 0, if it is less than 20KHz(4000 ticks),&lt;/P&gt;&lt;P&gt;But the demo pwm_ctu_adc_mpc574xP here is set to 16000. what is the meaning of that？&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/109885i7BA3FF93D6A381F4/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The value here 2000 is as explained above, when the counter is up to 2000. the trigger 0 is started.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;best regards&lt;/P&gt;&lt;P&gt;hao&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 09 Aug 2020 08:32:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Events-Synchronization-using-CTU-in-MPC57x-Model-Based/m-p/896907#M3138</guid>
      <dc:creator>haoxue1027</dc:creator>
      <dc:date>2020-08-09T08:32:49Z</dc:date>
    </item>
  </channel>
</rss>

