电子发烧友App

硬声App

0
  • 聊天消息
  • 系统消息
  • 评论与回复
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看威廉希尔官方网站 视频
  • 写文章/发帖/加入社区
会员中心
创作中心

完善资料让更多小伙伴认识你,还能领取20积分哦,立即完善>

3天内不再提示
创作
电子发烧友网>电子资料下载>类型>参考设计>AD5398稳压器电流宿DAC Linux驱动程序

AD5398稳压器电流宿DAC Linux驱动程序

2021-05-23 | pdf | 56.92KB | 次下载 | 3积分

资料介绍

This version (11 Feb 2016 21:16) was approved by Lars-Peter Clausen.The Previously approved version (05 Sep 2012 14:17) is available.Diff

AD5398 Regulator Current Sink DAC Linux Driver

Supported Devices

Evaluation Boards

Description

AD5398 and AD5821 is a single 10-bit DAC with 120mA output current sink capability. I2C bus is connected to enable/disable output and set the proper output current value. This driver adapts to voltage and current regulator framework in Linux kernel.

Source Code

Status

Source Mainlined?
git Yes

Files

Function File
driver drivers/regulator/ad5398.c

Adding Linux driver support

Configure kernel with “make menuconfig” (alternatively use “make xconfig” or “make qconfig”)

The AD5398/AD5821 Driver depends on CONFIG_I2C

Select voltage and current regulator framework support and enable AD5398/AD5821 driver. Don't forget to select virtual regulator consumer and userspace regulator consumer as module. Because AD5398 driver is loaded after I2C bus finish initialization at kernel booting, built-in consumers may be loaded earlier and find supply in AD5398 driver is not available.

Linux Kernel Configuration
	Device Drivers  --->
		[*] Voltage and Current Regulator Support  --->
		   Virtual regulator consumer support
		   Userspace regulator consumer support
		<*>   Analog Devices AD5398/AD5821 regulators

Customize Device Parameters

The platform info defined in bf537-stamp board file is for ad5398 and ad5821 only. If you want to customize this driver for other compatible current regulator DAC, you should revise the platform information accordingly.

  • Define device supply name exported by the driver.

  • Define supply value range.

  • Define supply name in platform_data for the virtual consumer to match and use.

  • Define supply name for the user space consumer to match and use.

Driver Testing

Check regulator driver initialization information at kernel booting.

This specifies any shell prompt running on the target

regulator: core version 0.5
i2c /dev entries driver
regulator: isink: 0 <--> 120 mA
ad5398 0-000c: ad5398 regulator driver loaded
i2c-bfin-twi i2c-bfin-twi.0: Blackfin BF5xx on-chip I2C TWI Contoller, regs_base@ffc01400

Check if AD5398 is probed properly.

This specifies any shell prompt running on the target

root:/> ls -l sys/class/regulator/regulator.0/
lrwxrwxrwx    1 root     root            0 Jan  1 19:47 device -> ../../../0-000c
-r--r--r--    1 root     root         4096 Jan  1 19:47 max_microamps
-r--r--r--    1 root     root         4096 Jan  1 19:47 microamps
-r--r--r--    1 root     root         4096 Jan  1 19:47 min_microamps
-r--r--r--    1 root     root         4096 Jan  1 19:47 name
-r--r--r--    1 root     root         4096 Jan  1 19:47 num_users
drwxr-xr-x    2 root     root            0 Jan  1 19:47 power
-r--r--r--    1 root     root         4096 Jan  1 19:47 requested_microamps
-r--r--r--    1 root     root         4096 Jan  1 19:47 state
lrwxrwxrwx    1 root     root            0 Jan  1 19:47 subsystem -> ../../../../../../../class/regulator
-r--r--r--    1 root     root         4096 Jan  1 19:47 suspend_disk_state
-r--r--r--    1 root     root         4096 Jan  1 19:47 suspend_mem_state
-r--r--r--    1 root     root         4096 Jan  1 19:47 suspend_standby_state
-r--r--r--    1 root     root         4096 Jan  1 19:47 type
-rw-r--r--    1 root     root         4096 Jan  1 19:47 uevent
root:/> cat sys/class/regulator/regulator.0/max_microamps
120000
root:/> cat sys/class/regulator/regulator.0/min_microamps
0
root:/> cat sys/class/regulator/regulator.0/name
current range
root:/> cat sys/class/regulator/regulator.0/type
current
root:/> cat sys/class/regulator/regulator.0/state
disabled

Insert virtual consumer driver module and check usability.

This specifies any shell prompt running on the target

