<?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>LPC MicrocontrollersのトピックRe: LPC1768 interfacing with DS3231 problem</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-interfacing-with-DS3231-problem/m-p/593488#M22512</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You're not telling what exactly you are sending to the RTC, so I'm unable to comment.&lt;/P&gt;&lt;P&gt;If you are sure that you have followed the DS3231 data sheet instructions precisely, it might be better to ask the Maxim guys for assistance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 12 Aug 2016 08:36:25 GMT</pubDate>
    <dc:creator>rolfmeeser</dc:creator>
    <dc:date>2016-08-12T08:36:25Z</dc:date>
    <item>
      <title>LPC1768 interfacing with DS3231 problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-interfacing-with-DS3231-problem/m-p/593485#M22509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using the I2C driver from this link &lt;A _jive_internal="true" href="https://community.nxp.com/servlet/JiveServlet/download/11497-431883-820007-391187/mcb1700.code_.bundle.lpc17xx.keil_.zip" title="https://community.nxp.com/servlet/JiveServlet/download/11497-431883-820007-391187/mcb1700.code_.bundle.lpc17xx.keil_.zip"&gt;https://community.nxp.com/servlet/JiveServlet/download/11497-431883-820007-391187/mcb1700.code_.bundle.lpc17xx.keil_.zip&lt;/A&gt;&amp;nbsp; to get the time data from a RTC chip (DS3231). But I keep getting I2C_NACK_ON_ADDRESS after sending the first byte which is the slave address (0x68) and I can't go forward after this.&lt;/P&gt;&lt;P&gt;All things seems to be ok. I used I2C0 and configured it correctly and using a famous DS3231 module with battery and everything and with 4.7K pull-up resistors.&lt;/P&gt;&lt;P&gt;What could be the problem?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Aug 2016 14:42:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-interfacing-with-DS3231-problem/m-p/593485#M22509</guid>
      <dc:creator>mostafanfs</dc:creator>
      <dc:date>2016-08-11T14:42:50Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1768 I2C gets NACK on Address from DS3231</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-interfacing-with-DS3231-problem/m-p/593486#M22510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try slave address 0xD0 instead of 0x68.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Aug 2016 19:29:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-interfacing-with-DS3231-problem/m-p/593486#M22510</guid>
      <dc:creator>rolfmeeser</dc:creator>
      <dc:date>2016-08-11T19:29:54Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1768 I2C gets NACK on Address from DS3231</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-interfacing-with-DS3231-problem/m-p/593487#M22511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well Thank you. That solved my first problem. Now I'm using 0xD0 for write operations and 0xD1 for read operations.&lt;/P&gt;&lt;P&gt;Now I don't get NACK on anything but I just keep getting zeros when I attempt to read time and date registers.&lt;/P&gt;&lt;P&gt;I've been told that I need to set the timekeeping register values first. I tried to set some values before any attempt to read those registers. But I still keep reading zeros or nothing.&lt;/P&gt;&lt;P&gt;I don't know what is wrong. Do you guys have some ideas about it?&lt;/P&gt;&lt;P&gt;Do I need to set any control bit or something or just reading and writing to address registers 0x00 ~ 0x07 is enough? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Aug 2016 07:33:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-interfacing-with-DS3231-problem/m-p/593487#M22511</guid>
      <dc:creator>mostafanfs</dc:creator>
      <dc:date>2016-08-12T07:33:21Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1768 interfacing with DS3231 problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-interfacing-with-DS3231-problem/m-p/593488#M22512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You're not telling what exactly you are sending to the RTC, so I'm unable to comment.&lt;/P&gt;&lt;P&gt;If you are sure that you have followed the DS3231 data sheet instructions precisely, it might be better to ask the Maxim guys for assistance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Aug 2016 08:36:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-interfacing-with-DS3231-problem/m-p/593488#M22512</guid>
      <dc:creator>rolfmeeser</dc:creator>
      <dc:date>2016-08-12T08:36:25Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1768 interfacing with DS3231 problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-interfacing-with-DS3231-problem/m-p/593489#M22513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;According to datasheet there is not much to send. I have sent some values to register address 0x00 and read back from this address.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14709928299208191 jive_text_macro" data-hasrefreshed="true" data-renderedposition="58_8_1179_564" jivemacro_uid="_14709928299208191"&gt;&lt;P&gt;#define PORT_USED&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void open_ds3231(void){&lt;/P&gt;&lt;P&gt;&amp;nbsp; I2C0Init();&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.73;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uint32_t rtc_set_time(uint8_t hour,uint8_t min,uint8_t sec)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; uint32_t state;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Write SLA(W), address and one data byte */&lt;/P&gt;&lt;P&gt;&amp;nbsp; I2CWriteLength[PORT_USED] = 5;&lt;/P&gt;&lt;P&gt;&amp;nbsp; I2CReadLength[PORT_USED] = 0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; I2CMasterBuffer[PORT_USED][0] = DS3231_ADDR_WRITE;&amp;nbsp; // 0xD0&lt;/P&gt;&lt;P&gt;&amp;nbsp; I2CMasterBuffer[PORT_USED][1] = 0x00;&amp;nbsp; // Second register address&lt;/P&gt;&lt;P&gt;&amp;nbsp; I2CMasterBuffer[PORT_USED][2] = bin2bcd(sec);&lt;/P&gt;&lt;P&gt;&amp;nbsp; I2CMasterBuffer[PORT_USED][3] = bin2bcd(min);&lt;/P&gt;&lt;P&gt;&amp;nbsp; I2CMasterBuffer[PORT_USED][4] = bin2bcd(hour);&lt;/P&gt;&lt;P&gt;&amp;nbsp; state = I2CEngine( PORT_USED );&lt;/P&gt;&lt;P&gt;&amp;nbsp; return state;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uint32_t rtc_get_time(uint8_t *hour,uint8_t *min,uint8_t *sec)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; uint32_t state;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Write SLA(W), address and one data byte */&lt;/P&gt;&lt;P&gt;&amp;nbsp; I2CWriteLength[PORT_USED] = 2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; I2CReadLength[PORT_USED] = 3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; I2CMasterBuffer[PORT_USED][0] = DS3231_ADDR_READ; // 0xD1&lt;/P&gt;&lt;P&gt;&amp;nbsp; I2CMasterBuffer[PORT_USED][1] = 0x00;&lt;/P&gt;&lt;P&gt;&amp;nbsp; state = I2CEngine( PORT_USED );&lt;/P&gt;&lt;P&gt;&amp;nbsp; *sec=bcd2bin(I2CSlaveBuffer[PORT_USED][0]);&lt;/P&gt;&lt;P&gt;&amp;nbsp; *min=bcd2bin(I2CSlaveBuffer[PORT_USED][1]);&lt;/P&gt;&lt;P&gt;&amp;nbsp; *hour=bcd2bin(I2CSlaveBuffer[PORT_USED][2]);&lt;/P&gt;&lt;P&gt;&amp;nbsp; return state;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is one thing that I noticed. By setting some breakpoints in i2c.c file in I2C0_IRQHandler() routine I found out it goes to this case after sending the first byte :&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14709934840851848 jive_text_macro" data-hasrefreshed="true" data-renderedposition="672_8_1179_0" jivemacro_uid="_14709934840851848"&gt;&lt;/PRE&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="_jivemacro_uid_14709936103463768 jive_macro_code jive_text_macro" data-hasrefreshed="true" data-renderedposition="672_8_1179_80" jivemacro_uid="_14709936103463768"&gt;&lt;P&gt;&lt;SPAN class="Apple-tab-span" style="white-space: pre;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;case 0x38:&lt;SPAN class="Apple-tab-span" style="white-space: pre;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;/* Arbitration lost, in this example, we don't deal with multiple master situation */&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Apple-tab-span" style="white-space: pre;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;default:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Apple-tab-span" style="white-space: pre;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;I2CMasterState[0] = I2C_ARBITRATION_LOST;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Apple-tab-span" style="white-space: pre;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;LPC_I2C0-&amp;gt;CONCLR = I2CONCLR_SIC;&lt;SPAN class="Apple-tab-span" style="white-space: pre;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Apple-tab-span" style="white-space: pre;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;break;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Aug 2016 09:11:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-interfacing-with-DS3231-problem/m-p/593489#M22513</guid>
      <dc:creator>mostafanfs</dc:creator>
      <dc:date>2016-08-12T09:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1768 interfacing with DS3231 problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-interfacing-with-DS3231-problem/m-p/593490#M22514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I understand the state machine implementation in the code bundle driver correctly, then a small modification to your get_time() function is necessary.&lt;/P&gt;&lt;P&gt;The first address byte must be a write address, and the read address must be added as a third byte in the MasterBuffer. The driver appears to use that third byte when it reaches state 0x10 (after the repeated start).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV class="dp-highlighter"&gt;&lt;DIV class="bar"&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;OL class="dp-cpp" start="1"&gt;&lt;LI class="alt"&gt;&lt;SPAN&gt;I2CWriteLength[PORT_USED]=&lt;SPAN class="number"&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI class="alt"&gt;&lt;SPAN&gt;I2CReadLength[PORT_USED]=&lt;SPAN class="number"&gt;3&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;I2CMasterBuffer[PORT_USED][&lt;SPAN class="number"&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;]=DS3231_ADDR_WRITE;&lt;/SPAN&gt;&lt;SPAN class="comment"&gt;//0xD0&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI class="alt"&gt;&lt;SPAN&gt;I2CMasterBuffer[PORT_USED][&lt;SPAN class="number"&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;]=&lt;/SPAN&gt;&lt;SPAN class="number"&gt;0x00&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;I2CMasterBuffer[PORT_USED][2&lt;SPAN class="number"&gt;]=DS3231_ADDR_READ;&lt;SPAN class="comment"&gt;//0xD1&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;state=I2CEngine(PORT_USED);&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/DIV&gt;&lt;PRE class="c++" style="display: none;"&gt; case 0x38: /* Arbitration lost, in this example, we don't deal with multiple master situation */&amp;nbsp; default:&amp;nbsp; I2CMasterState[0] = I2C_ARBITRATION_LOST;&amp;nbsp; LPC_I2C0-&amp;gt;CONCLR = I2CONCLR_SIC;&amp;nbsp;&amp;nbsp; break;&lt;/PRE&gt;&lt;DIV style="display: none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Aug 2016 11:03:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-interfacing-with-DS3231-problem/m-p/593490#M22514</guid>
      <dc:creator>rolfmeeser</dc:creator>
      <dc:date>2016-08-12T11:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1768 interfacing with DS3231 problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-interfacing-with-DS3231-problem/m-p/593491#M22515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well it didn't solve the problem.&lt;/P&gt;&lt;P&gt;What about the rtc_set_time() ? Is it in a correct form?&lt;/P&gt;&lt;P&gt;Cause when I first call rtc_set_time() the state reaches to I2C_OK in 0x28 and I think it's fine :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_18.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/3225i422C192132730888/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_18.png" alt="pastedImage_18.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But after this when I call rtc_get_time() it keeps going to the I2C_ARBITRATION_LOST state in case 0x38 or default case except the first time after writing the first byte into I2CDAT register (case 0x08) : Why this keeps happening?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_19.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/3278iAA83F640C36F4DEC/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_19.png" alt="pastedImage_19.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why do you think about these lines that has been written in the i2c.c driver file ?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/3164i82BCC0810B9FEAE3/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Aug 2016 12:22:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-interfacing-with-DS3231-problem/m-p/593491#M22515</guid>
      <dc:creator>mostafanfs</dc:creator>
      <dc:date>2016-08-12T12:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1768 interfacing with DS3231 problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-interfacing-with-DS3231-problem/m-p/593492#M22516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We need to see what's going on on the bus (trace). Can you provide scope pictures or logic analyzer trace?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Aug 2016 12:41:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-interfacing-with-DS3231-problem/m-p/593492#M22516</guid>
      <dc:creator>rolfmeeser</dc:creator>
      <dc:date>2016-08-12T12:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1768 interfacing with DS3231 problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-interfacing-with-DS3231-problem/m-p/593493#M22517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not right now !&amp;nbsp; Actually I was kind if hoping it wouldn't get to there !&lt;/P&gt;&lt;P&gt;I'll see what can I do tomorrow about the scope. &lt;/P&gt;&lt;P&gt;I don't get it why would a simple RTC give me such a hard time. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Aug 2016 13:19:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-interfacing-with-DS3231-problem/m-p/593493#M22517</guid>
      <dc:creator>mostafanfs</dc:creator>
      <dc:date>2016-08-12T13:19:22Z</dc:date>
    </item>
  </channel>
</rss>

