I have a question about I2C ports on a Beagleboard XM.
I have successfully link a Sparkfun Real Time Clock (I2C-RTC) to port
I2C-2 on the BB via a 1.8V to 5.0V level shifter. The I2C-RTC uses I2C
address 0x68.
I have written a program that reads the data from the RTC which I
intend to use to set the system date/time when the BB is not connected
to the Internet.
My program open the I2C port with:
fd = Open(“/dev/i2c-2”, O_RDWD);
I then use:
rc = ioctl(fd, I2C_SLAVE, addr); where addr is 0x68 in this case
This all worked fine when I first tried it, but when I rebooted the
BB and tried running my program again I received an EBUSY error from
the ioctl command. Using the i2cdetect –r 2 command I noticed that
port I2C-2 had a UU in the 0x68 position. I later found that this
means that the system kernel has detected the device and taken control
of it.
Is there a way of preventing the system taking control of this port
during boot up so I can access it in UserSpace or should I be doing
this a different way altogether?
You shouldn’t disable it, just make your life easier and use the kernel module that already supports it. Some quick googling turns up for example: http://linux.die.net/man/4/rtc. Actually, the kernel already does what you want for you. From the aforementioned web page: “At boot time the kernel initializes its software clock by reading the RTC.”