当前位置:网站首页>Rk3399 development board i2c4 attaching EEPROM instance
Rk3399 development board i2c4 attaching EEPROM instance
2022-07-25 08:01:00 【Feiling embedded】
Feiling embedded OK3399-C The development board is reserved I2C4 Pin interface , be located P32 Pin on pin , Namely I2C4_SCL and I2C4_SDA. Through this article, the editor will list and explain how to use I2C4 mount at24c08(EEPROM) chip .

Modify the result
1、 modify kernel/arch/arm64/boot/dts/rockchip/OK3399.dts, Add and modify as follows :

2、 Enucleation at24c08 Pull up resistance on the module , Use of flying wire 1.8V Power the module , Access I2C4_SCL and I2C4_SDA.
Change your mind
We're going to add a I2C The idea of the equipment is : Add a description to the device tree -> Add the corresponding device driver in the device tree description -> Add device drivers to the kernel .
According to the idea , First, in the device tree I2C4 Add under node at24c08 Device information for . stay kernel/arch/arm64/boot/dts/rockchip/OK3399-C.dts file , find I2C4 The nodes are as follows :

At present, it is disabled The state of , And there is no device information . Add device information as follows :

Pictured above , Tell the kernel through the device tree ,I2C4 Start using , And a EEPROM equipment , Name is [email protected], The driver used is compatible=“”;
Now we lack this driver , General I2C The driver file used by the device corresponds to I2C The manufacturer will provide , If the manufacturer says there is no need to drive , It doesn't really mean “ Unwanted ” drive , Instead, their devices can use universal drivers .
This is the equipment in this article , After communicating with the manufacturer, he said that there was no driver file . Then search directly under the kernel directory eeprom、at24 Such words , Find out if there is a corresponding general driver file .

It can be seen that kernel/drivers/misc/eeprom/at24.c file .
See how the content matches the use of this driver , Normally, the driver file should be reserved .compatible= *** Call the interface of the driver as a device tree , As long as it is in the device tree description compatible And In the driver file .compatible As described in , It will match successfully .
But this at24.c Not in China .compatible, only one at24_ids Among them ”24c08”:

Compare at25.c The document has .compatible No, ids.

ids And .compatible equally , The device tree is used to identify matching , Among the three recognition matching conditions, those who are interested can go deep . Because it has nothing to do with this article , I won't repeat . So I found the corresponding driver file , Return to the device tree and add a description .

Now this tells the kernel that I want to use I2C4, my I2C4 There's a next one. EEPROM equipment , It uses “24c08” drive , But not yet ”24c08” This file is sent to the kernel , Then the next goal is to program the driver into the kernel .
stay kernel Run in directory makemenuconfig, Search for at24, as follows :

Press the number 1, Automatically jump to the corresponding option , Press down y Choose , Save and exit .

because makemenuconfig The change is .config file , The compiled script will be regenerated every time .config file , So in order for the modification to take effect , Modify the compilation script , Make it not regenerate .config file , as follows :

Will generate .config Comment out the command of the file , Compiling the kernel , This will be ”24c08” To the kernel , Also tell the kernel through the device tree ,I2C4 There's a next one. EEPROM The equipment should use “24c08”.
Here we are , Our routine idea of adding devices has been completed : Add a description to the device tree -> The device tree describes the corresponding device driver -> Add device drivers to the kernel .
The next step is to compile the kernel , burning boot Mirror to the development board , Use i2ctool Command to view , I won't repeat it here i2ctool How to use the command . Use command :i2cdetect-l 、i2cdetect-y 4.

The corresponding address has been registered by the driver , But not generated devices Under the I2C4 equipment , It indicates that the module may not work properly , View module related information .



The module comes with I2C4 Pull up resistance , because OK3399-C The bottom plate also has a pull-up resistor, as shown in the figure below , And is 1.8V Pull up , For level matching , Without modifying the bottom plate , Use 1.8V Benchmarking , Remove the pull-up resistor attached to the module , Use 1.8V To configure .

Modify the device tree again , Add the clock description and device address description .

After compiling , Burning the kernel , After burning, start the development board .

Identify to I2C4 Under the equipment , Then conduct a read-write test , Following commands :
echo"hello my world" > /sys/bus/i2c/devices/1-0050/eeprom
cat/sys/bus/i2c/devices/4-0050/eeprom

So far a new I2C EEPROM Device added successfully , Yes I2C The device can also be read and written through the i2ctool Related command operation .
边栏推荐
- UNIPRO multi terminal deployment to meet customers' diversified needs
- My creation anniversary
- Learn when playing No 1 | can live classroom still be like this? Come and unlock "new posture"!
- While (~scanf ("%d", & n)) is equivalent to while (scanf ("%d", & n)! =eof)
- Big guy Qiu zhaomianjing
- Acnet: asymmetric convolution for image hypersegmentation (with implementation code)
- uiautomator2 常用命令
- [unity introduction program] basic concepts GameObject & components
- Use of toolbar
- Codeforces Round #809 Editorial(A,B,C)
猜你喜欢

In depth analysis of yolov7 network architecture

How should enterprise users choose aiops or APM?

Leetcode (Sword finger offer) - 04. search in two-dimensional array

oracle 触发器创建
![[paper notes] progressive layered extraction (PLE): a novel multi task learning (MTL) model for personalized](/img/a8/c5d14ec5f4a22f7925c6d7454b5a58.png)
[paper notes] progressive layered extraction (PLE): a novel multi task learning (MTL) model for personalized

app耗电量测试

The 17th revitalization cup computer programmer (cloud computing platform operation and development) finals

滴滴 - dispatching

交叉熵计算公式

Practical operation: elegant downtime under large-scale micro service architecture
随机推荐
查看电脑重启次数、原因
Mysql-5.7 installation
Open source, innovators win, 2022 "science and innovation China" open source innovation list selection is fully open!
[unity entry plan] interface Introduction (1) -scene view
P1047 [noip2005 popularization group t2] tree outside the school gate
Implement hot post | community project with timed tasks and cache
New version 8.6 SEO quick release system (can be built at source level)
7.24模拟赛总结
[QNX Hypervisor 2.2用户手册]9.3 cpu
Enq: HW - fault analysis caused by content waiting
While (~scanf ("%d", & n)) is equivalent to while (scanf ("%d", & n)! =eof)
Vs2019 C MFC installation
Technical Analysis | Doris connector combined with Flink CDC to achieve accurate access to MySQL database and table exactly once
Calculation formula of cross entropy
Surpassing transformer, Tsinghua, byte significantly refresh parallel text generation SOTA performance | ICML 2022
P1086 [NOIP2004 普及组第二题] 花生采摘
Science: listening to music can really relieve pain. Chinese scientists reveal the neural mechanism behind it
Today in history: Intel was founded; The first photo was posted on the world wide web; EBay spins off PayPal
In depth analysis of yolov7 network architecture
IoT物联网嵌入式设备中30种常见传感器模块简介及原理讲解