<?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>Other NXP Productsのトピックmpc8323e-rdb GPIO under Linux</title>
    <link>https://community.nxp.com/t5/Other-NXP-Products/mpc8323e-rdb-GPIO-under-Linux/m-p/190304#M1709</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How to drive GPIO on this board? There are 3 leds G Y R connected to GPIO ports 416,417,418... There is no driver for GPIO and there are no normal headers in cross-tools(Ltib&amp;nbsp;cross&amp;nbsp;tools, come with this kit) to do this...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 Apr 2010 12:20:40 GMT</pubDate>
    <dc:creator>admin</dc:creator>
    <dc:date>2010-04-09T12:20:40Z</dc:date>
    <item>
      <title>mpc8323e-rdb GPIO under Linux</title>
      <link>https://community.nxp.com/t5/Other-NXP-Products/mpc8323e-rdb-GPIO-under-Linux/m-p/190304#M1709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How to drive GPIO on this board? There are 3 leds G Y R connected to GPIO ports 416,417,418... There is no driver for GPIO and there are no normal headers in cross-tools(Ltib&amp;nbsp;cross&amp;nbsp;tools, come with this kit) to do this...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Apr 2010 12:20:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Other-NXP-Products/mpc8323e-rdb-GPIO-under-Linux/m-p/190304#M1709</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2010-04-09T12:20:40Z</dc:date>
    </item>
    <item>
      <title>Re: mpc8323e-rdb GPIO under Linux</title>
      <link>https://community.nxp.com/t5/Other-NXP-Products/mpc8323e-rdb-GPIO-under-Linux/m-p/190305#M1710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After 2 days of searching I find that to drive gpio I should directly access to mem.&lt;/P&gt;&lt;P&gt;#include &amp;lt;stdio.h&amp;gt;&lt;BR /&gt;#include &amp;lt;unistd.h&amp;gt;&lt;BR /&gt;#include &amp;lt;fcntl.h&amp;gt;&lt;BR /&gt;#include &amp;lt;sys/mman.h&amp;gt;&lt;BR /&gt;&lt;BR /&gt;#define PIO_BASE 0x0x00001400&lt;BR /&gt;&lt;BR /&gt;volatile unsigned int *CPDATD; //PortD data register&lt;BR /&gt;volatile unsigned int *CPDIR2D; //PortD datadirection2 register&lt;BR /&gt;&lt;BR /&gt;int main (void)&lt;BR /&gt;{&lt;BR /&gt;//long delay=128000, delay2=100;&lt;BR /&gt;unsigned char *gpio;&lt;BR /&gt;int fd;&lt;BR /&gt;fd = open("/dev/mem", O_RDWR);&lt;BR /&gt;if (fd &amp;lt; 0){&lt;BR /&gt;printf("Failed to open /dev/mem");&lt;BR /&gt;return fd;&lt;BR /&gt;}&lt;BR /&gt;gpio = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd, PIO_BASE);&lt;BR /&gt;&lt;BR /&gt;CPDATD = (unsigned int *)(gpio + 0x4C); //data&lt;BR /&gt;CPDIR2D = (unsigned int *)(gpio + 0x54);&lt;BR /&gt;&lt;BR /&gt;*CPDIR2D |= 0x02;//set output&lt;BR /&gt;*CPDATD ^= (1 &amp;lt;&amp;lt; 16);// turn ON Red LED (port D16)&lt;BR /&gt;&lt;BR /&gt;return 0;&lt;BR /&gt;}&lt;BR /&gt;I've read PIOaddress from datasheet...&lt;/P&gt;&lt;P&gt;0x00_1400–0x00_17FF QUICC Engine parallel I/O ports&lt;/P&gt;&lt;P&gt;Program&amp;nbsp;give&amp;nbsp;error:&amp;nbsp;Segmentation fault&lt;/P&gt;&lt;P&gt;I&amp;nbsp;think&amp;nbsp;that&amp;nbsp;PIOaddress&amp;nbsp;is&amp;nbsp;wrong...&amp;nbsp;I&amp;nbsp;searched&amp;nbsp;it&amp;nbsp;in&amp;nbsp;kernel&amp;nbsp;and&amp;nbsp;didn't&amp;nbsp;find&amp;nbsp;it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Apr 2010 17:27:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Other-NXP-Products/mpc8323e-rdb-GPIO-under-Linux/m-p/190305#M1710</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2010-04-09T17:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: mpc8323e-rdb GPIO under Linux</title>
      <link>https://community.nxp.com/t5/Other-NXP-Products/mpc8323e-rdb-GPIO-under-Linux/m-p/190306#M1711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Final code... All is right... But don't work...&lt;/P&gt;&lt;P&gt;#include &amp;lt;stdio.h&amp;gt;&lt;BR /&gt;#include &amp;lt;unistd.h&amp;gt;&lt;BR /&gt;#include &amp;lt;fcntl.h&amp;gt;&lt;BR /&gt;#include &amp;lt;sys/mman.h&amp;gt;&lt;BR /&gt;&lt;BR /&gt;#define PIO_BASE 0xE0000000&lt;BR /&gt;#define MAP_SIZE 4096UL&lt;BR /&gt;#define MAP_MASK (MAP_SIZE-1)&lt;BR /&gt;&lt;BR /&gt;volatile unsigned long *CPDATD; //PortD data register&lt;BR /&gt;volatile unsigned long *CPDIR2D; //PortD datadirection2 register&lt;BR /&gt;volatile unsigned long *CPODRD; //PortD OPENDRAIN register&lt;BR /&gt;volatile unsigned long *CPARD; //PortD Assigment register&lt;BR /&gt;volatile unsigned long *IMMR; //IMMR&lt;BR /&gt;int main (void)&lt;BR /&gt;{&lt;BR /&gt;void *pio, *virt_addr;&lt;BR /&gt;int fd;&lt;BR /&gt;if ((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) {&lt;BR /&gt;printf("Failed to open /dev/mem \n");&lt;BR /&gt;return -1;&lt;BR /&gt;}&lt;BR /&gt;pio = mmap(0, MAP_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, PIO_BASE &amp;amp; ~MAP_MASK);&lt;BR /&gt;virt_addr = pio;&lt;BR /&gt;IMMR = (volatile unsigned long *)pio;&lt;BR /&gt;CPARD = (volatile unsigned long *)(pio + ((PIO_BASE+0x145C) &amp;amp; MAP_MASK));&lt;BR /&gt;CPODRD = (volatile unsigned long *)(pio + ((PIO_BASE+0x1448) &amp;amp; MAP_MASK));&lt;BR /&gt;CPDATD = (volatile unsigned long *)(pio + ((PIO_BASE+0x144C) &amp;amp; MAP_MASK));&lt;BR /&gt;CPDIR2D = (volatile unsigned long *)(pio + ((PIO_BASE+0x1454) &amp;amp; MAP_MASK));&lt;BR /&gt;&lt;BR /&gt;printf("IMMR = 0x%08x\n", *IMMR); // IMMRBAR(0xE0000000) to&amp;nbsp;ensure&amp;nbsp;that&amp;nbsp;it&amp;nbsp;is&amp;nbsp;a&amp;nbsp;right&amp;nbsp;page&amp;nbsp;of&amp;nbsp;memory&lt;BR /&gt;*CPARD &amp;amp;= ~3UL; // Assigment on GPO16,17,18&lt;BR /&gt;printf("CPARD = 0x%08x\n", *CPARD); //echo CPARD&lt;BR /&gt;*CPODRD =0; //reset open-drain register&lt;BR /&gt;printf("CPODRD = 0x%08x\n", *CPODRD); //echo CPODRD&lt;BR /&gt;*CPDIR2D &amp;amp;= ~3UL; //set output&lt;BR /&gt;*CPDIR2D |= 5; //PD16 and PD17 as&amp;nbsp;output&lt;BR /&gt;printf("CPDIR2D = 0x%08x\n", *CPDIR2D); //echo CPDIR2D&lt;BR /&gt;*CPDATD &amp;amp;= ~3UL; // turn ON Red LED (port D16) andYellow LED (port D17);&lt;BR /&gt;printf("CPDATD = 0x%08x\n", *CPDATD); //echo CPDATD&lt;BR /&gt;sleep(1); //1 second pause&lt;BR /&gt;if (munmap(pio, MAP_SIZE) == -1) {&lt;BR /&gt;printf("Memory unmap failed.\n");}&lt;BR /&gt;&lt;BR /&gt;close(fd);&lt;BR /&gt;return 0;&lt;BR /&gt;}&lt;BR /&gt;------------------------------&lt;/P&gt;&lt;P&gt;At the output:&lt;/P&gt;&lt;P&gt;/mnt/nfs/gpio # ./a.out&lt;BR /&gt;IMMR = 0xe0000000&lt;BR /&gt;CPARD = 0x00000000&lt;BR /&gt;CPODRD = 0x00000000&lt;BR /&gt;CPDIR2D = 0x00000000&lt;BR /&gt;CPDATD = 0x00000000&lt;/P&gt;&lt;P&gt;---------------------------------&lt;/P&gt;&lt;P&gt;IMMR&amp;nbsp;is&amp;nbsp;right...&amp;nbsp;But&amp;nbsp;other&amp;nbsp;register&amp;nbsp;not&amp;nbsp;changed&amp;nbsp;&lt;IMG alt=":smileysad:" class="emoticon emoticon-smileysad" id="smileysad" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-sad.gif" title="Smiley Sad" /&gt;&amp;nbsp;Why?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Apr 2010 18:08:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Other-NXP-Products/mpc8323e-rdb-GPIO-under-Linux/m-p/190306#M1711</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2010-04-12T18:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: mpc8323e-rdb GPIO under Linux</title>
      <link>https://community.nxp.com/t5/Other-NXP-Products/mpc8323e-rdb-GPIO-under-Linux/m-p/190307#M1712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've made it!!! If it would be usefull here working code:&lt;/P&gt;&lt;P&gt;#include &amp;lt;stdio.h&amp;gt;&lt;BR /&gt;#include &amp;lt;unistd.h&amp;gt;&lt;BR /&gt;#include &amp;lt;fcntl.h&amp;gt;&lt;BR /&gt;#include &amp;lt;sys/mman.h&amp;gt;&lt;BR /&gt;&lt;BR /&gt;#define PIO_BASE 0xE0001400&lt;BR /&gt;#define MAP_SIZE 4096UL&lt;BR /&gt;#define MAP_MASK (MAP_SIZE-1)&lt;BR /&gt;&lt;BR /&gt;volatile unsigned long *CPDATD; //PortD data register&lt;BR /&gt;volatile unsigned long *CPDIR2D; //PortD datadirection2 register&lt;BR /&gt;int main (void)&lt;BR /&gt;{&lt;BR /&gt;void *pio;&lt;BR /&gt;int fd, i;&lt;BR /&gt;if ((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) {&lt;BR /&gt;printf("Failed to open /dev/mem \n");&lt;BR /&gt;return -1;&lt;BR /&gt;}&lt;BR /&gt;pio = mmap(0, MAP_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, PIO_BASE &amp;amp; ~MAP_MASK);&lt;BR /&gt;CPDATD = (volatile unsigned long *)(pio + ((PIO_BASE+0x4C) &amp;amp; MAP_MASK));&lt;BR /&gt;CPDIR2D = (volatile unsigned long *)(pio + ((PIO_BASE+0x54) &amp;amp; MAP_MASK));&lt;BR /&gt;&lt;BR /&gt;*CPDIR2D &amp;amp;= ~(0xFF&amp;lt;&amp;lt;24);&lt;BR /&gt;*CPDIR2D |= (21UL&amp;lt;&amp;lt;26); //PD16 PD17 PD18 output&lt;BR /&gt;for (i=0; i&amp;lt;10; i++) {&lt;BR /&gt;*CPDATD ^= (15UL&amp;lt;&amp;lt;13); // turn ON Red Yellow Green LEDs (port D16,D17,D18)&lt;BR /&gt;sleep(1);&lt;BR /&gt;}&lt;BR /&gt;*CPDATD |= (15UL&amp;lt;&amp;lt;13);&lt;BR /&gt;if (munmap(pio, MAP_SIZE) == -1) {&lt;BR /&gt;printf("Memory unmap failed.\n");}&lt;BR /&gt;&lt;BR /&gt;close(fd);&lt;BR /&gt;return 0;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Apr 2010 15:42:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Other-NXP-Products/mpc8323e-rdb-GPIO-under-Linux/m-p/190307#M1712</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2010-04-13T15:42:27Z</dc:date>
    </item>
  </channel>
</rss>

