Python Forum
How to talk with Real Time Clock hardware?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to talk with Real Time Clock hardware?
#1
Dear all,

I am finding a way to read/write to my Real Time Clock Hardware by Python.

The background is as below.

I have a board that integrated an RTC named ISL12057 on it. I need to control that RTC from Python. RTC uses I2C protocol to access to its registers.

Did you have any experience to do this? I spend around 2 days to investigate but there is no sufficient info  Sad .

Thank you for any help.
Reply
#2
Hello,
What board are you using? Does that board have a hardware abstraction Python library to control GPIO and such? That is where I would be looking for an I2C driver.
Reply
#3
(Feb-10-2017, 11:12 AM)j.crater Wrote: Hello,
What board are you using? Does that board have a hardware abstraction Python library to control GPIO and such? That is where I would be looking for an I2C driver.

Hi,

My board is VAR-DT6CustomBoard.

This board is from Variscite and the RTC ISL12057 is on the board. VAR-DT6CustomBoard is a base board, it is controlled by DART-MX6 CPU.

As I search on the Internet, there are 2 libraries of Python that can talk to that RTC.

1. SMBus: Use I2C protocol that can talk to a device using I2C protocol, SMBus.

The link is for application on Raspberry Pi. In this application, they use SMBus supported by Python to talk with RTC.

2. python-pyrtc library. It is from FreeSmartphone. I tried this library but it has error. I raised the issue in another topic in our forum, here.

So, if you have any advice for my question, please tell me.

Thank you for any help.
Reply
#4
You will probably find everything you need in the data sheet: http://www.variscite.com/images/stories/..._v_1_1.pdf
Reply
#5
(Feb-13-2017, 03:43 AM)Larz60+ Wrote: You will probably find everything you need in the data sheet: http://www.variscite.com/images/stories/..._v_1_1.pdf

Thank you. I already read the data sheet of that board > 10 times. It just shows the components (ports, interfaces, ...), but my need is very specific: Talk to RTC on that board by Python.

Actually, I have investigated this matter so far. I need your experience to give me an advice for my question. It is OK if you have just an idea. I do not need you show all the code/logic to solve my question. I know this matter is too specific field, so any idea is appreciated.

Thanks.
Reply
#6
If there is not yet a Python library written for the hardware, then the only way to use 100% Python is to write your own API for this RTC.
But it looks like there is driver source code available for the particular piece of hardware:
https://community.nxp.com/thread/444238#comment-875522
Presumably in C, so you can write Python which calls C functions/code. Python+C is already different topic though.
Reply
#7
(Feb-13-2017, 06:22 AM)j.crater Wrote: If there is not yet a Python library written for the hardware, then the only way to use 100% Python is to write your own API for this RTC.
But it looks like there is driver source code available for the particular piece of hardware:
https://community.nxp.com/thread/444238#comment-875522
Presumably in C, so you can write Python which calls C functions/code. Python+C is already different topic though.

Thanks for your idea.

The thread you showed is my created thread. I have little experience in Python, so the answer in that thread is not satisfactory me!

As I raised in that thread, there is a Python library for this piece of the same hardware (DS1307, not ISL12057), but I stuck at SMBus error.

Python lib: http://www.switchdoc.com/2014/07/python-...ime-clock/

If you still have more enthusiasm, you can read the error I showed in that thread.

Currently, I have no way or idea to solve my question Sad  Confused .
Reply
#8
I thought I'd look into the RTC a bit more, but I can't even find it on the block diagram.
What is the RTC chip id?
I've programmed a bunch of these on TI SBC's but have never used hardware from this company.
Is the realtime clock built into the board, a piggyback, or a standard chip?

Is there a user manual for this board? (not the datasheet)

I'm beginning to think that this is for the system clock, and someone just called it an RTC. Do you know for
a fact that there really is one?

I found a small section on the RTC (there really is one).
There are a couple of  lines total in the datasheet, but it may be enough
This is what you've got:

ISL12057 RTC
RTC Backup battery - CR1225 Battery Holder

That's it! but that is enough to get the datasheet which is here: https://www.intersil.com/content/dam/Int...l12057.pdf
This is an Intersil chip, and is programmed by I2c

The MCU is a DART-MX6, and here http://variwiki.com/index.php?title=VAR-...e_Clock.29
is the info that I can find on setting the RTC.
Reply
#9
(Feb-13-2017, 07:33 AM)Larz60+ Wrote: I thought I'd look into the RTC a bit more, but I can't even find it on the block diagram.
What is the RTC chip id?
I've programmed a bunch of these on TI SBC's but have never used hardware from this company.
Is the realtime clock built into the board, a piggyback, or a standard chip?

Is there a user manual for this board? (not the datasheet)

