<?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>NXP DesignsのトピックHow to generate 5 injection pulses using eTPU's QOM mode</title>
    <link>https://community.nxp.com/t5/NXP-Designs/How-to-generate-5-injection-pulses-using-eTPU-s-QOM-mode/m-p/1042096#M397</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to produce five pulses, but no matter how you debug them, I only produce one pulse.&lt;/P&gt;&lt;P&gt;I'm using the code in the following example.&lt;/P&gt;&lt;P&gt;How can I change this code to achieve the effect I want?&lt;/P&gt;&lt;P&gt;/**************************************************************************&lt;BR /&gt; * FILE NAME: $RCSfile: qom_example2.c,v $ COPYRIGHT (c) FREESCALE 2004 *&lt;BR /&gt; * DESCRIPTION: All Rights Reserved *&lt;BR /&gt; * This is a sample MPC5500 program to show a more complex use of the *&lt;BR /&gt; * eTPU QOM function. *&lt;BR /&gt; *========================================================================*&lt;BR /&gt; * ORIGINAL AUTHOR: Geoff Emerson (r47354) *&lt;BR /&gt; * $Log: qom_example2.c,v $&lt;BR /&gt; * Revision 1.3 2004/12/02 15:22:58 r47354&lt;BR /&gt; * Added #include "mpc5554_vars.h"&lt;BR /&gt; *&lt;BR /&gt; * Revision 1.2 2004/11/11 14:29:49 r47354&lt;BR /&gt; * Tidy up and formatting.&lt;BR /&gt; *&lt;BR /&gt; * Revision 1.1 2004/11/09 11:17:41 r47354&lt;BR /&gt; * No changes to code, just updated for CVS and checked into CVS.&lt;BR /&gt; *........................................................................*&lt;BR /&gt; * 0.1 G.Emerson 28/Apr/04 Initial version. *&lt;BR /&gt; * 0.2 Updated for new build structure. *&lt;BR /&gt; * 0.3 G.Emerson 25/June/04 Add FS_ to macros *&lt;BR /&gt; * 0.4 G.Emerson 16/July/04 Demonstrate TEST running across engines*&lt;BR /&gt; * 0.5 G.Emerson 28/Oct/04 Fix interrupt bit clearing *&lt;BR /&gt; * Fix include paths *&lt;BR /&gt; **************************************************************************/&lt;/P&gt;&lt;P&gt;#include "mpc5554.h" /* mpc5554 register definitions */&lt;BR /&gt;#include "etpu_util.h" /* Utility routines for working with eTPU */&lt;BR /&gt;#include "fs_gpio.h" /* GPIO API for the MPC5500 family*/&lt;BR /&gt;#include "etpu_set1.h" /* eTPU standard function set 1 */&lt;BR /&gt;#include "etpu_qom.h" /* eTPU QOM API */&lt;/P&gt;&lt;P&gt;#include "mpc5554_vars.h"&lt;/P&gt;&lt;P&gt;#include "etpu_test.h" /*eTPU TEST API */&lt;/P&gt;&lt;P&gt;/* User written include files */&lt;BR /&gt;#include "qom_example2.h" /*include application specific defines. */&lt;/P&gt;&lt;P&gt;#define ETPU_OUTPUT_PAD_CONFIG FS_GPIO_PRIMARY_FUNCTION + \&lt;BR /&gt; FS_GPIO_MAXIMUM_SLEW_RATE + \&lt;BR /&gt; FS_GPIO_OUTPUT_DRAIN_DISABLE + \&lt;BR /&gt; FS_GPIO_READBACK_ENABLE + \&lt;BR /&gt; FS_GPIO_OUTPUT_BUFFER_ENABLE&lt;BR /&gt; &lt;BR /&gt;union etpu_events_array my_QOM_event_arrayA[QOM_arrayA_size];&lt;BR /&gt;union etpu_events_array my_QOM_event_arrayB[QOM_arrayB_size];&lt;BR /&gt;union etpu_events_array my_QOM_event_arrayC[QOM_arrayC_size];&lt;/P&gt;&lt;P&gt;union etpu_events_array my_QOM_event_arrayA[QOM_arrayA_size] =&lt;BR /&gt; { (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_HIGH,&lt;BR /&gt; (0x008000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_LOW,&lt;BR /&gt; (0x004000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_HIGH,&lt;BR /&gt; (0x002000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_LOW,&lt;BR /&gt; (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_HIGH,&lt;BR /&gt; (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_LOW,&lt;BR /&gt; (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_HIGH&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;union etpu_events_array my_QOM_event_arrayB[QOM_arrayB_size] =&lt;BR /&gt; { (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_LOW,&lt;BR /&gt; (0x008000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_HIGH,&lt;BR /&gt; (0x004000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_LOW,&lt;BR /&gt; (0x002000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_HIGH,&lt;BR /&gt; (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_LOW,&lt;BR /&gt; (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_HIGH,&lt;BR /&gt; (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_LOW&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;union etpu_events_array my_QOM_event_arrayC[QOM_arrayC_size] =&lt;BR /&gt; { (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_LOW,&lt;BR /&gt; (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_HIGH,&lt;BR /&gt; (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_LOW,&lt;BR /&gt; (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_HIGH,&lt;BR /&gt; (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_LOW,&lt;BR /&gt; (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_HIGH,&lt;BR /&gt; (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_LOW&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;int32_t init_error; /*initialization error code. */&lt;BR /&gt;uint32_t *fs_free_param;&lt;/P&gt;&lt;P&gt;main ()&lt;BR /&gt;{&lt;BR /&gt; uint8_t chan;&lt;BR /&gt; uint32_t *QOM0_ram_ptr, *QOM0_last_match_ptr;&lt;BR /&gt; int32_t error_code;&lt;BR /&gt; int32_t x10, y10; /*these are used to generate a delay*/&lt;BR /&gt; vuint16_t *upper_SCR16;&lt;BR /&gt; vuint32_t *upper_SCR32;&lt;/P&gt;&lt;P&gt;FMPLL.SYNCR.R = 0x06000000; /* MFD = 0b110, RFD=0b000, 8MHz*16=128MHz */&lt;/P&gt;&lt;P&gt;/* initialize eTPU hardware */&lt;BR /&gt; fs_etpu_init (my_etpu_config, (uint32_t *) etpu_code, sizeof (etpu_code),&lt;BR /&gt; (uint32_t *) etpu_globals, sizeof (etpu_globals));&lt;/P&gt;&lt;P&gt;/* enable all timebases */&lt;BR /&gt; fs_timer_start ();&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/*clear interrupt and DTR flags*/&lt;BR /&gt; for (chan = 0; chan &amp;lt; 63; chan++)&lt;BR /&gt; {&lt;BR /&gt; upper_SCR32 = &amp;amp;ETPU.CHAN[chan].SCR.R;&lt;BR /&gt; upper_SCR16 = (vuint16_t *) upper_SCR32;&lt;BR /&gt; *upper_SCR16 = 0xC0C0; /* clear DMA/interrupt service request */&lt;BR /&gt; fs_etpu_disable (chan); /*disable all channels */&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/* configure the pins on the MPC5554 */&lt;BR /&gt; fs_gpio_config (FS_GPIO_ETPUA2, ETPU_OUTPUT_PAD_CONFIG);&lt;BR /&gt; fs_gpio_config (FS_GPIO_ETPUA4, ETPU_OUTPUT_PAD_CONFIG);&lt;BR /&gt; fs_gpio_config (FS_GPIO_ETPUA10, ETPU_OUTPUT_PAD_CONFIG);&lt;BR /&gt; fs_gpio_config (FS_GPIO_ETPUA16, ETPU_OUTPUT_PAD_CONFIG);&lt;BR /&gt; fs_gpio_config (FS_GPIO_ETPUA22, ETPU_OUTPUT_PAD_CONFIG);&lt;BR /&gt; fs_gpio_config (FS_GPIO_ETPUA28, ETPU_OUTPUT_PAD_CONFIG);&lt;/P&gt;&lt;P&gt;error_code =&lt;BR /&gt; fs_etpu_qom_init (QOM0,&lt;BR /&gt; FS_ETPU_PRIORITY_MIDDLE,&lt;BR /&gt; FS_ETPU_QOM_SINGLE_SHOT,&lt;BR /&gt; FS_ETPU_TCR1,&lt;BR /&gt; FS_ETPU_QOM_INIT_PIN_LOW,&lt;BR /&gt; FS_ETPU_QOM_IMMEDIATE,&lt;BR /&gt; (uint32_t *) 0,&lt;BR /&gt; 0, &lt;BR /&gt; QOM_arrayA_size, &lt;BR /&gt; my_QOM_event_arrayA);&lt;BR /&gt; if (error_code != 0)&lt;BR /&gt; return (QOM0 + 1);&lt;/P&gt;&lt;P&gt;while (ETPU.CHAN[QOM0].SCR.B.CIS == 0)&lt;BR /&gt; {&lt;BR /&gt; /*wait for QOM0 to finish */&lt;BR /&gt; /*WARNING: Endless loop is possible */&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;QOM0_ram_ptr = fs_etpu_data_ram (QOM0);&lt;BR /&gt; QOM0_last_match_ptr =&lt;BR /&gt; (uint32_t *) ((uint32_t) QOM0_ram_ptr - (uint32_t) &amp;amp; ETPU_DATA_RAM +&lt;BR /&gt; FS_ETPU_QOM_LAST_MATCH_TIME_OFFSET);&lt;/P&gt;&lt;P&gt;for (x10 = 1; x10 &amp;lt; 20000; x10++)&lt;BR /&gt; {&lt;BR /&gt; y10 = x10 + 2;&lt;BR /&gt; y10 = x10 - 2;&lt;BR /&gt; } /* add delay to demonstrate immediate versus ref_addr */&lt;/P&gt;&lt;P&gt;error_code =&lt;BR /&gt; fs_etpu_qom_init (QOM2,&lt;BR /&gt; FS_ETPU_PRIORITY_MIDDLE,&lt;BR /&gt; FS_ETPU_QOM_CONTINUOUS_A,&lt;BR /&gt; FS_ETPU_TCR1,&lt;BR /&gt; FS_ETPU_QOM_INIT_PIN_HIGH,&lt;BR /&gt; FS_ETPU_QOM_IMMEDIATE,&lt;BR /&gt; (uint32_t *) 0,&lt;BR /&gt; 0, &lt;BR /&gt; QOM_arrayB_size, &lt;BR /&gt; my_QOM_event_arrayB);&lt;BR /&gt; if (error_code != 0)&lt;BR /&gt; return (QOM2 + 1);&lt;/P&gt;&lt;P&gt;error_code =&lt;BR /&gt; fs_etpu_qom_init (QOM1,&lt;BR /&gt; FS_ETPU_PRIORITY_MIDDLE,&lt;BR /&gt; FS_ETPU_QOM_SINGLE_SHOT,&lt;BR /&gt; FS_ETPU_TCR1,&lt;BR /&gt; FS_ETPU_QOM_INIT_PIN_HIGH,&lt;BR /&gt; FS_ETPU_QOM_USE_REF_ADDRESS,&lt;BR /&gt; QOM0_last_match_ptr,&lt;BR /&gt; 0, &lt;BR /&gt; QOM_arrayB_size, &lt;BR /&gt; my_QOM_event_arrayB);&lt;BR /&gt; if (error_code != 0)&lt;BR /&gt; return (QOM1 + 1);&lt;/P&gt;&lt;P&gt;/*initialise QOM3 to recieve a link*/&lt;BR /&gt; error_code =&lt;BR /&gt; fs_etpu_qom_init (QOM3,&lt;BR /&gt; FS_ETPU_PRIORITY_MIDDLE,&lt;BR /&gt; FS_ETPU_QOM_SINGLE_SHOT,&lt;BR /&gt; FS_ETPU_TCR1,&lt;BR /&gt; FS_ETPU_QOM_INIT_PIN_HIGH_LINK,&lt;BR /&gt; FS_ETPU_QOM_IMMEDIATE,&lt;BR /&gt; (uint32_t *) 0,&lt;BR /&gt; 0, &lt;BR /&gt; QOM_arrayB_size, &lt;BR /&gt; my_QOM_event_arrayB);&lt;BR /&gt; if (error_code != 0)&lt;BR /&gt; return (QOM3 + 1);&lt;/P&gt;&lt;P&gt;/*initialise QOM4 to recieve a link*/&lt;/P&gt;&lt;P&gt;error_code =&lt;BR /&gt; fs_etpu_qom_init (QOM4,&lt;BR /&gt; FS_ETPU_PRIORITY_MIDDLE,&lt;BR /&gt; FS_ETPU_QOM_LOOP,&lt;BR /&gt; FS_ETPU_TCR1,&lt;BR /&gt; FS_ETPU_QOM_INIT_PIN_LOW_LINK,&lt;BR /&gt; FS_ETPU_QOM_IMMEDIATE,&lt;BR /&gt; (uint32_t *) 0,&lt;BR /&gt; 2, /* number of loops */&lt;BR /&gt; QOM_arrayB_size, &lt;BR /&gt; my_QOM_event_arrayB);&lt;BR /&gt; if (error_code != 0)&lt;BR /&gt; return (QOM4 + 1);&lt;/P&gt;&lt;P&gt;error_code =&lt;BR /&gt; fs_etpu_qom_init (QOM5,&lt;BR /&gt; FS_ETPU_PRIORITY_MIDDLE,&lt;BR /&gt; FS_ETPU_QOM_CONTINUOUS,&lt;BR /&gt; FS_ETPU_TCR1,&lt;BR /&gt; FS_ETPU_QOM_INIT_PIN_NO_CHANGE_LINK,&lt;BR /&gt; FS_ETPU_QOM_IMMEDIATE,&lt;BR /&gt; (uint32_t *) 0,&lt;BR /&gt; 0, &lt;BR /&gt; QOM_arrayB_size, &lt;BR /&gt; my_QOM_event_arrayB);&lt;BR /&gt; if (error_code != 0)&lt;BR /&gt; return (QOM5 + 1);&lt;/P&gt;&lt;P&gt;/* now send link to channel QOM3 ; wait for it to finish then do new pulse &lt;BR /&gt; stream relative to last match*/&lt;BR /&gt; fs_etpu_test (TEST0 + 64 + 128, QOM3, FS_ETPU_TEST_GENERATE_LINK);&lt;BR /&gt; while (ETPU.CHAN[QOM3].SCR.B.CIS == 0)&lt;BR /&gt; {&lt;BR /&gt; /*wait for QOM3 to finish */&lt;BR /&gt; /*WARNING: Endless loop is possible */ &lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;error_code =&lt;BR /&gt; fs_etpu_qom_init (QOM3,&lt;BR /&gt; FS_ETPU_PRIORITY_MIDDLE,&lt;BR /&gt; FS_ETPU_QOM_SINGLE_SHOT,&lt;BR /&gt; FS_ETPU_TCR1,&lt;BR /&gt; FS_ETPU_QOM_INIT_PIN_NO_CHANGE,&lt;BR /&gt; FS_ETPU_QOM_USE_LAST_EVENT,&lt;BR /&gt; (uint32_t *) 0,&lt;BR /&gt; 0, &lt;BR /&gt; QOM_arrayC_size, &lt;BR /&gt; my_QOM_event_arrayC);&lt;/P&gt;&lt;P&gt;for (x10 = 1; x10 &amp;lt; 80000; x10++)&lt;BR /&gt; {&lt;BR /&gt; y10 = x10 + 2;&lt;BR /&gt; y10 = x10 - 2;&lt;BR /&gt; } /* add delay&lt;BR /&gt; /* now send link to channel QOM4/5 */&lt;BR /&gt; fs_etpu_test (TEST0 + 64 + 128, QOM4, FS_ETPU_TEST_GENERATE_LINK);&lt;/P&gt;&lt;P&gt;fs_etpu_test (TEST0 + 64 + 128, QOM5, FS_ETPU_TEST_GENERATE_LINK);&lt;/P&gt;&lt;P&gt;/* now send link to channel QOM4/5 before it has completed &lt;BR /&gt; (test LSR_flag functionality)*/&lt;BR /&gt; for (x10 = 1; x10 &amp;lt; 80000; x10++)&lt;BR /&gt; {&lt;BR /&gt; y10 = x10 + 2;&lt;BR /&gt; y10 = x10 - 2;&lt;BR /&gt; }&lt;BR /&gt; fs_etpu_test (TEST0 + 64 + 128, QOM4, FS_ETPU_TEST_GENERATE_LINK);&lt;/P&gt;&lt;P&gt;fs_etpu_test (TEST0 + 64 + 128, QOM5, FS_ETPU_TEST_GENERATE_LINK);&lt;/P&gt;&lt;P&gt;/*wait until QOM4 has fininshed then try sending another link - nothing &lt;BR /&gt; should happen due to LSR_flag functionality.*/&lt;BR /&gt; while (ETPU.CHAN[QOM4].SCR.B.CIS == 0)&lt;BR /&gt; {&lt;BR /&gt; /*wait for QOM4 to finish */&lt;BR /&gt; /*WARNING: Endless loop is possible */&lt;BR /&gt; }&lt;BR /&gt; fs_etpu_test (TEST0 + 64 + 128, QOM4, FS_ETPU_TEST_GENERATE_LINK);&lt;/P&gt;&lt;P&gt;for (;;); /*Foo. */&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;/*********************************************************************&lt;BR /&gt; *&lt;BR /&gt; * Copyright:&lt;BR /&gt; * Freescale Semiconductor, INC. All Rights Reserved.&lt;BR /&gt; * You are hereby granted a copyright license to use, modify, and&lt;BR /&gt; * distribute the SOFTWARE so long as this entire notice is&lt;BR /&gt; * retained without alteration in any modified and/or redistributed&lt;BR /&gt; * versions, and that such modified versions are clearly identified&lt;BR /&gt; * as such. No licenses are granted by implication, estoppel or&lt;BR /&gt; * otherwise under any patents or trademarks of Freescale&lt;BR /&gt; * Semiconductor, Inc. This software is provided on an "AS IS"&lt;BR /&gt; * basis and without warranty.&lt;BR /&gt; *&lt;BR /&gt; * To the maximum extent permitted by applicable law, Freescale&lt;BR /&gt; * Semiconductor DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,&lt;BR /&gt; * INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A&lt;BR /&gt; * PARTICULAR PURPOSE AND ANY WARRANTY AGAINST INFRINGEMENT WITH&lt;BR /&gt; * REGARD TO THE SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)&lt;BR /&gt; * AND ANY ACCOMPANYING WRITTEN MATERIALS.&lt;BR /&gt; *&lt;BR /&gt; * To the maximum extent permitted by applicable law, IN NO EVENT&lt;BR /&gt; * SHALL Freescale Semiconductor BE LIABLE FOR ANY DAMAGES WHATSOEVER&lt;BR /&gt; * (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,&lt;BR /&gt; * BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER&lt;BR /&gt; * PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.&lt;BR /&gt; *&lt;BR /&gt; * Freescale Semiconductor assumes no responsibility for the&lt;BR /&gt; * maintenance and support of this software&lt;BR /&gt; ********************************************************************/&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Apr 2020 09:11:11 GMT</pubDate>
    <dc:creator>709458227</dc:creator>
    <dc:date>2020-04-01T09:11:11Z</dc:date>
    <item>
      <title>How to generate 5 injection pulses using eTPU's QOM mode</title>
      <link>https://community.nxp.com/t5/NXP-Designs/How-to-generate-5-injection-pulses-using-eTPU-s-QOM-mode/m-p/1042096#M397</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to produce five pulses, but no matter how you debug them, I only produce one pulse.&lt;/P&gt;&lt;P&gt;I'm using the code in the following example.&lt;/P&gt;&lt;P&gt;How can I change this code to achieve the effect I want?&lt;/P&gt;&lt;P&gt;/**************************************************************************&lt;BR /&gt; * FILE NAME: $RCSfile: qom_example2.c,v $ COPYRIGHT (c) FREESCALE 2004 *&lt;BR /&gt; * DESCRIPTION: All Rights Reserved *&lt;BR /&gt; * This is a sample MPC5500 program to show a more complex use of the *&lt;BR /&gt; * eTPU QOM function. *&lt;BR /&gt; *========================================================================*&lt;BR /&gt; * ORIGINAL AUTHOR: Geoff Emerson (r47354) *&lt;BR /&gt; * $Log: qom_example2.c,v $&lt;BR /&gt; * Revision 1.3 2004/12/02 15:22:58 r47354&lt;BR /&gt; * Added #include "mpc5554_vars.h"&lt;BR /&gt; *&lt;BR /&gt; * Revision 1.2 2004/11/11 14:29:49 r47354&lt;BR /&gt; * Tidy up and formatting.&lt;BR /&gt; *&lt;BR /&gt; * Revision 1.1 2004/11/09 11:17:41 r47354&lt;BR /&gt; * No changes to code, just updated for CVS and checked into CVS.&lt;BR /&gt; *........................................................................*&lt;BR /&gt; * 0.1 G.Emerson 28/Apr/04 Initial version. *&lt;BR /&gt; * 0.2 Updated for new build structure. *&lt;BR /&gt; * 0.3 G.Emerson 25/June/04 Add FS_ to macros *&lt;BR /&gt; * 0.4 G.Emerson 16/July/04 Demonstrate TEST running across engines*&lt;BR /&gt; * 0.5 G.Emerson 28/Oct/04 Fix interrupt bit clearing *&lt;BR /&gt; * Fix include paths *&lt;BR /&gt; **************************************************************************/&lt;/P&gt;&lt;P&gt;#include "mpc5554.h" /* mpc5554 register definitions */&lt;BR /&gt;#include "etpu_util.h" /* Utility routines for working with eTPU */&lt;BR /&gt;#include "fs_gpio.h" /* GPIO API for the MPC5500 family*/&lt;BR /&gt;#include "etpu_set1.h" /* eTPU standard function set 1 */&lt;BR /&gt;#include "etpu_qom.h" /* eTPU QOM API */&lt;/P&gt;&lt;P&gt;#include "mpc5554_vars.h"&lt;/P&gt;&lt;P&gt;#include "etpu_test.h" /*eTPU TEST API */&lt;/P&gt;&lt;P&gt;/* User written include files */&lt;BR /&gt;#include "qom_example2.h" /*include application specific defines. */&lt;/P&gt;&lt;P&gt;#define ETPU_OUTPUT_PAD_CONFIG FS_GPIO_PRIMARY_FUNCTION + \&lt;BR /&gt; FS_GPIO_MAXIMUM_SLEW_RATE + \&lt;BR /&gt; FS_GPIO_OUTPUT_DRAIN_DISABLE + \&lt;BR /&gt; FS_GPIO_READBACK_ENABLE + \&lt;BR /&gt; FS_GPIO_OUTPUT_BUFFER_ENABLE&lt;BR /&gt; &lt;BR /&gt;union etpu_events_array my_QOM_event_arrayA[QOM_arrayA_size];&lt;BR /&gt;union etpu_events_array my_QOM_event_arrayB[QOM_arrayB_size];&lt;BR /&gt;union etpu_events_array my_QOM_event_arrayC[QOM_arrayC_size];&lt;/P&gt;&lt;P&gt;union etpu_events_array my_QOM_event_arrayA[QOM_arrayA_size] =&lt;BR /&gt; { (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_HIGH,&lt;BR /&gt; (0x008000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_LOW,&lt;BR /&gt; (0x004000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_HIGH,&lt;BR /&gt; (0x002000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_LOW,&lt;BR /&gt; (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_HIGH,&lt;BR /&gt; (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_LOW,&lt;BR /&gt; (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_HIGH&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;union etpu_events_array my_QOM_event_arrayB[QOM_arrayB_size] =&lt;BR /&gt; { (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_LOW,&lt;BR /&gt; (0x008000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_HIGH,&lt;BR /&gt; (0x004000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_LOW,&lt;BR /&gt; (0x002000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_HIGH,&lt;BR /&gt; (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_LOW,&lt;BR /&gt; (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_HIGH,&lt;BR /&gt; (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_LOW&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;union etpu_events_array my_QOM_event_arrayC[QOM_arrayC_size] =&lt;BR /&gt; { (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_LOW,&lt;BR /&gt; (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_HIGH,&lt;BR /&gt; (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_LOW,&lt;BR /&gt; (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_HIGH,&lt;BR /&gt; (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_LOW,&lt;BR /&gt; (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_HIGH,&lt;BR /&gt; (0x010000 &amp;lt;&amp;lt; 1) + FS_ETPU_PIN_LOW&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;int32_t init_error; /*initialization error code. */&lt;BR /&gt;uint32_t *fs_free_param;&lt;/P&gt;&lt;P&gt;main ()&lt;BR /&gt;{&lt;BR /&gt; uint8_t chan;&lt;BR /&gt; uint32_t *QOM0_ram_ptr, *QOM0_last_match_ptr;&lt;BR /&gt; int32_t error_code;&lt;BR /&gt; int32_t x10, y10; /*these are used to generate a delay*/&lt;BR /&gt; vuint16_t *upper_SCR16;&lt;BR /&gt; vuint32_t *upper_SCR32;&lt;/P&gt;&lt;P&gt;FMPLL.SYNCR.R = 0x06000000; /* MFD = 0b110, RFD=0b000, 8MHz*16=128MHz */&lt;/P&gt;&lt;P&gt;/* initialize eTPU hardware */&lt;BR /&gt; fs_etpu_init (my_etpu_config, (uint32_t *) etpu_code, sizeof (etpu_code),&lt;BR /&gt; (uint32_t *) etpu_globals, sizeof (etpu_globals));&lt;/P&gt;&lt;P&gt;/* enable all timebases */&lt;BR /&gt; fs_timer_start ();&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/*clear interrupt and DTR flags*/&lt;BR /&gt; for (chan = 0; chan &amp;lt; 63; chan++)&lt;BR /&gt; {&lt;BR /&gt; upper_SCR32 = &amp;amp;ETPU.CHAN[chan].SCR.R;&lt;BR /&gt; upper_SCR16 = (vuint16_t *) upper_SCR32;&lt;BR /&gt; *upper_SCR16 = 0xC0C0; /* clear DMA/interrupt service request */&lt;BR /&gt; fs_etpu_disable (chan); /*disable all channels */&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/* configure the pins on the MPC5554 */&lt;BR /&gt; fs_gpio_config (FS_GPIO_ETPUA2, ETPU_OUTPUT_PAD_CONFIG);&lt;BR /&gt; fs_gpio_config (FS_GPIO_ETPUA4, ETPU_OUTPUT_PAD_CONFIG);&lt;BR /&gt; fs_gpio_config (FS_GPIO_ETPUA10, ETPU_OUTPUT_PAD_CONFIG);&lt;BR /&gt; fs_gpio_config (FS_GPIO_ETPUA16, ETPU_OUTPUT_PAD_CONFIG);&lt;BR /&gt; fs_gpio_config (FS_GPIO_ETPUA22, ETPU_OUTPUT_PAD_CONFIG);&lt;BR /&gt; fs_gpio_config (FS_GPIO_ETPUA28, ETPU_OUTPUT_PAD_CONFIG);&lt;/P&gt;&lt;P&gt;error_code =&lt;BR /&gt; fs_etpu_qom_init (QOM0,&lt;BR /&gt; FS_ETPU_PRIORITY_MIDDLE,&lt;BR /&gt; FS_ETPU_QOM_SINGLE_SHOT,&lt;BR /&gt; FS_ETPU_TCR1,&lt;BR /&gt; FS_ETPU_QOM_INIT_PIN_LOW,&lt;BR /&gt; FS_ETPU_QOM_IMMEDIATE,&lt;BR /&gt; (uint32_t *) 0,&lt;BR /&gt; 0, &lt;BR /&gt; QOM_arrayA_size, &lt;BR /&gt; my_QOM_event_arrayA);&lt;BR /&gt; if (error_code != 0)&lt;BR /&gt; return (QOM0 + 1);&lt;/P&gt;&lt;P&gt;while (ETPU.CHAN[QOM0].SCR.B.CIS == 0)&lt;BR /&gt; {&lt;BR /&gt; /*wait for QOM0 to finish */&lt;BR /&gt; /*WARNING: Endless loop is possible */&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;QOM0_ram_ptr = fs_etpu_data_ram (QOM0);&lt;BR /&gt; QOM0_last_match_ptr =&lt;BR /&gt; (uint32_t *) ((uint32_t) QOM0_ram_ptr - (uint32_t) &amp;amp; ETPU_DATA_RAM +&lt;BR /&gt; FS_ETPU_QOM_LAST_MATCH_TIME_OFFSET);&lt;/P&gt;&lt;P&gt;for (x10 = 1; x10 &amp;lt; 20000; x10++)&lt;BR /&gt; {&lt;BR /&gt; y10 = x10 + 2;&lt;BR /&gt; y10 = x10 - 2;&lt;BR /&gt; } /* add delay to demonstrate immediate versus ref_addr */&lt;/P&gt;&lt;P&gt;error_code =&lt;BR /&gt; fs_etpu_qom_init (QOM2,&lt;BR /&gt; FS_ETPU_PRIORITY_MIDDLE,&lt;BR /&gt; FS_ETPU_QOM_CONTINUOUS_A,&lt;BR /&gt; FS_ETPU_TCR1,&lt;BR /&gt; FS_ETPU_QOM_INIT_PIN_HIGH,&lt;BR /&gt; FS_ETPU_QOM_IMMEDIATE,&lt;BR /&gt; (uint32_t *) 0,&lt;BR /&gt; 0, &lt;BR /&gt; QOM_arrayB_size, &lt;BR /&gt; my_QOM_event_arrayB);&lt;BR /&gt; if (error_code != 0)&lt;BR /&gt; return (QOM2 + 1);&lt;/P&gt;&lt;P&gt;error_code =&lt;BR /&gt; fs_etpu_qom_init (QOM1,&lt;BR /&gt; FS_ETPU_PRIORITY_MIDDLE,&lt;BR /&gt; FS_ETPU_QOM_SINGLE_SHOT,&lt;BR /&gt; FS_ETPU_TCR1,&lt;BR /&gt; FS_ETPU_QOM_INIT_PIN_HIGH,&lt;BR /&gt; FS_ETPU_QOM_USE_REF_ADDRESS,&lt;BR /&gt; QOM0_last_match_ptr,&lt;BR /&gt; 0, &lt;BR /&gt; QOM_arrayB_size, &lt;BR /&gt; my_QOM_event_arrayB);&lt;BR /&gt; if (error_code != 0)&lt;BR /&gt; return (QOM1 + 1);&lt;/P&gt;&lt;P&gt;/*initialise QOM3 to recieve a link*/&lt;BR /&gt; error_code =&lt;BR /&gt; fs_etpu_qom_init (QOM3,&lt;BR /&gt; FS_ETPU_PRIORITY_MIDDLE,&lt;BR /&gt; FS_ETPU_QOM_SINGLE_SHOT,&lt;BR /&gt; FS_ETPU_TCR1,&lt;BR /&gt; FS_ETPU_QOM_INIT_PIN_HIGH_LINK,&lt;BR /&gt; FS_ETPU_QOM_IMMEDIATE,&lt;BR /&gt; (uint32_t *) 0,&lt;BR /&gt; 0, &lt;BR /&gt; QOM_arrayB_size, &lt;BR /&gt; my_QOM_event_arrayB);&lt;BR /&gt; if (error_code != 0)&lt;BR /&gt; return (QOM3 + 1);&lt;/P&gt;&lt;P&gt;/*initialise QOM4 to recieve a link*/&lt;/P&gt;&lt;P&gt;error_code =&lt;BR /&gt; fs_etpu_qom_init (QOM4,&lt;BR /&gt; FS_ETPU_PRIORITY_MIDDLE,&lt;BR /&gt; FS_ETPU_QOM_LOOP,&lt;BR /&gt; FS_ETPU_TCR1,&lt;BR /&gt; FS_ETPU_QOM_INIT_PIN_LOW_LINK,&lt;BR /&gt; FS_ETPU_QOM_IMMEDIATE,&lt;BR /&gt; (uint32_t *) 0,&lt;BR /&gt; 2, /* number of loops */&lt;BR /&gt; QOM_arrayB_size, &lt;BR /&gt; my_QOM_event_arrayB);&lt;BR /&gt; if (error_code != 0)&lt;BR /&gt; return (QOM4 + 1);&lt;/P&gt;&lt;P&gt;error_code =&lt;BR /&gt; fs_etpu_qom_init (QOM5,&lt;BR /&gt; FS_ETPU_PRIORITY_MIDDLE,&lt;BR /&gt; FS_ETPU_QOM_CONTINUOUS,&lt;BR /&gt; FS_ETPU_TCR1,&lt;BR /&gt; FS_ETPU_QOM_INIT_PIN_NO_CHANGE_LINK,&lt;BR /&gt; FS_ETPU_QOM_IMMEDIATE,&lt;BR /&gt; (uint32_t *) 0,&lt;BR /&gt; 0, &lt;BR /&gt; QOM_arrayB_size, &lt;BR /&gt; my_QOM_event_arrayB);&lt;BR /&gt; if (error_code != 0)&lt;BR /&gt; return (QOM5 + 1);&lt;/P&gt;&lt;P&gt;/* now send link to channel QOM3 ; wait for it to finish then do new pulse &lt;BR /&gt; stream relative to last match*/&lt;BR /&gt; fs_etpu_test (TEST0 + 64 + 128, QOM3, FS_ETPU_TEST_GENERATE_LINK);&lt;BR /&gt; while (ETPU.CHAN[QOM3].SCR.B.CIS == 0)&lt;BR /&gt; {&lt;BR /&gt; /*wait for QOM3 to finish */&lt;BR /&gt; /*WARNING: Endless loop is possible */ &lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;error_code =&lt;BR /&gt; fs_etpu_qom_init (QOM3,&lt;BR /&gt; FS_ETPU_PRIORITY_MIDDLE,&lt;BR /&gt; FS_ETPU_QOM_SINGLE_SHOT,&lt;BR /&gt; FS_ETPU_TCR1,&lt;BR /&gt; FS_ETPU_QOM_INIT_PIN_NO_CHANGE,&lt;BR /&gt; FS_ETPU_QOM_USE_LAST_EVENT,&lt;BR /&gt; (uint32_t *) 0,&lt;BR /&gt; 0, &lt;BR /&gt; QOM_arrayC_size, &lt;BR /&gt; my_QOM_event_arrayC);&lt;/P&gt;&lt;P&gt;for (x10 = 1; x10 &amp;lt; 80000; x10++)&lt;BR /&gt; {&lt;BR /&gt; y10 = x10 + 2;&lt;BR /&gt; y10 = x10 - 2;&lt;BR /&gt; } /* add delay&lt;BR /&gt; /* now send link to channel QOM4/5 */&lt;BR /&gt; fs_etpu_test (TEST0 + 64 + 128, QOM4, FS_ETPU_TEST_GENERATE_LINK);&lt;/P&gt;&lt;P&gt;fs_etpu_test (TEST0 + 64 + 128, QOM5, FS_ETPU_TEST_GENERATE_LINK);&lt;/P&gt;&lt;P&gt;/* now send link to channel QOM4/5 before it has completed &lt;BR /&gt; (test LSR_flag functionality)*/&lt;BR /&gt; for (x10 = 1; x10 &amp;lt; 80000; x10++)&lt;BR /&gt; {&lt;BR /&gt; y10 = x10 + 2;&lt;BR /&gt; y10 = x10 - 2;&lt;BR /&gt; }&lt;BR /&gt; fs_etpu_test (TEST0 + 64 + 128, QOM4, FS_ETPU_TEST_GENERATE_LINK);&lt;/P&gt;&lt;P&gt;fs_etpu_test (TEST0 + 64 + 128, QOM5, FS_ETPU_TEST_GENERATE_LINK);&lt;/P&gt;&lt;P&gt;/*wait until QOM4 has fininshed then try sending another link - nothing &lt;BR /&gt; should happen due to LSR_flag functionality.*/&lt;BR /&gt; while (ETPU.CHAN[QOM4].SCR.B.CIS == 0)&lt;BR /&gt; {&lt;BR /&gt; /*wait for QOM4 to finish */&lt;BR /&gt; /*WARNING: Endless loop is possible */&lt;BR /&gt; }&lt;BR /&gt; fs_etpu_test (TEST0 + 64 + 128, QOM4, FS_ETPU_TEST_GENERATE_LINK);&lt;/P&gt;&lt;P&gt;for (;;); /*Foo. */&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;/*********************************************************************&lt;BR /&gt; *&lt;BR /&gt; * Copyright:&lt;BR /&gt; * Freescale Semiconductor, INC. All Rights Reserved.&lt;BR /&gt; * You are hereby granted a copyright license to use, modify, and&lt;BR /&gt; * distribute the SOFTWARE so long as this entire notice is&lt;BR /&gt; * retained without alteration in any modified and/or redistributed&lt;BR /&gt; * versions, and that such modified versions are clearly identified&lt;BR /&gt; * as such. No licenses are granted by implication, estoppel or&lt;BR /&gt; * otherwise under any patents or trademarks of Freescale&lt;BR /&gt; * Semiconductor, Inc. This software is provided on an "AS IS"&lt;BR /&gt; * basis and without warranty.&lt;BR /&gt; *&lt;BR /&gt; * To the maximum extent permitted by applicable law, Freescale&lt;BR /&gt; * Semiconductor DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,&lt;BR /&gt; * INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A&lt;BR /&gt; * PARTICULAR PURPOSE AND ANY WARRANTY AGAINST INFRINGEMENT WITH&lt;BR /&gt; * REGARD TO THE SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)&lt;BR /&gt; * AND ANY ACCOMPANYING WRITTEN MATERIALS.&lt;BR /&gt; *&lt;BR /&gt; * To the maximum extent permitted by applicable law, IN NO EVENT&lt;BR /&gt; * SHALL Freescale Semiconductor BE LIABLE FOR ANY DAMAGES WHATSOEVER&lt;BR /&gt; * (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,&lt;BR /&gt; * BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER&lt;BR /&gt; * PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.&lt;BR /&gt; *&lt;BR /&gt; * Freescale Semiconductor assumes no responsibility for the&lt;BR /&gt; * maintenance and support of this software&lt;BR /&gt; ********************************************************************/&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Apr 2020 09:11:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/NXP-Designs/How-to-generate-5-injection-pulses-using-eTPU-s-QOM-mode/m-p/1042096#M397</guid>
      <dc:creator>709458227</dc:creator>
      <dc:date>2020-04-01T09:11:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate 5 injection pulses using eTPU's QOM mode</title>
      <link>https://community.nxp.com/t5/NXP-Designs/How-to-generate-5-injection-pulses-using-eTPU-s-QOM-mode/m-p/1042097#M398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Which device you are using?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Apr 2020 11:09:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/NXP-Designs/How-to-generate-5-injection-pulses-using-eTPU-s-QOM-mode/m-p/1042097#M398</guid>
      <dc:creator>davidtosenovjan</dc:creator>
      <dc:date>2020-04-02T11:09:14Z</dc:date>
    </item>
  </channel>
</rss>

