DragonBoard 410c with Real-time clock (RTC)

Hi, I would like to know if it is possible to connect a Real-time clock (RTC) to the DragonBoard 410c. We’re interested in using the DragonBoard 410c for embedded applications where the power is disconnected frequently and there is no internet connection available. If so, can anyone recommend a specific RTC module and/or installation instructions?

Thanks and regards,


Hi Ernst:

Seeed Studios has a real-time clock module based on the Dallas Semi-conductor DS1307. This module can be easily connected (through a level shifter) to the I2C0 bus on the low-speed expansion connector. I checked in the menuconfig system under real-time-clocks and there is support for the DS1307 in the kernel. you will need to modify the device tree and recompile the kernel with support turned in. At this point you will have a real-time clock that you can read.

Unfortunately I don’t have one of these modules yet so I can’t test it for you. I do not know if the system will probe and read the DS1307 to set the real-time. All I do know is it sure looks like there is support for it.

Full disclosure: I am an employee of Qualcomm Canada. Any opinions I have expressed in this or any other post may not reflect the opinions of my employer.

Hi Ernst:

I managed to get a chance to test a ds1307 today. Once you connect it and make the kernel and device tree changes it works perfectly.

  1. Connect the hardware. You need to connect 5V power and ground. The I2C signals SCL and SDA need to go through a level shifter.

  2. Modify the device tree. in the file arch/arm64/boot/dts/qcom/msm8916.dtsi add the following under blsp_i2c0

compatible = "maxim,ds1307";
reg = <0x68>;
status = "okay";
  1. Modify the kernel. After you build the .config file (make defconfig distro.config) you need to run “make menuconfig” and turn on the DS1307 drivers. Then complete building the kernel, the dts, and install the new kernel on the board.

Once you do all of this the kernel will read the time from the clock at power-up time. If you are connected to the network, the kernel will write the current time into the DS1307.

One more little thing. You need to set the real-time clock, remove the default system clock and install the real time clock.

sudo hwclk –w 	# write the time.
sudo update-rc.d -f fake-hwclock remove
sudo update-rc.d hwclock.sh enable

i want to ask that for RTC it this python code usefull actually i am unable to figure out.
please help.
please find the link below:

Hi @nageshkar

We are talking about two different ways to read the time from the DS1307 chip.

The first way that I described above tells the Linux kernel about the reat time clock chip, and after it is set up the Linux kernel takes care of the chip. If you want to get the time from the Linux kernel into your python program there are many ways, discussed here: https://stackoverflow.com/questions/415511/how-to-get-current-time-in-python

The code you have attached assumes that the linux kernel knows nothing about the DS1307 chip, and goes out through the I2C bus and reads the DS1307 chip directly. This will of course fail if you already have the Linux kernel taking care of the DS1307.

You need to select one way or the other, you can’t mix them. I would strongly suggest that you let the Linux kernel take care of time and have your Python program just get the time from the kernel, or from the network. Of course if your board is connected to the network, the Linux kernel doesn’t need the DS1307, it just picks up the current time from the network.

Full disclosure: I am an employee of Qualcomm Canada, any opinions I have expressed in this or any other post may not reflect the opinions of my employer.

Thank you for reply,

As we know there is no real time clock in DB410 C that’s why we are
connecting external ds1307.

Actually in my case dragon board is not connected to any network, I want to
know still it will work if I go through linux kernal method?

I thought it will not work thats why I am thinking of second way. If I want
to use ds1307 with i2c interface to give me date and time will it work?
Provided my device is not connected to any network.

Please suggest which method will be beneficial.

Since your device is not connected to the network, then you will need a DS1307 connected to the I2C bus. You could access the DS1307 with the python program, however all of the system functions and the timestamps on your files will be wrong. It is much better to setup the Linux kernel to use the DS1307 this way every time your system boots, the kernel will have the correct real time and everything will work as expected. Once the Linux kernel knows the correct real time (from the DS1307), your python program can pick up the time from the system and never needs to access the DS1307 directly.

Full disclosure: I am an employee of Qualcomm Canada, any opinions I have expressed in this or any other post may not reflect the opinions of my employer.

@nageshkar; your objective is to tell the kernel about the rtc. Your python program will turn out to be a really HACKISH and ugly way to deal with time. Let the kernel do its job.

I am unable to modify device tree.
are above steps are exact steps to modify device tree if can you tell me exact way to modify device tree?
and third point in which you have mentioned to run device drivers please explain.

When we moved the forums to the new server, the formatting of the code examples got messed up. it should look like this:

Full disclosure: I am an employee of Qualcomm Canada, any opinions I have expressed in this or any other post may not reflect the opinions of my employer.

Thanks for replying
Actually I am unable to find out this path you told for modifying device tree.
path you said is arch/arm64/boot/dts/qcom/msm8916.dts
can you tell me in which directory or file it is stored
and can you please explain the procedure to modify device tree.

Thanks In advance!

Hi @nageshkar

The patch is relative to the kernel source directory.

The best documented route (not the shortest… but the best documented) for you to take is to follow the instructions in the release notes to build the kernel. That way you’ll have the file you need to modify and instructions on how to installed it.

See http://releases.linaro.org/96boards/dragonboard410c/linaro/debian/latest/ (scroll down) for the release notes.

The alternative short but less well documented route is to use the tools @Loic put together: https://github.com/96boards/dt-update . This can be used to dynamically update the DT on the DB410C itself.

Updated post at 10:06UK to fix the link…

You can indeed use dt-update tools to achieve this, I added support for ds1307:

git clone https://github.com/96boards/dt-update.git && cd dt-update
make -C tools/dbootimg
make -C tools/dtbtool

This will create a child ds1307 node under i2c0.
After rebooting you should see the following:

cat /sys/class/i2c-dev/i2c-0/device/0-0068/name 

You will need to have the rtc-ds1307 driver built anyway.

Thanks for replying
last command is not executing
it is showing error that no such file or directory is present

can you help?

I indicated a wrong git repo, I edited my previous post (use https://github.com/96boards/dt-update.git).

hey @Loic
after executing the last command it is showing that
unable to open boot image /dev/disk/by-partlabel/boot
invalid DTB 0
failed to update DTB.
can you help?

Which os are you running ? is it the original one or did you already flash a release ?

I am using default version came with my dragon board.
I am using this:Linux linaro-alip 4.9.30-linaro-lt-qcom #1 SMP PREEMPT Wed Jun 7 15:35:05 UTC 20 17 aarch64 GNU/Linux

So I strongly suggest you to update anyway, via one of these methods: https://www.96boards.org/documentation/consumer/dragonboard410c/downloads/debian.md.html