当前位置: 首页 > news >正文

创新建设资金网站免费中小企业管理软件

创新建设资金网站,免费中小企业管理软件,微网站和app的区别,谷歌网址一、前言 本文介绍#xff0c;基于USB2.0高速USB转接芯片CH347#xff0c;配合厂商提供的USB转MPHSI#xff08;Multi Protocol High-Speed Serial Interface#xff09;Master总线驱动#xff08;CH34X-MPHSI-Master#xff09;为系统扩展I2C总线的用法#xff0c;除…一、前言  本文介绍基于USB2.0高速USB转接芯片CH347配合厂商提供的USB转MPHSIMulti Protocol High-Speed Serial InterfaceMaster总线驱动CH34X-MPHSI-Master为系统扩展I2C总线的用法除此之外还可以扩展SPI总线和GPIO等资源。 驱动软件正常工作后会在系统下创建新的I2C Master拥有独立的bus num原I2C器件的设备驱动可直接通过DTS配置文件或者sysfs节点挂载到该总线上原有设备驱动无需任何修改。 项目地址GitHub - WCHSoftGroup/ch34x_mphsi_master_linux 二、应用框图 ​​ 三、CH347 I2C接口特点 CH347F 的I2C接口 PIN脚I2C功能脚GPIO复用脚11SCL-12SDA- CH347T 的I2C接口 PIN脚I2C功能脚GPIO复用脚11SCLgpio312SDA- CH347F/T支持至少4种I2C时钟20kHz100kHz400kHz和750kHz。驱动配置的默认I2C时钟为100KHz当前不支持动态修改该时钟频率若需要修改可以在ch34x_mphsi_i2c_init函数中修改。 此外芯片支持时钟延展功能I2C Clock Stretching如果需要开启也可以在ch34x_mphsi_i2c_init 函数中开启。 四、驱动使用与确认SPI总线信息 本文基于树莓派4B平台使用CH347F/T芯片通过树莓派的USB接口扩展I2C总线接口介绍不同的I2C设备的应用实例。 1. 编译驱动 rootraspberrypi:/home/wch/ch34x_mphsi_master_linux_V1.1/driver # make make -C /lib/modules/6.1.21-v8/build M/home/wch/ch34x_mphsi_master_linux_V1.1/driver modules make[1]: 进入目录“/usr/src/linux-headers-6.1.21-v8”CC [M]  /home/wch/ch34x_mphsi_master_linux_V1.1/driver/ch34x_mphsi_master_usb.oCC [M]  /home/wch/ch34x_mphsi_master_linux_V1.1/driver/ch34x_mphsi_master_spi.oCC [M]  /home/wch/ch34x_mphsi_master_linux_V1.1/driver/ch34x_mphsi_master_i2c.oCC [M]  /home/wch/ch34x_mphsi_master_linux_V1.1/driver/ch34x_mphsi_master_gpio.oLD [M]  /home/wch/ch34x_mphsi_master_linux_V1.1/driver/ch34x_mphsi_master.oMODPOST /home/wch/ch34x_mphsi_master_linux_V1.1/driver/Module.symversCC [M]  /home/wch/ch34x_mphsi_master_linux_V1.1/driver/ch34x_mphsi_master.mod.oLD [M]  /home/wch/ch34x_mphsi_master_linux_V1.1/driver/ch34x_mphsi_master.ko make[1]: 离开目录“/usr/src/linux-headers-6.1.21-v8” 2. 加载驱动 rootraspberrypi:/home/wch/ch34x_mphsi_master_linux_V1.1/driver # make load insmod ch34x_mphsi_master.ko 3、确认I2C总线信息 将CH347F/T 设备通过USB连接至树莓派查看系统日志可看到扩展的I2C总线号为I2C bus 22 [  218.193644] ch34x_mphsi_master: loading out-of-tree module taints kernel. [  218.194619] mphsi-ch34x 1-1.2:1.2: ch34x_cfg_probe: output SPI slave with CS0 [  218.194633] mphsi-ch34x 1-1.2:1.2: ch34x_cfg_probe: output SPI slave with CS1 [  218.195050] mphsi-ch34x 1-1.2:1.2: ch34x_spi_probe: SPI master connected to SPI bus 7 [  218.195323] mphsi-ch34x 1-1.2:1.2: ch34x_mphsi_i2c_probe: I2C master connected to I2C bus 22 [  218.195645] mphsi-ch34x 1-1.2:1.2: ch34x_mphsi_gpio_probe: registered GPIOs from 501 to 503 [  218.195663] mphsi-ch34x 1-1.2:1.2: ch34x_usb_probe: USB to SPI/I2C/GPIO adapter ch34x now attached. [  218.195778] usbcore: registered new interface driver mphsi-ch34x 也可使用 i2c-tools 工具查看系统所有I2C总线。 rootraspberrypi:~ # i2cdetect -l i2c-20 i2c             fef04500.i2c                           I2C adapter i2c-1   i2c             bcm2835 (i2c7e804000)                 I2C adapter i2c-21 i2c             fef09500.i2c                           I2C adapter i2c-22 i2c             ch34x-mphsi-i2c at bus 001 device 003   I2C adapter 将SHT3X-DIS模块连接到CH347的I2C接口然后扫描I2C总线下的I2C设备设备(UU)地址为0x44如果未加载对应设备驱动UU位置显示为44 rootraspberrypi:~ # i2cdetect -y -a 220  1  2  3  4  5  6  7  8  9 a b c d e f 00: 00 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- UU -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 五、24C02 EEPROM模块调试 24C02是一个2Kbit的串行EEPROM存储芯片可存储256个字节数据。 rootraspberrypi:~ # i2cdetect -y -a 220 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: 50 51 52 53 54 55 56 57 -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 读写EEPROM rootraspberrypi:~ # i2cset -y 22 0x50 0 0x11 rootraspberrypi:~ # i2cset -y 22 0x50 1 0x11 rootraspberrypi:~ # i2cset -y 22 0x50 2 0x22 rootraspberrypi:~ # rootraspberrypi:~ # i2cget -y 22 0x50 0 0x11 rootraspberrypi:~ # i2cget -y 22 0x50 1 0x11 rootraspberrypi:~ # i2cget -y 22 0x50 2 0x22 rootraspberrypi:~ # rootraspberrypi:~ # i2ctransfer 22 w80x50 0x00 0xff- WARNING! This program can confuse your I2C bus, cause data loss and worse! I will send the following messages to device file /dev/i2c-22: msg 0: addr 0x50, write, len 8, buf 0x00 0xff 0xfe 0xfd 0xfc 0xfb 0xfa 0xf9 Continue? [y/N] y rootraspberrypi:~ # rootraspberrypi:~ # i2ctransfer 22 w10x50 0x00 r7 WARNING! This program can confuse your I2C bus, cause data loss and worse! I will send the following messages to device file /dev/i2c-22: msg 0: addr 0x50, write, len 1, buf 0x00 msg 1: addr 0x50, read, len 7 Continue? [y/N] y 0xff 0xfe 0xfd 0xfc 0xfb 0xfa 0xf9 rootraspberrypi:~ # 六、SHT3X-DIS温湿度传感器模块调试 SHT3x-DIS是Sensirion新一代的温湿度传感器芯片精度为±2%RH和±0.3℃输入电压范围从2.4V到5.5V采用IIC总线接口速率可达1MHz。测量温湿度范围分别为是-40℃ ~ 125℃和0 ~ 100%。 加载sht3x驱动 rootraspberrypi:~ # insmod sht3x.ko 将 i2c_client 设备名挂载到 I2C 总线 rootraspberrypi:~ # echo sht3x 0x44 /sys/bus/i2c/devices/i2c-22/new_device [ 1594.345331] i2c i2c-22: new_device: Instantiated device sht3x at 0x44 运行测试程序获取当前温度和湿度信息 rootraspberrypi:~ # ./sht3x_test_app temperature: 27.14 humidity: 62.28 七、MPU6050功能测试 MPU6050 是 InvenSense 公司推出的整合性 6 轴运动处理组件其内部整合了 3 轴陀螺仪和 3 轴加速度传感器并且含有一个IIC 接口 可用于连接外部磁力传感器并利用自带的数字运动处理器DMP: Digital Motion Processor 硬件加速引擎通过主 I2C接口向应用端输出完整的 9 轴融合演算数据。 参考资料MPU-6050 | TDK InvenSense 加载 mpu6050 驱动 rootraspberrypi:~ # insmod mpu6050.ko 将 i2c_client 设备名挂载到 I2C 总线 rootraspberrypi:~ # echo mpu6050 0x68 /sys/bus/i2c/devices/i2c-22/new_device [  188.063732] i2c i2c-22: new_device: Instantiated device i2c_mpu6050 at 0x68 运行测试程序可获取当前位置信息原始数据 rootraspberrypi:/home/wch/mpu6050_test # ./test_app AX1112, AY-574, AZ16212 GX-252, GY-16, GZ-38 AX1054, AY-578, AZ16220 GX-259, GY-17, GZ-41 AX1066, AY-584, AZ16260 GX-163, GY-26, GZ-41
http://www.hkea.cn/news/14261639/

