why does the i2cdetect always gives UU on my RTC in embedded Linux
I am assuming that you are using DS-1307 RTC, or one of its variants (because of 0x68 slave address). Check if its driver is loaded by:
$ lsmod | grep rtc
If you seen an entry of rtc_ds1307, (like this -> rtc_ds1307 17394 0
) in the output of above command then this driver might be in hold of that address.
If the driver is loaded in system then unload it using
$ rmmod rtc-ds1307
EDIT:
(In light of OP's feedback,) Please do the following
1) cat /sys/bus/i2c/devices/3-0068/modalias
. This will give you the name of the kernel driver that is keeping this device busy. Copy the driver-name after the colon(:)
OP's output of the command tells us that its ds1337
2) Check if ds1337 is an alias for a driver, using
grep ds1337 /lib/modules/`uname -r`/modules.alias
Hopefully you will get the following output
alias i2c:ds1337 rtc_ds1307
This confirms our presumption that rtc_ds1307 is infact the driver in hold of the I2C address 0x68.
3) use rmmod rtc_ds1307
to unload the driver.
Note: This will only work if the driver is a Loadable Kernel Module, otherwise you will see the following error:
ERROR: Module rtc_ds1307 does not exist in /proc/modules
In that case you will have to recompile the kernel again with that driver disabled/modularized.
henryyao
Updated on July 18, 2022Comments
-
henryyao almost 2 years
I'd like to communicate read from my RTC in C code rather than the
"hwclock"
shell command.However, when I use
i2cdetect
, it shows0x68
(which is my RTC slave address) is having the status"UU"
, which means "Probing was skipped, because this address is currently in use by a driver". And after I tried thei2cget
, its givng "could bot set address to0x68
: Device or resource busy".So I'm thinking if there are some problem in my Linux kernel that will force to read from my RTC all the time, or some other reason.
Thanks
-
microMolvi almost 11 yearshmm.. can u give us the output of
ls /sys/bus/i2c/devices
-
henryyao almost 11 yearsThe ls command gives 3-0068(3 is the bus number), and some other devices. And btw, I can read from the RTC using ioctl() function from my C code. Which is weird since i2ctools cannot read.
-
henryyao almost 11 yearsThe cat command gives me i2c:ds1337 and then I run command 'rmmod ds1337' or 'rmmod -f ds1337', but it gives out: cannot unload 'ds1337', unknown symbol in module, or unknown parameter.
-
microMolvi almost 11 yearsokay.. ds1337 might be an alias for a module. Try
grep ds1337 /lib/modules/`uname -r`/modules.alias
-
microMolvi almost 11 years