please suggest me some API's to interface nrf51422 with RTC DS1307
please suggest me some API's to interface nrf51422 with RTC DS1307
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 TWI master driver for handling the I2C communication with the DS1307.
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).
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
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 TWI Sensor Example?
(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.)
The call of nrf_drv_twi_rx and nrf_drv_twi_tx function is giving this error NRF_ERROR_INTERNAL
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?