<?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: PWM Component Sharing - ConnectPin() in Processor Expert Software</title>
    <link>https://community.nxp.com/t5/Processor-Expert-Software/PWM-Component-Sharing-ConnectPin/m-p/381833#M2953</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks - both approaches worked for me, problem solved!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the Processor Expert approach - I had to set the "Auto Initialisation" option to 'yes' otherwise I had no way of getting the DeviceDataPtr.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Feb 2015 16:17:25 GMT</pubDate>
    <dc:creator>abhiembedded</dc:creator>
    <dc:date>2015-02-18T16:17:25Z</dc:date>
    <item>
      <title>PWM Component Sharing - ConnectPin()</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/PWM-Component-Sharing-ConnectPin/m-p/381830#M2950</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; I am trying to setup a program that outputs a PWM signal but also has the ability to hold the signal on the same pin high or low 'manually'. The PWM is working fine, and I can disable it to simply hold the output low. However, the KL25 does not let me set the output as high. Therefore, I wanted to use a BitIO component to set the pin to high. I can add this component and it appears to work, using pin sharing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, the PWM component doesn't have a ConnectPin() method, so can't connect the pin back to the PWM output - it just stays stuck to the BitIO. I am using a PWM high level component. I see that the LDD has a ConnectPin method, but this is not available in the high level component.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; I can use a PWM LDD directly, instead of the high level component, but I do not understand the arguments that need to be passed to the ConnectPin() function for the PWM LDD, what should the pin mask be?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could someone help with how to achieve this...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2015 18:18:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/PWM-Component-Sharing-ConnectPin/m-p/381830#M2950</guid>
      <dc:creator>abhiembedded</dc:creator>
      <dc:date>2015-02-17T18:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: PWM Component Sharing - ConnectPin()</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/PWM-Component-Sharing-ConnectPin/m-p/381831#M2951</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Abhi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would write directly to the PORTn_PCRx control register for the pin(s) in question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you configure the GPIO mode as output with either '0' or '1' you can then swap between PWM output and a '1' or '0' with a single register write.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Furthermore, if you have multiple such outputs it is even possible to switch up to 16 between the functions at exactly the same point in time by a single register write using&lt;/P&gt;&lt;P&gt;PORTn_GPCLR or &lt;/P&gt;&lt;P&gt;PORTn_GPCHR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kinetis: &lt;A href="http://www.utasker.com/kinetis.html" title="http://www.utasker.com/kinetis.html"&gt;µTasker Kinetis support&lt;/A&gt;&lt;/P&gt;&lt;P&gt;KL25: &lt;A href="http://www.utasker.com/kinetis/FRDM-KL25Z.html" title="http://www.utasker.com/kinetis/FRDM-KL25Z.html"&gt;µTasker Kinetis FRDM-KL25Z support&lt;/A&gt; / &lt;A href="http://www.utasker.com/kinetis/TWR-KL25Z48M.html" title="http://www.utasker.com/kinetis/TWR-KL25Z48M.html"&gt;µTasker Kinetis TWR-KL25Z48M support&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;For the complete "out-of-the-box" Kinetis experience and faster time to market&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2015 19:39:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/PWM-Component-Sharing-ConnectPin/m-p/381831#M2951</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2015-02-17T19:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: PWM Component Sharing - ConnectPin()</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/PWM-Component-Sharing-ConnectPin/m-p/381832#M2952</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The High Level components only support the common features of the LDD components, this means that the possible configurations are limited to the basic functionality of the peripheral, that is the reason why the ConnectPin() method is not available for the High Level Component.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding the use of the method it has two parameters:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;DeviceDataPtr&lt;/STRONG&gt;: Pointer to LDD_TDeviceData - Device data structure pointer returned by Init method. Is the same pointer that is passed to all the other methods of the LDD component. The High Level Component do not use this parameter because is already generated by processor expert.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;PinMask:LDD_TPinMask&lt;/STRONG&gt; - Mask for the requested pins. The peripheral pins are reconnected according to this mask. This one is also generated by processor expert, you can check the value in the .h file for the specific PWM component. Here is an image for your reference:&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="lia-inline-image-display-wrapper" image-alt="connect pin.jpg"&gt;&lt;IMG alt="connect pin.jpg" src="https://community.nxp.com/t5/image/serverpage/image-id/50585i2D6E2F55FBB2AC71/image-size/large?v=v2&amp;amp;px=999" title="connect pin.jpg" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;You can call the method like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14242255525068576" jivemacro_uid="_14242255525068576" modifiedtitle="true"&gt;
&lt;P&gt;PWM1_ConnectPin(PWMTimerRG_DeviceData, (&lt;SPAN style="color: #339966;"&gt;LDD_TPinMask&lt;/SPAN&gt;)PWM1_OUT_PIN);&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;Hope this information can help you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;BR /&gt;Adrian Sanchez Cano&lt;BR /&gt;Technical Support Engineer&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2020 13:15:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/PWM-Component-Sharing-ConnectPin/m-p/381832#M2952</guid>
      <dc:creator>adriancano</dc:creator>
      <dc:date>2020-11-02T13:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: PWM Component Sharing - ConnectPin()</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/PWM-Component-Sharing-ConnectPin/m-p/381833#M2953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks - both approaches worked for me, problem solved!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the Processor Expert approach - I had to set the "Auto Initialisation" option to 'yes' otherwise I had no way of getting the DeviceDataPtr.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Feb 2015 16:17:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/PWM-Component-Sharing-ConnectPin/m-p/381833#M2953</guid>
      <dc:creator>abhiembedded</dc:creator>
      <dc:date>2015-02-18T16:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: Re: PWM Component Sharing - ConnectPin()</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/PWM-Component-Sharing-ConnectPin/m-p/381834#M2954</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you configure the autoinitialization YES the Init method is called in the PE_low_level_init function, you can see an example here:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="init.jpg"&gt;&lt;IMG alt="init.jpg" src="https://community.nxp.com/t5/image/serverpage/image-id/50606iD4FA3EE8E7004FFA/image-size/large?v=v2&amp;amp;px=999" title="init.jpg" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Ant the DevicePtr is in the .h file of the component:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pwm.jpg"&gt;&lt;IMG alt="pwm.jpg" src="https://community.nxp.com/t5/image/serverpage/image-id/50607i1CFEB36680310875/image-size/large?v=v2&amp;amp;px=999" title="pwm.jpg" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you configure the autoinitialization NO you need to call the Init method in your code where you need it. The init method return a pointer to the device structure that is the one you will use and you can name it as you want, here an example in main.c file&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14242777415242141" jivemacro_uid="_14242777415242141" modifiedtitle="true"&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;LDD_TDeviceData *MyPWM1Ptr;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;int main(void)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PE_low_level_init();&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyPWM1Ptr = PWM1_Init(NULL);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //connect pin function example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PWM1_ConnectPin(MyPWM1Ptr, (LDD_TPinMask)PWM1_OUT_PIN);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(;;){&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //user code&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this information can help you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;BR /&gt;Adrian Sanchez Cano&lt;BR /&gt;Technical Support Engineer&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2020 13:15:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/PWM-Component-Sharing-ConnectPin/m-p/381834#M2954</guid>
      <dc:creator>adriancano</dc:creator>
      <dc:date>2020-11-02T13:15:16Z</dc:date>
    </item>
  </channel>
</rss>