相关文章:

  • 西安做兼职网站杭州做网站好的公司排名
  • 做哪类网站赚钱沈阳哪个医院人流好一点
  • 互联网网站开发发展黑龙江省住房和城乡建设信息网
  • 如何访问win7下做的网站做 网站 技术支持 抓获 互助
  • 网站程序怎么备份网站app免费制作软件
  • 沈阳成创网站建设公司网站建设期的网站案例
  • 网站建设方案数营销外包公司
  • 建设银行网站怎么登陆密码错误做公司网站的模板下载
  • 海南网站建设方案哪里可以学做资料员的网站
  • 一个服务器怎么做两个网站网络系统管理属于哪类专业
  • 网站建设入门教程dw做的网站如何使用
  • 建设工程质量检测机构主管网站一个网站用几个域名
  • 公司营销网站制作汕头制作网站软件
  • 铜梁旅游网站建设管理钢丝网片
  • 网站恶意点击做恐怖网站
  • 中文建网站网页实时翻译器
  • 梵讯企业网站建设网页设计教程网站
  • 公司网站建设需要注意的地方百度入驻绍兴
  • 网站策划的工作职责seo前线
  • 如何做镜像别人网站如何做网站认证
  • 江西旅游 网站建设qq炫舞做浴缸的网站
  • 建设工程竣工验收消防备案网站什么是网络营销产生的的技术原因
  • 网站建设要程序员吗wordpress显示
  • 动漫网站设计模板跨境电商服务平台有哪些
  • 做电影网站技术大型网站的空间
  • 网站顺序vs连接数据库做网站
  • 网站建设中英文版做响应式网站设计师需要做什么
  • 高明铝业网站建站wordpress hsts
  • seo网站营销怎么自己做三个一网站
  • 圣诞树html网页代码南京网站seo专家