<?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: Low level program for I2C  in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Low-level-program-for-I2C/m-p/574066#M18944</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by salamlora1 on Mon Jun 09 00:49:59 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi no one answering &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Some one noob need help plz !&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I cheng the program to below &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;And the SDA and ACL have pulse but in the USART I see the 0xAA or anything else I send on LPC_I2C-&amp;gt;MSTDAT&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= (1&amp;lt;&amp;lt;5); //1 clock for i2c&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_SYSCON-&amp;gt;PRESETCTRL |= (0x1&amp;lt;&amp;lt;6);//2 clear resset the i2c&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;INTENSET=0; // 3 disable all interrupts&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;regVal = LPC_SWM-&amp;gt;PINASSIGN7 &amp;amp; ~(0xFFUL&amp;lt;&amp;lt;24); //4&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_SWM-&amp;gt;PINASSIGN7 = regVal | (2 &amp;lt;&amp;lt; 24);/* P0.2 is I2C SDA, ASSIGN0(31:24) */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;regVal = LPC_SWM-&amp;gt;PINASSIGN8 &amp;amp; ~(0xFF&amp;lt;&amp;lt;0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_SWM-&amp;gt;PINASSIGN8 = 0xff0Dff03;/* P0.3 is I2C SCL. ASSIGN0(7:0) */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= (1&amp;lt;&amp;lt;5);//5&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_IOCON-&amp;gt;PIO0_2 |=(1&amp;lt;&amp;lt;10); //6&amp;nbsp; setting the iocon open drain mode&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_GPIO_PORT-&amp;gt;DIR0 |= (1 &amp;lt;&amp;lt; 2);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_IOCON-&amp;gt;PIO0_3 |=(1&amp;lt;&amp;lt;10);//6 setting the iocon open drain mode&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_GPIO_PORT-&amp;gt;DIR0 |= (1 &amp;lt;&amp;lt; 3);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;DIV = 0x100;//7 32mh / 10000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;MSTTIME = 0 ;//8 2 clocks. Minimum SCL high time is 2 clock of the I2C clock pre //divider.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;CFG =0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;CFG = 1;//9 master mode&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;int mmm;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;loooop:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;MSTDAT=0xad;//address for AT24C512C&amp;nbsp; (1-0-1-0-A2-A1-A0-W/R )&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;MSTCTL =2;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while(LPC_I2C-&amp;gt;STAT ==0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;MSTDAT=0x12;//first byte of address &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;MSTCTL =1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while(LPC_I2C-&amp;gt;STAT ==0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;MSTDAT=0xaa;// second byte of address &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;MSTCTL =1;=&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while(LPC_I2C-&amp;gt;STAT ==0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;MSTCTL =1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while(LPC_I2C-&amp;gt;STAT ==0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mmm = LPC_I2C-&amp;gt;MSTDAT; // hear must the data in the eeprom &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_USART0-&amp;gt;TXDATA = mmm;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;goto loooop;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PLZ heeeeeeeeeeeeeeelp &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 20:13:37 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T20:13:37Z</dc:date>
    <item>
      <title>Low level program for I2C</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Low-level-program-for-I2C/m-p/574065#M18943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by salamlora1 on Sat Jun 07 05:30:11 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Low level program for I2C&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I’m trying to write a low level program for LPC812 I2C &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But it’s not working and both of my SDA and SCL are low (zero) &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I can’t fine my mistake in my program? plz guide me &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;/////////////////////////////////////////////&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I2CC:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= (1&amp;lt;&amp;lt;5); //1 clock for i2c&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_SYSCON-&amp;gt;PRESETCTRL |= (0x1&amp;lt;&amp;lt;6);//2 reset the i2c&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;regVal = LPC_SWM-&amp;gt;PINASSIGN7 &amp;amp; ~(0xFFUL&amp;lt;&amp;lt;24); //4&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_SWM-&amp;gt;PINASSIGN7 = regVal | (2 &amp;lt;&amp;lt; 24);/* P0.2 is I2C SDA, ASSIGN0(31:24) */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;regVal = LPC_SWM-&amp;gt;PINASSIGN8 &amp;amp; ~(0xFF&amp;lt;&amp;lt;0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_SWM-&amp;gt;PINASSIGN8 = regVal | (3 &amp;lt;&amp;lt; 0);/* P0.3 is I2C SCL. ASSIGN0(7:0) */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= (1&amp;lt;&amp;lt;5);//5&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_IOCON-&amp;gt;PIO0_2 =(1&amp;lt;&amp;lt;10); //6&amp;nbsp; setting the iocon open drain mode&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_IOCON-&amp;gt;PIO0_3 =(1&amp;lt;&amp;lt;10);//6 setting the iocon open drain mode&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;DIV = 10000;//7 32mh / 10000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;MSTTIME = 0 ;//8 2 clocks. Minimum SCL high time is 2 clock of the I2C clock pre-divider.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;CFG =0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;CFG = 1;//9 master mode&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;MSTDAT=0xaa; //10 the data its must to send i hope!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;MSTCTL =2;//11 master start&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;delay(1000);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;MSTDAT=0xaa; //10 the data its must to send i hope!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;MSTCTL =1;//11 Master Continue. This bit is write-only.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;delay(1000);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;goto I2CC;&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:13:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Low-level-program-for-I2C/m-p/574065#M18943</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: Low level program for I2C</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Low-level-program-for-I2C/m-p/574066#M18944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by salamlora1 on Mon Jun 09 00:49:59 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi no one answering &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Some one noob need help plz !&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I cheng the program to below &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;And the SDA and ACL have pulse but in the USART I see the 0xAA or anything else I send on LPC_I2C-&amp;gt;MSTDAT&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= (1&amp;lt;&amp;lt;5); //1 clock for i2c&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_SYSCON-&amp;gt;PRESETCTRL |= (0x1&amp;lt;&amp;lt;6);//2 clear resset the i2c&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;INTENSET=0; // 3 disable all interrupts&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;regVal = LPC_SWM-&amp;gt;PINASSIGN7 &amp;amp; ~(0xFFUL&amp;lt;&amp;lt;24); //4&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_SWM-&amp;gt;PINASSIGN7 = regVal | (2 &amp;lt;&amp;lt; 24);/* P0.2 is I2C SDA, ASSIGN0(31:24) */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;regVal = LPC_SWM-&amp;gt;PINASSIGN8 &amp;amp; ~(0xFF&amp;lt;&amp;lt;0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_SWM-&amp;gt;PINASSIGN8 = 0xff0Dff03;/* P0.3 is I2C SCL. ASSIGN0(7:0) */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= (1&amp;lt;&amp;lt;5);//5&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_IOCON-&amp;gt;PIO0_2 |=(1&amp;lt;&amp;lt;10); //6&amp;nbsp; setting the iocon open drain mode&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_GPIO_PORT-&amp;gt;DIR0 |= (1 &amp;lt;&amp;lt; 2);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_IOCON-&amp;gt;PIO0_3 |=(1&amp;lt;&amp;lt;10);//6 setting the iocon open drain mode&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_GPIO_PORT-&amp;gt;DIR0 |= (1 &amp;lt;&amp;lt; 3);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;DIV = 0x100;//7 32mh / 10000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;MSTTIME = 0 ;//8 2 clocks. Minimum SCL high time is 2 clock of the I2C clock pre //divider.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;CFG =0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;CFG = 1;//9 master mode&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;int mmm;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;loooop:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;MSTDAT=0xad;//address for AT24C512C&amp;nbsp; (1-0-1-0-A2-A1-A0-W/R )&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;MSTCTL =2;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while(LPC_I2C-&amp;gt;STAT ==0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;MSTDAT=0x12;//first byte of address &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;MSTCTL =1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while(LPC_I2C-&amp;gt;STAT ==0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;MSTDAT=0xaa;// second byte of address &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;MSTCTL =1;=&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while(LPC_I2C-&amp;gt;STAT ==0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_I2C-&amp;gt;MSTCTL =1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while(LPC_I2C-&amp;gt;STAT ==0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mmm = LPC_I2C-&amp;gt;MSTDAT; // hear must the data in the eeprom &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_USART0-&amp;gt;TXDATA = mmm;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;goto loooop;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PLZ heeeeeeeeeeeeeeelp &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:13:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Low-level-program-for-I2C/m-p/574066#M18944</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: Low level program for I2C</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Low-level-program-for-I2C/m-p/574067#M18945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by salamlora1 on Wed Jun 11 00:46:05 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ting is wrung with my post why no one answering to me???!!!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:13:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Low-level-program-for-I2C/m-p/574067#M18945</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: Low level program for I2C</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Low-level-program-for-I2C/m-p/574068#M18946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lpcxpresso-support on Wed Jun 11 01:04:51 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Have you considered just looking at the example code provided in LPCOpen?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.lpcware.com%2Fcontent%2Fnxpfile%2Flpcopen-software-development-platform-lpc8xx-packages" rel="nofollow" target="_blank"&gt;http://www.lpcware.com/content/nxpfile/lpcopen-software-development-platform-lpc8xx-packages&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPCXpresso Support&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:13:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Low-level-program-for-I2C/m-p/574068#M18946</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:13:38Z</dc:date>
    </item>
  </channel>
</rss>

