[Tutor] Can we talk with a Real Time Clock hardware by Python?

Alan Gauld alan.gauld at yahoo.co.uk
Mon Feb 13 05:47:00 EST 2017


On 13/02/17 06:44, Thanh Tuan Le wrote:
> I have a board that have a Real Time Clock (RTC) chip on that board. I need
> to communicate with that RTC chip by Python.
> 
> Following is my hardware info.
> - Board from Variscite:
> http://www.variscite.com/products/single-board-computers/dt6customboard
> - RTC chip on board: ISL12057
> - OS: Yocto

I know nothing about this specific board or clock.
However, in general you need an API to talk to any
kind of hardware. Boards like this usually provide
a C API - do you have documentation for that?

If thee is a C API there is a good chance that
you can talk to it using the ctypes module.
But ctypes is not easy to use so be prepared
for a lot of trial and error.

It's also possible, if you know C, to build a
library and then wrap it up as a Python module
using SWIG or similar technology. But this is
only an option if you are already comfortable
working in C.

The best option is if a Google search shows
that somebody has already done that work and
made the python module available to download.


> 
> I need to do 2 basic operations for this RTC chip
> - Write/Read to registers of that RTC.
> - Detect the Interrupt at each time it asserted.

It would also help to know more about your environment.
What is your host computing platform and OS?
How is the board attached to the computer?
(USB, PCI, jumper, soldered?)
And which version of Python are you using?


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list