Processor Expert Maxim I2C RTC for the Arduino Data Logger Shield

There was one part missing to complete the software support for my Arduino DataLogger Shield on top of my FRDM-KL25Z Freedom board: support for the Maxim DS1307 RTC (Real Time Clock).

DS1307 on the Adafruit Data Logger Shield

DS1307 on the Adafruit Data Logger Shield (Source: http://www.ladyada.net/make/logshield/design.html)

Things got delayed a bit, as I first needed to get the I2C infrastructure up and running (see this post). But finally, I have things working :-). I proudly present: RTC_Maxim!

Maxim I2C Real Time Clocks

The component now supports two different Maxim I2C Realtime Clocks: the DS3232 and the DS1307.

The DS1307 present on the Adafruit Data Logger Shield:

DS1307 on the Arduino Data Logger Shield, on top of the FRDM-KL25Z

DS1307 on the Arduino Data Logger Shield, on top of the FRDM-KL25Z

The DS3232 is a device I have used in many of my designs:

DS3232 on custom Tower Board

DS3232 on custom Tower Board

For ‘classic’ (non-LDD) Processor Expert, there has been a component (RTC_I2C_DS1307) for the DS1307 with my custom extensions for the DS3232. But as with many other things: these ‘classic’ components do not work for Kinetis, as with Kinetis there are LDD (Logical Device Driver) components, and they are not compatible. That’s why I ended up implementing my own RTC_Maxim component which works both for the LDD and non-LDD world (see as well this post).

RTC_Maxim Processor Expert Component

The component takes advantage of the GenericI2C component.

Properties of the RTC_Maxim Processor Expert component

Properties of the RTC_Maxim Processor Expert component

As ‘Device’ either the DS3232 or the DS1307 can be selected. The component features an optional Shell interface (ParseCommand()) to the FSShell. Beside of this, it features the usual functions to get/set date and time:

Methods of the RTC_Maxim Processor Expert component

Methods of the RTC_Maxim Processor Expert component

The Read() and Write() methods are used to to access the device non-volatile memory and registers.

Limitations

The component now only supports date and time functions, plus access to the device non-volatile RAM. Support for the other features (temperature sensor, alarm functions, oscillator output, etc) would be a topic for further work. Maybe somebody volunteers to extend the current functionality?

Component Sources

The component (and sources) can be downloaded from this link: RTC_Maxim. The FSShell and FAT_FileSystem components have been updated as well with new interfaces.

Happy Maximing 🙂

12 thoughts on “Processor Expert Maxim I2C RTC for the Arduino Data Logger Shield

  1. Thanks, I have been looking to get RTC functionality working on my freedom boards and I have just ordered a DS1307 so this should be very useful 🙂

    I do have one question though, why not use the internal RTC on the M0+ (RTC_LDD component)? Surely this should provide a lower-power option with all alarm functionality, etc. already there. I have been trying to get this working but I am running into clock source problems (cannot source from anything except ERCLK32K, which in turn needs to be sourced from external as the LPO under clocks it and PE won’t generate the code).

    Like

  2. hi Erich, i am using your DS1307 maxima componect with I2C_LDD and my code is stuck in /* Wait until data is sent */ of GI2C1_ReadAddress function.

    i check hardware, its working. i checked the pins by toggling them.

    i have verified the clock setting as mention in https://mcuoneclipse.com/2012/12/05/kl25z-and-i2c-missing-repeated-start-condition/

    can you please help me, i have wasted 6 hours figuring what might have gone wrong.

    the internal RTC works fine. but the project requirement is to have a DS1307 RTC with an Eeprom….so have to get this problem solved.

    Like

  3. Hi Erich.

    I have been working with RTC for almost a week now. I want to ask you for your hardware set up for DS1307. I know DS1307 use 5 Volt VCC and KL25Z use 3.3 Volt VCC. How do you interface the pull up resistor for SDA and SCL between DS1307 to KL25Z? Do you use 5 volt or 3.3 volt as the VCC? What is the pull up resistor value? (2.2k Ohm) What setting value for your SCL frequency, SDA Hold, SCL start hold, and SCL stop hold? I am having same problem with previous post: “wait until data sent”. I use a working example from Freescale “accelerometer_demo”. When I use for DS1307 with different pint, I did not get any dataTransmittedFlg complete. So I do not know is this a hardware problem wrong VCC value? (I use 3.3 Volt for my SDA and SCL pull up resistor) Wrong Set up problem? (Incorrect SCL frequency, SDA Hold, SCL start hold, and SCL stop hold) or other problems?

    Thanks.

    Like

What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.