root:/> modprobe virtual
root:/> ls -l sys/devices/platform/reg-virt-consumer.0/
lrwxrwxrwx    1 root     root            0 Jan  1 21:23 driver -> ../../../bus/platform/drivers/reg-virt-consumer
-rw-rw-rw-    1 root     root         4096 Jan  1 21:23 max_microamps
-rw-rw-rw-    1 root     root         4096 Jan  1 21:23 max_microvolts
-r--r--r--    1 root     root         4096 Jan  1 21:23 microamps_requested_current
-rw-rw-rw-    1 root     root         4096 Jan  1 21:23 min_microamps
-rw-rw-rw-    1 root     root         4096 Jan  1 21:23 min_microvolts
-r--r--r--    1 root     root         4096 Jan  1 21:23 modalias
-rw-rw-rw-    1 root     root         4096 Jan  1 21:23 mode
drwxr-xr-x    2 root     root            0 Jan  1 21:23 power
lrwxrwxrwx    1 root     root            0 Jan  1 21:23 subsystem -> ../../../bus/platform
-rw-r--r--    1 root     root         4096 Jan  1 21:23 uevent
root:/> cat sys/devices/platform/reg-virt-consumer.0/max_microamps
120000
root:/> cat sys/devices/platform/reg-virt-consumer.0/min_microamps
0
root:/> echo 50000 > sys/devices/platform/reg-virt-consumer.0/min_microamps
root:/> cat sys/devices/platform/reg-virt-consumer.0/min_microamps
50000
root:/> cat sys/devices/platform/reg-virt-consumer.0/max_microamps
120000

Insert user space consumer driver module and check usability.

This specifies any shell prompt running on the target

root:/> modprobe userspace-consumer
root:/> ls -l sys/devices/platform/reg-userspace-consumer.0/
lrwxrwxrwx    1 root     root            0 Jan  1 21:26 driver -> ../../../bus/platform/drivers/reg-userspace-consumer
-r--r--r--    1 root     root         4096 Jan  1 21:26 microamps_requested_current
-r--r--r--    1 root     root         4096 Jan  1 21:26 modalias
-r--r--r--    1 root     root         4096 Jan  1 21:26 name
drwxr-xr-x    2 root     root            0 Jan  1 21:26 power
-rw-r--r--    1 root     root         4096 Jan  1 21:26 state
lrwxrwxrwx    1 root     root            0 Jan  1 21:26 subsystem -> ../../../bus/platform
-rw-r--r--    1 root     root         4096 Jan  1 21:26 uevent
root:/> cat sys/devices/platform/reg-userspace-consumer.0/name
ad5398
root:/> cat sys/devices/platform/reg-userspace-consumer.0/state
disabled
root:/> echo enabled > sys/devices/platform/reg-userspace-consumer.0/state
root:/> cat sys/devices/platform/reg-userspace-consumer.0/state
enabled

To control ADC to output a given current, you only need to set the value to sysfs entry min_microamps in virtual consumer platform device. The driver adjusts the output according to the min current value received.

下载该资料的人也在下载 下载该资料的人还在阅读
更多 >

评论

查看更多

下载排行

本周

  1. 1电子电路原理第七版PDF电子教材免费下载
  2. 0.00 MB  |  1491次下载  |  免费
  3. 2单片机典型实例介绍
  4. 18.19 MB  |  95次下载  |  1 积分
  5. 3S7-200PLC编程实例详细资料
  6. 1.17 MB  |  27次下载  |  1 积分
  7. 4笔记本电脑主板的元件识别和讲解说明
  8. 4.28 MB  |  18次下载  |  4 积分
  9. 5开关电源原理及各功能电路详解
  10. 0.38 MB  |  11次下载  |  免费
  11. 6100W短波放大电路图
  12. 0.05 MB  |  4次下载  |  3 积分
  13. 7基于单片机和 SG3525的程控开关电源设计
  14. 0.23 MB  |  4次下载  |  免费
  15. 8基于AT89C2051/4051单片机编程器的实验
  16. 0.11 MB  |  4次下载  |  免费

本月

  1. 1OrCAD10.5下载OrCAD10.5中文版软件
  2. 0.00 MB  |  234313次下载  |  免费
  3. 2PADS 9.0 2009最新版 -下载
  4. 0.00 MB  |  66304次下载  |  免费
  5. 3protel99下载protel99软件下载(中文版)
  6. 0.00 MB  |  51209次下载  |  免费
  7. 4LabView 8.0 专业版下载 (3CD完整版)
  8. 0.00 MB  |  51043次下载  |  免费
  9. 5555集成电路应用800例(新编版)
  10. 0.00 MB  |  33562次下载  |  免费
  11. 6接口电路图大全
  12. 未知  |  30320次下载  |  免费
  13. 7Multisim 10下载Multisim 10 中文版
  14. 0.00 MB  |  28588次下载  |  免费
  15. 8开关电源设计实例指南
  16. 未知  |  21539次下载  |  免费

总榜

  1. 1matlab软件下载入口
  2. 未知  |  935053次下载  |  免费
  3. 2protel99se软件下载(可英文版转中文版)
  4. 78.1 MB  |  537793次下载  |  免费
  5. 3MATLAB 7.1 下载 (含软件介绍)
  6. 未知  |  420026次下载  |  免费
  7. 4OrCAD10.5下载OrCAD10.5中文版软件
  8. 0.00 MB  |  234313次下载  |  免费
  9. 5Altium DXP2002下载入口
  10. 未知  |  233046次下载  |  免费
  11. 6电路仿真软件multisim 10.0免费下载
  12. 340992  |  191183次下载  |  免费
  13. 7十天学会AVR单片机与C语言视频教程 下载
  14. 158M  |  183277次下载  |  免费
  15. 8proe5.0野火版下载(中文版免费下载)
  16. 未知  |  138039次下载  |  免费