I want to disable the i2c in raspberry pi, so that I can use it as GPIOs. I commented the lines in the /etc/modprobe.d/raspi-blacklist.conf, but not working.


Check if the modules are loaded with lsmod | grep i2c. If they are, they aren't in use, so you should be able to use rmmod -v or (better) modprobe -rv to unload them.

  • This is what I got when I gave ilsmod | grep i2c 2c_dev 5557 0 i2c_bcm2708 3997 0 regmap_i2c 1645 1 snd_soc_core Does this mean the i2c is enabled or disabled? – Ron4326 Mar 7 '14 at 12:33
  • To understand that output better, try lsmod without grep so you can see the column headers. Anyway, i2c_dev and i2c_bcm2708 have 0 in the "Used by" column, so modprobe -rv i2c_dev and modprobe -rv i2c_bcm2708 should work (modprobe -r -- the -r is crucial -- is like rmmod but more thorough in that it will also remove uneeded dependencies of what's removed). – goldilocks Mar 7 '14 at 12:41
  • This is what I got when i gave modprobe -rv i2c_dev rmmod i2c_dev libkmod: ERROR ../libkmod/libkmod-module.c:753 kmod_module_remove_module: could not remove 'i2c_dev': Operation not permitted – Ron4326 Mar 7 '14 at 12:49
  • Ah. You need to be root or use sudo, I guess. – goldilocks Mar 7 '14 at 14:41
  • I did with sudo, but when I test those pins with an LED ( PIN 5 and 7-I2C pins), LED turns on when I power on Raspberry Pi. When I run a program to turn off the LED, it turned off, but whenever I power on the Pi, it will turn on automatically. If I use another GPIO pin (other than I2C), LED wont glow on power on. – Ron4326 Mar 13 '14 at 5:43

This has done the exact opposite - it has enabled the i2c, which is disabled by default.

PS The i2c pins have on-board pull-up resistors.

  • Oh sorry, I uncommented it for enabling i2c and now I commented it. I now edited my question. Thanks for pointing it out – Ron4326 Mar 7 '14 at 12:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.