This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DS3232 RTC driver usage

Hi group,

 

I have the subject real time clock chip interfaced to my beagleboard XM.  The driver is in the kernel as a module, source is at drivers/rtc/rtc-ds3232.c.  I can insmod the driver, but that's where things break down for me:   I do not know how to access the driver functionality within user space.   The special file /dev/rtc0 is the built in RTC.   I think that an i2c device must be bound and passed to the DS3232 driver, but I have not found any information as to how that is done.  If anyone knows and can help, I would be very glad.

 

PS an I2c detection program detects the RTC chip at it's adress on bus 2.

 

Thanks in advance, Drake..

  • OK, it was not so hard, once I found what to do, the answer is as follows:

    What was missing was that the underlying i2c device had to be instantiated using the following shell command: "echo ds3232 0x68 >/sys/bus/i2c/devices/i2c-2/new_device". This causes the device driver to be loaded, and the device special file /dev/rtc1 to be created, and the device is ready for business,  /dev/rtc1 may be opened and the normal rtc ioctl commands will work..  This is method 4 in the linux kernel documentation file found at Documentation/i2c/instantiating-devices.

    About the echo command, 0x68 is of course the slave address of ds3232, on my system there are 3 i2c buses, ds3232 (or ds3231, they work the same) is on i2c bus 2, thus the file path node i2c-2 in the echo command.  The driver name is ds3232. new_device is a driver interface file that expects to be written as in the echo command described above.  

    Thanks to Jean Delvare in the newsgroup gmane.linux.drivers.i2c, newsgroup server news.gmane.org for answering my question and helping me.See http://search.gmane.org/?query=rtc-ds3232&author=&group=gmane.linux.drivers.i2c&sort=date&DEFAULTOP=and&xP=rtc%09ds3232&xFILTERS=Glinux.drivers.i2c---A for the thread.