I'm beginning to think that this is for the system clock, and someone just called it an RTC. Do you know for
a fact that there really is one?

* What is the RTC chip id?

The RTC chip id: ISL12057. It is from Intersil.

You can see it at Board Schematic, page 6.

* Is the realtime clock built into the board, a piggyback, or a standard chip?


As I read the datasheet, the realtime clock hardware is only ISL12057 chip, and it is integrated on the board (on board chip, not external connection).

* Is there a user manual for this board? (not the datasheet)


I have Quick Start Guide for this board. It may be the User Manual. For the Guide, I have only that document.
I tried to find other User Manual, but there is only Quick Start Guide.

For other document (datasheet, schematic), you can access to the VAR-DT6 board, select "Documentation" tab.

* I'm beginning to think that this is for the system clock, and someone just called it an RTC. Do you know for
a fact that there really is one?

I do not know exactly.

Actually, as I know, the RTC chip will hold the time even though the power supply is off. The RTC is fed by a coin battery. When the board is powered on again, the system time is updated from the RTC chip. That is what I understand.

(Feb-13-2017, 07:54 AM)Larz60+ Wrote: I thought I'd look into the RTC a bit more, but I can't even find it on the block diagram.
What is the RTC chip id?
I've programmed a bunch of these on TI SBC's but have never used hardware from this company.
Is the realtime clock built into the board, a piggyback, or a standard chip?

Is there a user manual for this board? (not the datasheet)

I'm beginning to think that this is for the system clock, and someone just called it an RTC. Do you know for
a fact that there really is one?

I found a small section on the RTC (there really is one).
There are a couple of  lines total in the datasheet, but it may be enough
This is what you've got:

ISL12057 RTC
RTC Backup battery - CR1225 Battery Holder

That's it! but that is enough to get the datasheet which is here: https://www.intersil.com/content/dam/Int...l12057.pdf
This is an Intersil chip, and is programmed by I2c

The MCU is a DART-MX6, and here http://variwiki.com/index.php?title=VAR-...e_Clock.29
is the info that I can find on setting the RTC.

Thank you Mr.Larz60+ for your enthusiasm!

For handle RTC ISL21057, Variscite shows a page here
http://www.variwiki.com/index.php?title=IMX_RTC

Actually, this is a linux command to set to RTC. I expect we can use Python to control that RTC.

I am have no experience in Python. So, can we use 100% Python to control it or we should use Python to issue a linux command to set RTC?

For example (just example, not correct all thing):

1. 100% python:
We must use some Python libraries to talk to RTC by I2C protocol.

2. Python to issue a Linux command to set RTC.
print("date --set="20150225 09:04"")
print("hwclock --systohc --utc")

These print commands of Python will send the Linux command ' date --set="20150225 09:04" ', 'hwclock --systohc --utc' to RTC of the board.

So, which case (1 or 2) is feasible and take less effort? Please teach me a little.

PS: By the way, I still have another question about "talk to RTC". Sorry for many questions. I will ask you after my current question can be solved and you are willing help me for next question!
Reply
#10
Did you look at the document in?

Quote:The MCU is a DART-MX6, and here http://variwiki.com/index.php?title=VAR-...e_Clock.29

It's still there.
the command:
hwclock
seems to be an os (proprietary for board?) command used to access RTC
Sorry that's about the extent of what I can offer.
You will need to dig some more, as frustrating as it is for you, same for me.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Non-blocking real-time plotting slow_rider 5 3,619 Jan-07-2023, 09:47 PM
Last Post: woooee
  Real time database satyanarayana 3 1,667 Feb-16-2022, 01:37 PM
Last Post: buran
  Real time data satyanarayana 3 23,885 Feb-16-2022, 07:46 AM
Last Post: satyanarayana
  Real time Detection and Display Gilush 0 1,788 Feb-05-2022, 08:28 PM
Last Post: Gilush
  Module 'time' has no attribute 'clock' Sophie 4 3,118 Jan-25-2022, 08:05 PM
Last Post: Sophie
  Clock\time calculation script Drone4four 3 1,478 Jan-21-2022, 03:44 PM
Last Post: ibreeden
  Real-Time output of server script on a client script. throwaway34 2 2,054 Oct-03-2021, 09:37 AM
Last Post: ibreeden
  time.clock not functioning Oldman45 3 2,700 Apr-07-2021, 08:51 AM
Last Post: Oldman45
  Real Time Audio Processing with Python Sound-Device not working Slartybartfast 2 3,981 Mar-14-2021, 07:20 PM
Last Post: Slartybartfast
Question I can't get my real-time chart with Python (Help!) Bastian_ElProfe 1 2,225 Jan-20-2021, 01:34 PM
Last Post: wostan

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020