Raspberry Pi 3B I2C 问题

刚刚接触树莓派,的确很适合用来学习,资料多而且很规范,开发者多,平台统一,很多问题别人都已经解决。

买的是带3.5电阻屏的版本, 使用i2c接传感器,但是总是报错:

1. 执行 sudo raspi-config 开启i2c的时候:

There was an erro running option A6 I2C

2.终端中:

FATAL: Module i2c-dev not found.

3.lsmod命令显示:

只有i2c_bcm2708

没有i2c-dev

----

最终的问题是这块带3.5屏的内核中没有将相关i2c模块加进去,通过跟新内核,就可以解决问题,跟新了1个小时。没有尝试直接将相关模块添加进去行不行。不过更新过之后确实i2c可以使用,但3.5寸白屏了。

最终解决问题用到的网页:https://www.raspberrypi.org/forums/viewtopic.php?t=157458&p=1025165

Run sudo rpi-update to get the 4.4.17 kernel and replace your missing modules.

You'll need to reinstall your screen drivers.

http://www.kedei.net/raspberry/raspberry.html

--------

一些比较好的网站:

http://www.cnblogs.com/hangxin1940/archive/2013/04/03/2997094.html  树莓派搭建python i2c开发环境

http://www.landzo.cn/thread-12826-1-1.html

http://www.cnblogs.com/hangxin1940/archive/2013/04/02/2997077.html 树莓派启用i2c设备

http://www.raspberrypi-spy.co.uk/2014/11/enabling-the-i2c-interface-on-the-raspberry-pi/

http://blog.csdn.net/xukai871105/article/details/18234075

http://blog.csdn.net/ki1381/article/details/52425565

http://blog.csdn.net/xdw1985829/article/details/39580401  树莓派GPIO控制

---------

网上的一些说法:

1.首先是raspi-config配置

2./boot/config.txt 文件中开启

dtparam=i2c_arm=on

(enable the hardware interface)

3. /etc/modprobe.d/raspi-blacklist.conf配置文件里注释掉:

bladklist i2c-bcm2708

4./etc/modules-load.d/modules.comf

在此配置文件中添加:

i2c-dev

这样在开机的时候,内核引导启动的时候就会加载这个驱动模块:( kernel modules to load at boot time)

5.或者临时添加:

sudo modprobe i2c-dev

一些相关的网页:

https://www.zhihu.com/question/29328394

http://blog.csdn.net/xukai871105/article/details/15029843

http://blog.csdn.net/fly_qj/article/details/44204661

Hello to all,
I'm new here and I use a RPI for several applications.
Most of them are sensors which are connected to the i2c-port.
Now I have one problem using a LCD-display.
I do not know what drivers I need for this.
The supplier provides a image (=Linux rpizero 4.4.11 #2 Tue May 24 22:50:33 CST 2016 armv6l GNU/Linux) which works very good for the LCD display :) . But...
I can not use the i2c port. 
If I run 
raspi-config 
I get the following message: 
There was an error running option A6 I2
and 
modprobe: FATAL: Module i2c-dev not found.
I think I need to add the i2c modules to the image. 
I have 2 questions:

      what i2c module do I need?
      where can i get this?
      how to add this modules ti the image?


You see I'm not an expert in making kernel.
Please can anybody give me a hint how to solve this problem?
Thanks a lot in advance!
Kurt

原文地址:https://www.cnblogs.com/sunniflyer/p/6036103.html