<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>twi interfacing with RTC DS1307</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/16209/twi-interfacing-with-rtc-ds1307</link><description>please suggest me some API&amp;#39;s to interface nrf51422 with RTC DS1307</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 08 Sep 2016 11:53:52 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/16209/twi-interfacing-with-rtc-ds1307" /><item><title>RE: twi interfacing with RTC DS1307</title><link>https://devzone.nordicsemi.com/thread/61906?ContentTypeID=1</link><pubDate>Thu, 08 Sep 2016 11:53:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f4697236-73d5-47d2-bd0b-6e9abdad414c</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Which SDK version are you using? (The &lt;code&gt;is_busy&lt;/code&gt; flag has not been used since SDK 10, so I will assume you are using version 10.)&lt;/p&gt;
&lt;p&gt;If you are using the driver in blocking mode (as it looks like you are doing from the code snippet in an earlier comment where you supplied &lt;code&gt;NULL&lt;/code&gt; as the &lt;code&gt;event_handler&lt;/code&gt;), &lt;code&gt;is_busy&lt;/code&gt; should never be set to &lt;code&gt;true&lt;/code&gt;. The only exception I can think of is if you initiate another transfer before the first has finished, which is a bit odd since the call is blocking, but it could happen if you call the driver from two different interrupt priorities (for example from the main context &lt;em&gt;and&lt;/em&gt; an event handler).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: twi interfacing with RTC DS1307</title><link>https://devzone.nordicsemi.com/thread/61905?ContentTypeID=1</link><pubDate>Thu, 08 Sep 2016 11:32:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:96ceada5-6501-4140-9e20-4ce41427d8ca</guid><dc:creator>Murugan</dc:creator><description>&lt;p&gt;Hi Sunil,&lt;/p&gt;
&lt;p&gt;I am also facing same problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: twi interfacing with RTC DS1307</title><link>https://devzone.nordicsemi.com/thread/61904?ContentTypeID=1</link><pubDate>Tue, 06 Sep 2016 14:21:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40509bd1-f8fb-4fa1-9100-d5d33137b41b</guid><dc:creator>sunil kumar</dc:creator><description>&lt;p&gt;Thank you thats working a bit but after first transmission rest ones are not working, in file nrf_drv_twi.c, in function twi_transfer there is a variable is_busy, which remains false after 1st transmission, which is in turn avoiding further communication can i reset it or there is some other procedure?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: twi interfacing with RTC DS1307</title><link>https://devzone.nordicsemi.com/thread/61903?ContentTypeID=1</link><pubDate>Tue, 06 Sep 2016 13:58:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6084a0cc-e611-48c6-b10f-8df0e1d5d06d</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Can you try changing the priority to &lt;code&gt;APP_IRQ_PRIORITY_HIGH&lt;/code&gt; (or &lt;code&gt;APP_IRQ_PRIORITY_LOW&lt;/code&gt;)?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: twi interfacing with RTC DS1307</title><link>https://devzone.nordicsemi.com/thread/61902?ContentTypeID=1</link><pubDate>Tue, 06 Sep 2016 13:28:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ea53ff8-dfdc-4a04-8e95-83b87523c81a</guid><dc:creator>sunil kumar</dc:creator><description>&lt;p&gt;those are the parameters which i used to call &lt;code&gt;nrf_drv_twi_init()&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ret_code_t ret;
	nrf_drv_twi_config_t config;
	config.scl=7;
	config.sda=30;
	config.frequency = NRF_TWI_FREQ_100K;
	config.interrupt_priority=0;
	ret = nrf_drv_twi_init(&amp;amp;instance,&amp;amp;config,NULL,NULL);
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: twi interfacing with RTC DS1307</title><link>https://devzone.nordicsemi.com/thread/61901?ContentTypeID=1</link><pubDate>Tue, 06 Sep 2016 13:15:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:314fb28d-e2c1-4206-b84e-c685eb32b411</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;I see. The RTC of the nRF will not work when the power supply is lost. That sort of applies to the DS1307 too, but there you have the optional backup supply, and moreover, the current consumption of the DS1307 when in battery backup mode is lower than you would get for the nRF5.&lt;/p&gt;
&lt;p&gt;It is difficult to say anything about the error you get returned when calling &lt;code&gt;nrf_drv_twi_rx()&lt;/code&gt; or &lt;code&gt;nrf_drv_twi_tx()&lt;/code&gt;. However I wander if you called &lt;code&gt;nrf_drv_twi_init()&lt;/code&gt; before? With what parameters?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: twi interfacing with RTC DS1307</title><link>https://devzone.nordicsemi.com/thread/61900?ContentTypeID=1</link><pubDate>Tue, 06 Sep 2016 12:33:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d9484d0d-a8ae-4e7a-aa72-13251450f7dc</guid><dc:creator>sunil kumar</dc:creator><description>&lt;p&gt;iam not using any coin cell battery for board iam directly supplying voltage after converting to dc, so if the power goes off does the internal RTC of nrf board work?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: twi interfacing with RTC DS1307</title><link>https://devzone.nordicsemi.com/thread/61899?ContentTypeID=1</link><pubDate>Tue, 06 Sep 2016 12:29:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:378b50e6-c03d-4b7b-ad00-4598bd4eb4e4</guid><dc:creator>sunil kumar</dc:creator><description>&lt;p&gt;The call of nrf_drv_twi_rx and nrf_drv_twi_tx function is giving this error NRF_ERROR_INTERNAL&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: twi interfacing with RTC DS1307</title><link>https://devzone.nordicsemi.com/thread/61898?ContentTypeID=1</link><pubDate>Tue, 06 Sep 2016 12:27:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d90c1d9-94e5-407b-a759-62d4e522ff42</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;The pin numbering can be confusing, as it is not stated explicitly. However, the pin numbers you refer to in software are always the GPIO pin numbers (P0.x in the product specification and DK marking). Have you looked at the &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.0.0/twi_sensor_example.html?cp=4_0_0_4_5_32"&gt;TWI Sensor Example&lt;/a&gt;?&lt;/p&gt;
&lt;p&gt;(Regarding the crystal you will anyway need a 32 kHz crystal for the DS1307, so you do not save a crystal on the BOM by using the DS1307.)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: twi interfacing with RTC DS1307</title><link>https://devzone.nordicsemi.com/thread/61897?ContentTypeID=1</link><pubDate>Tue, 06 Sep 2016 12:01:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8b367f0-f1fd-411e-a3db-8f4f329c5014</guid><dc:creator>sunil kumar</dc:creator><description>&lt;p&gt;hi Einar,  thank you for your reply, i tried TWI master driver but nrf_drv_twi_rx and nrf_drv_twi_tx are not working i gave slave address as 0xD0 for tx and 0xD1 for rx, i might be missing some procedural steps please can you describe the procedure, and iam little bit confused about scl and sda port numbers either i should give pin number(eg:pin number 3 for p30) or port number(eg:30 for p30), and i cannot use internal RTC because of some reasons iam not using 32KHz crystal&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: twi interfacing with RTC DS1307</title><link>https://devzone.nordicsemi.com/thread/61896?ContentTypeID=1</link><pubDate>Tue, 06 Sep 2016 08:48:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f333fdc0-b6e7-4509-955a-c701419f04cb</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;I have not found a library that will drop directly into the SDK, but there are several libraries out there that you can look at for inspiration. You will also want to look at the &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.0.0/hardware_driver_twi.html?cp=4_0_0_2_18"&gt;TWI master driver&lt;/a&gt; for handling the I2C communication with the DS1307.&lt;/p&gt;
&lt;p&gt;If you intend to power the nRF at all times (which is the case for most products), it could be an option to use the internal RTC instead of a external RTC. You would have to handle the complexities of date and time, such as adjusting for months with fewer than 31 days and corrections for leap year in software, but the accuracy will be just as good as using the DS1307 (as it only depends on the 32 kHz crystal).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>