<?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>MQX Software SolutionsのトピックRe: GPIO Example so simple I can not see why it does not work</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/GPIO-Example-so-simple-I-can-not-see-why-it-does-not-work/m-p/220068#M5784</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;bin_pins just extracts bits from the pin table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All the pins read as 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when when I have the pins pulled low&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Sep 2010 19:10:09 GMT</pubDate>
    <dc:creator>w2vy</dc:creator>
    <dc:date>2010-09-01T19:10:09Z</dc:date>
    <item>
      <title>GPIO Example so simple I can not see why it does not work</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/GPIO-Example-so-simple-I-can-not-see-why-it-does-not-work/m-p/220065#M5781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This example is so simple I can not see why it does not work!&lt;/P&gt;&lt;P&gt;It just loops reading a pin table from gpio:read and extracts the values and prints them.&lt;/P&gt;&lt;P&gt;They all come up as 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am running MQX 3.6 on a mcf52259demo board.&lt;/P&gt;&lt;P&gt;I have the gpio pins&amp;nbsp;wired on J4 so I can pull the up/down&amp;nbsp;and&amp;nbsp;watch for changes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code below... (and attached if you want to compile)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;tom&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;/*TASK*-----------------------------------------------------------------** Function Name  : Main_task* Comments       :*    This task initializes RTCS and starts SHELL.**END------------------------------------------------------------------*/TASK_TEMPLATE_STRUCT MQX_template_list[] ={/*  Task number, Entry point, Stack, Pri, String, Auto? */   {MAIN_TASK,   Main_task,   3000,  9,   "main",        MQX_AUTO_START_TASK, 0, 50},   {0,           0,           0,     0,   0,             0, 0, 0}};#define GPIO_W1  GPIO_PORT_TA | GPIO_PIN3#define GPIO_W0  GPIO_PORT_TA | GPIO_PIN2#define GPIO_H1  GPIO_PORT_TA | GPIO_PIN1#define GPIO_H0  GPIO_PORT_TA | GPIO_PIN0#define GPIO_D7  GPIO_PORT_AN | GPIO_PIN7#define GPIO_D6  GPIO_PORT_AN | GPIO_PIN6#define GPIO_D5  GPIO_PORT_AN | GPIO_PIN5#define GPIO_D4  GPIO_PORT_AN | GPIO_PIN4#define GPIO_D3  GPIO_PORT_AN | GPIO_PIN3#define GPIO_D2  GPIO_PORT_AN | GPIO_PIN2#define GPIO_D1  GPIO_PORT_AN | GPIO_PIN1#define GPIO_D0  GPIO_PORT_AN | GPIO_PIN0#define GPIO_J16 GPIO_PORT_TC | GPIO_PIN2#define GPIO_J17 GPIO_PORT_TC | GPIO_PIN1#define GPIO_FLIP  GPIO_PORT_UC | GPIO_PIN3#define GPIO_RESET GPIO_PORT_TC | GPIO_PIN3#define GPIO_SYNC  GPIO_PORT_NQ | GPIO_PIN1MQX_FILE_PTR inputfd;static GPIO_PIN_STRUCT pins_input[] = {   GPIO_W1,   GPIO_W0,   GPIO_H1,   GPIO_H0,   GPIO_D7,   GPIO_D6,   GPIO_D5,   GPIO_D4,   GPIO_D3,   GPIO_D2,   GPIO_D1,   GPIO_D0,   GPIO_J16,   GPIO_J17,   GPIO_LIST_END};int bin_pins(GPIO_PIN_STRUCT pins[], int bits);void Main_task(uint_32 initial_data){   int w, h, J16, J17;   volatile MCF5225_STRUCT _PTR_ reg_ptr = _PSP_GET_IPSBAR();   volatile MCF5225_GPIO_STRUCT _PTR_ gpio = &amp;amp;reg_ptr-&amp;gt;GPIO;   // TA0-3 Inputs   inputfd = fopen("gpio:input", (char *)&amp;amp;pins_input);   if (inputfd == NULL) {      printf("Error opening GPIO Files!\r\n");      _task_block();   }   printf("GPIO Opened ok\r\n");   while (1) {      w = h = 1;      if (ioctl(inputfd, GPIO_IOCTL_READ, &amp;amp;pins_input) == IO_OK) {         w = bin_pins(&amp;amp;pins_input[0], 2) + 1;         h = bin_pins(&amp;amp;pins_input[2], 2) + 1;         J16 = bin_pins(&amp;amp;pins_input[12], 1);         J17 = bin_pins(&amp;amp;pins_input[13], 1);      }      printf("H %d W %d J16 %d J17 %d PORTTA %x DDR %x PAR %x PORTTAP %x\r\n", h, w, J16, J17, gpio-&amp;gt;PORTTA, gpio-&amp;gt;DDRTA, gpio-&amp;gt;PTAPAR, gpio-&amp;gt;PORTTAP_SETTA);      _time_delay(1000);   }}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Aug 2010 21:43:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/GPIO-Example-so-simple-I-can-not-see-why-it-does-not-work/m-p/220065#M5781</guid>
      <dc:creator>w2vy</dc:creator>
      <dc:date>2010-08-30T21:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: GPIO Example so simple I can not see why it does not work</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/GPIO-Example-so-simple-I-can-not-see-why-it-does-not-work/m-p/220066#M5782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;BTW The printf generates the following output&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;H 4 W 4 J16 1 J17 1 PORTTA f DDR 0 PAR 0 PORTTAP fH 4 W 4 J16 1 J17 1 PORTTA f DDR 0 PAR 0 PORTTAP fH 4 W 4 J16 1 J17 1 PORTTA f DDR 0 PAR 0 PORTTAP fH 4 W 4 J16 1 J17 1 PORTTA f DDR 0 PAR 0 PORTTAP f&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DDR 0 = Outputs, PARTA = 0 GPIO, Output reg F and Pin (PORTTAP) F&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sigh&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I sure hope it is stupid... those are easy to fix &lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" id="smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Aug 2010 22:15:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/GPIO-Example-so-simple-I-can-not-see-why-it-does-not-work/m-p/220066#M5782</guid>
      <dc:creator>w2vy</dc:creator>
      <dc:date>2010-08-30T22:15:42Z</dc:date>
    </item>
    <item>
      <title>Re: GPIO Example so simple I can not see why it does not work</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/GPIO-Example-so-simple-I-can-not-see-why-it-does-not-work/m-p/220067#M5783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I dont understand, Is your example already working?&lt;/P&gt;&lt;P&gt;If not, what does you bin_pins function do?&lt;/P&gt;&lt;P&gt;At the end:&lt;/P&gt;&lt;P&gt;DDR = 0 =&amp;gt; inputs&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Sep 2010 18:50:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/GPIO-Example-so-simple-I-can-not-see-why-it-does-not-work/m-p/220067#M5783</guid>
      <dc:creator>JuroV</dc:creator>
      <dc:date>2010-09-01T18:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: GPIO Example so simple I can not see why it does not work</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/GPIO-Example-so-simple-I-can-not-see-why-it-does-not-work/m-p/220068#M5784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;bin_pins just extracts bits from the pin table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All the pins read as 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when when I have the pins pulled low&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Sep 2010 19:10:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/GPIO-Example-so-simple-I-can-not-see-why-it-does-not-work/m-p/220068#M5784</guid>
      <dc:creator>w2vy</dc:creator>
      <dc:date>2010-09-01T19:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: GPIO Example so simple I can not see why it does not work</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/GPIO-Example-so-simple-I-can-not-see-why-it-does-not-work/m-p/220069#M5785</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In fact, your GPIO IP on the chip reads "1" from input. So the problem must be in the electrical connection.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Sep 2010 20:48:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/GPIO-Example-so-simple-I-can-not-see-why-it-does-not-work/m-p/220069#M5785</guid>
      <dc:creator>JuroV</dc:creator>
      <dc:date>2010-09-01T20:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: GPIO Example so simple I can not see why it does not work</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/GPIO-Example-so-simple-I-can-not-see-why-it-does-not-work/m-p/220070#M5786</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;(blush)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It turns out the pin on J4 that I was using to pull down the other ones, was not ground.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Well it was a simple solution!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the public embarassment!&lt;/P&gt;&lt;P&gt;I guess that is the price we pay for asking for help publically!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" id="smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Sep 2010 21:20:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/GPIO-Example-so-simple-I-can-not-see-why-it-does-not-work/m-p/220070#M5786</guid>
      <dc:creator>w2vy</dc:creator>
      <dc:date>2010-09-03T21:20:40Z</dc:date>
    </item>
  </channel>
</rss>

