<?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: Turning two GPIO pins on turns them both off FRDM-K82F in Kinetis Software Development Kit</title>
    <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Turning-two-GPIO-pins-on-turns-them-both-off-FRDM-K82F/m-p/459757#M3375</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Michael,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have checked the function:&lt;/P&gt;&lt;P&gt;static inline void GPIO_TogglePinsOutput(GPIO_Type *base, uint32_t mask)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; base-&amp;gt;PTOR = mask;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do not think there is any issue if you call both GPIO_TogglePinsOutput(VALVE_VCC2_GPIO, 1U &amp;lt;&amp;lt; VALVE_VCC2_PIN); and GPIO_TogglePinsOutput(VALVE_VCC1_GPIO, 1U &amp;lt;&amp;lt; VALVE_VCC1_PIN);&lt;/P&gt;&lt;P&gt;I suggest you add the line for example __asm("nop"); and set a break point after you call the above function, and check the logic or LED state.&lt;/P&gt;&lt;P&gt;you can also toggle two pins with the code&lt;/P&gt;&lt;P&gt;GPIO_TogglePinsOutput(VALVE_VCC2_GPIO, (1U &amp;lt;&amp;lt; VALVE_VCC2_PIN)|(1U &amp;lt;&amp;lt; VALVE_VCC1_PIN));&amp;nbsp; //what is the result?&lt;/P&gt;&lt;P&gt;BTW, you said "however if I do both they both fail.", what is the failure?&lt;/P&gt;&lt;P&gt;Hope it can hep you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Xiangjun Rong&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GPIO_TogglePinsOutput(VALVE_VCC2_GPIO, 1U &amp;lt;&amp;lt; VALVE_VCC2_PIN); //&lt;/P&gt;&lt;P&gt;__asm("nop");&amp;nbsp; //set a break point&lt;/P&gt;&lt;P&gt;GPIO_TogglePinsOutput(VALVE_VCC1_GPIO, 1U &amp;lt;&amp;lt; VALVE_VCC1_PIN);&lt;/P&gt;&lt;P&gt;__asm("nop"); //set a break point&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 May 2016 06:44:28 GMT</pubDate>
    <dc:creator>xiangjun_rong</dc:creator>
    <dc:date>2016-05-30T06:44:28Z</dc:date>
    <item>
      <title>Turning two GPIO pins on turns them both off FRDM-K82F</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Turning-two-GPIO-pins-on-turns-them-both-off-FRDM-K82F/m-p/459756#M3374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;EDIT: helps if I use the ground from the board instead of the 12V in for the board I am soldering up!&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First of all this is the first arm board I've ever programmed so have mercy on me.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have configured two pins PTB16 and PTB17 (it looks like the quick reference doc in the cardboard box got them the wrong way round as they correspond as below I am yet to double check this against the RM etc)&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="c++" name="code"&gt;//define two pins for vcc1 and vcc2 #define VALVE_VCC1_PIN 16U //PTB17 #define VALVE_VCC1_GPIO GPIOB #define VALVE_VCC1_PORT PORTB #define VALVE_VCC2_PIN 17U //PTB16 #define VALVE_VCC2_GPIO GPIOB #define VALVE_VCC2_PORT PORTB&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I've configured them in pin_mux.c&lt;/P&gt;&lt;PRE class="c++" name="code"&gt;CLOCK_EnableClock(kCLOCK_PortA);&amp;nbsp; PORT_SetPinMux(VALVE_VCC1_PORT, VALVE_VCC1_PIN, kPORT_MuxAsGpio); PORT_SetPinMux(VALVE_VCC2_PORT, VALVE_VCC2_PIN, kPORT_MuxAsGpio);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then in main.c I init the pins&lt;/P&gt;&lt;PRE class="c++" name="code"&gt;/* Output pin configuration */&amp;nbsp; gpio_pin_config_t valve_config = &amp;nbsp; { &amp;nbsp; kGPIO_DigitalOutput, 1, &amp;nbsp; };&amp;nbsp;&amp;nbsp;&amp;nbsp; /*&amp;nbsp; Sets the configuration */&amp;nbsp; void initState() { &amp;nbsp; GPIO_PinInit(VALVE_VCC1_GPIO, VALVE_VCC1_PIN, &amp;amp;valve_config); &amp;nbsp; GPIO_PinInit(VALVE_VCC2_GPIO, VALVE_VCC2_PIN, &amp;amp;valve_config); }&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I use the GPIO_TogglePinsOutput functions to turn them on, which individually if I only do one, works. however if I do both they both fail.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="c++" name="code"&gt;//stop when flow is going. void openValve() { &amp;nbsp; GPIO_TogglePinsOutput(VALVE_VCC2_GPIO, 1U &amp;lt;&amp;lt; VALVE_VCC2_PIN); }&amp;nbsp;&amp;nbsp; //stop when flow stops void closeValve() { &amp;nbsp; GPIO_TogglePinsOutput(VALVE_VCC1_GPIO, 1U &amp;lt;&amp;lt; VALVE_VCC1_PIN); }&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have no idea why and I don't own a jlink debugger (however work does have one) am using KDS studio&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am doing this project for fun and it would be great to learn how to use this board better.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;lastly thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 May 2016 06:01:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Turning-two-GPIO-pins-on-turns-them-both-off-FRDM-K82F/m-p/459756#M3374</guid>
      <dc:creator>mikey0000</dc:creator>
      <dc:date>2016-05-28T06:01:07Z</dc:date>
    </item>
    <item>
      <title>Re: Turning two GPIO pins on turns them both off FRDM-K82F</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Turning-two-GPIO-pins-on-turns-them-both-off-FRDM-K82F/m-p/459757#M3375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Michael,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have checked the function:&lt;/P&gt;&lt;P&gt;static inline void GPIO_TogglePinsOutput(GPIO_Type *base, uint32_t mask)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; base-&amp;gt;PTOR = mask;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do not think there is any issue if you call both GPIO_TogglePinsOutput(VALVE_VCC2_GPIO, 1U &amp;lt;&amp;lt; VALVE_VCC2_PIN); and GPIO_TogglePinsOutput(VALVE_VCC1_GPIO, 1U &amp;lt;&amp;lt; VALVE_VCC1_PIN);&lt;/P&gt;&lt;P&gt;I suggest you add the line for example __asm("nop"); and set a break point after you call the above function, and check the logic or LED state.&lt;/P&gt;&lt;P&gt;you can also toggle two pins with the code&lt;/P&gt;&lt;P&gt;GPIO_TogglePinsOutput(VALVE_VCC2_GPIO, (1U &amp;lt;&amp;lt; VALVE_VCC2_PIN)|(1U &amp;lt;&amp;lt; VALVE_VCC1_PIN));&amp;nbsp; //what is the result?&lt;/P&gt;&lt;P&gt;BTW, you said "however if I do both they both fail.", what is the failure?&lt;/P&gt;&lt;P&gt;Hope it can hep you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Xiangjun Rong&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GPIO_TogglePinsOutput(VALVE_VCC2_GPIO, 1U &amp;lt;&amp;lt; VALVE_VCC2_PIN); //&lt;/P&gt;&lt;P&gt;__asm("nop");&amp;nbsp; //set a break point&lt;/P&gt;&lt;P&gt;GPIO_TogglePinsOutput(VALVE_VCC1_GPIO, 1U &amp;lt;&amp;lt; VALVE_VCC1_PIN);&lt;/P&gt;&lt;P&gt;__asm("nop"); //set a break point&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 May 2016 06:44:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Turning-two-GPIO-pins-on-turns-them-both-off-FRDM-K82F/m-p/459757#M3375</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2016-05-30T06:44:28Z</dc:date>
    </item>
  </channel>
</rss>

