当前位置:网站首页>Transplant DAC chip mcp4725 to nuc980
Transplant DAC chip mcp4725 to nuc980
2022-07-07 01:21:00 【Ti-laser】
This article introduces migration DAC chip MCP4725 Methods .
Because the official linux-4.4.x Although there is one mcp4725.c The driver , But this drive is suitable for none dts Old application scenarios , And my system uses dts The tree needs to replace the driver , The specific method is :
From the website linux/mcp4725.c at master · torvalds/linux · GitHub
download mcp4725.c, The downloaded file can only be compiled and used normally after the following adjustments , As follows :
1 Add header file :#include <linux/of_device.h>
2 find IIO_ENUM_AVAILABLE And delete the second parameter , It takes the form of :
IIO_ENUM_AVAILABLE("powerdown_mode",
&mcp472x_powerdown_mode_enum[MCP4725]),
IIO_ENUM_AVAILABLE("powerdown_mode",
&mcp472x_powerdown_mode_enum[MCP4726]),
3 find device_get_match_data Change to of_device_get_match_data
if (dev_fwnode(&client->dev))
data->id = (uintptr_t)of_device_get_match_data(&client->dev);
else
......
4 Replace include/linux/iio/dac/mcp4725.h For the following :
....
struct mcp4725_platform_data {
bool use_vref;
bool vref_buffered;
};
....
5 Modify file :
drivers/base/property.c +108, allow dev_fwnode Called externally :
struct fwnode_handle *dev_fwnode(struct device *dev)
{
return IS_ENABLED(CONFIG_OF) && dev->of_node ?
&dev->of_node->fwnode : dev->fwnode;
}
EXPORT_SYMBOL_GPL(dev_fwnode);
6 adjustment include/linux/property.h, Declare the output function
struct fwnode_handle *dev_fwnode(struct device *dev);
7 because DAC The chip is attached to I2c1 On the bus , Documents need to be modified nuc980-iot.dtsi, Add blue part :
i2c1: [email protected] {
compatible = "nuvoton,nuc980-i2c1";
.........
#address-cells = <1>;
#size-cells = <0>;
compatible = "microchip,mcp4725";
reg = <0x61>;
};
After the compilation is normal, it will be written into the board and then enter /sys/devices/iio:deviceX You can see the node information , there X Please replace it according to the actual situation of your system .

Can write DA The value is then tested and verified with a multimeter .
echo 2000 > out_voltage0_raw
边栏推荐
- Implementation principle of waitgroup in golang
- MySQL中回表的代价
- Wood extraction in Halcon
- 数据手册中的词汇
- BFS realizes breadth first traversal of adjacency matrix (with examples)
- 树莓派/arm设备上安装火狐Firefox浏览器
- Rainstorm effect in levels - ue5
- Neon Optimization: an optimization case of log10 function
- 机器学习:随机梯度下降(SGD)与梯度下降(GD)的区别与代码实现。
- 接收用户输入,身高BMI体重指数检测小业务入门案例
猜你喜欢

Installation of gazebo & connection with ROS

2022 Google CTF SEGFAULT LABYRINTH wp

How to manage distributed teams?
![[Niuke] [noip2015] jumping stone](/img/9f/b48f3c504e511e79935a481b15045e.png)
[Niuke] [noip2015] jumping stone

Data type of pytorch tensor

MySQL script batch queries all tables containing specified field types in the database

黑马笔记---异常处理

Asset security issues or constraints on the development of the encryption industry, risk control + compliance has become the key to breaking the platform

Body mass index program, entry to write dead applet project

go-zero微服务实战系列(九、极致优化秒杀性能)
随机推荐
Segmenttree
ARM裸板调试之JTAG调试体验
Informatics Olympiad YBT 1171: factors of large integers | 1.6 13: factors of large integers
剑指 Offer II 035. 最小时间差-快速排序加数据转换
Go zero micro service practical series (IX. ultimate optimization of seckill performance)
Gnet: notes on the use of a lightweight and high-performance go network framework
[HFCTF2020]BabyUpload session解析引擎
SuperSocket 1.6 创建一个简易的报文长度在头部的Socket服务器
HMM notes
Force buckle 1037 Effective boomerang
736. Lisp 语法解析 : DFS 模拟题
负载均衡性能参数如何测评?
[Niuke] [noip2015] jumping stone
JTAG debugging experience of arm bare board debugging
Dark horse notes - exception handling
golang中的atomic,以及CAS操作
Tensorflow GPU installation
ClickHouse字段分组聚合、按照任意时间段粒度查询SQL
Do you understand this patch of the interface control devaxpress WinForms skin editor?
7.6模拟赛总结