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

我的NPI项目之Android USB 系列(一) - 遥望和USB的相识

和USB应该是老朋友了,从2011年接触Android开发开始,就天天和USB打交道了。那时候还有不

对称扁头的usb/方口的usb,直到如今使用广泛的防反插USB3.0 type-C。

但是,一直有一个不是很清楚的问题萦绕在心头,那就是。先有USB协议还是先有USB connector定义?

什么USB1.0,USB2.0,USB3.0 , USB PD, 等等。这些协议和接口又是一个什么样的关系?今天就来简单整理一下。但是重心会放在移动设备上广泛使用的USB2.0/USB OTG/ USB3.0,Type-B和Type-C。

认识USB设备,带USB插槽的Laptop,U盘,USB鼠标/键盘,USB移动硬盘,USB充电宝,USB Type-C。


USB 设备分类
通常USB设备分为主设备和从设备。通常,笔记本会充当主设备,而其它接在笔记本上的设备为从设备,也可以统一称为外设。


通信过程
以U盘为例

Powering on the Laptop: When you power on the laptop, the system boots up, and the operating system (such as Windows, macOS, or Linux) is loaded into the laptop's memory (RAM). The operating system takes control of the laptop's hardware and manages the execution of software applications.

Connecting the USB Interface Disk: You connect the USB interface disk (such as a USB flash drive or an external hard drive) to one of the available USB ports on the laptop. The USB port provides both power and data connectivity for the attached device.

Device Recognition(枚举的过程): The operating system detects the presence of the connected USB interface disk. It identifies the device and loads the appropriate device drivers if necessary. Device drivers are software components that enable the operating system to communicate with and control the connected device.

Mounting the Disk: Once the USB interface disk is recognized, the operating system "mounts" it(挂在文件系统), which means it makes the storage space on the disk accessible to the laptop's file system. The operating system assigns a drive letter or mount point to the disk, allowing you to access its contents.

File System Access: With the USB interface disk mounted, you can interact with its contents through the file manager or file explorer of the operating system. You can browse files, copy, move, delete, or perform other file operations on the disk, similar to how you would interact with files on the laptop's internal storage.

Data Transfer: You can transfer data between the laptop and the USB interface disk by simply dragging and dropping files or using copy-paste operations. The operating system manages the data transfer process, ensuring that the data is written to or read from the appropriate locations on the disk.

Safe Removal: To safely remove the USB interface disk, you should use the operating system's "eject" or "safely remove" feature. This ensures that all pending write operations are completed and the file system is properly unmounted from the disk. Following this procedure helps prevent data corruption or loss.

Disconnecting the Disk: After safely removing the USB interface disk, you can physically disconnect it from the laptop's USB port.
协议上 通信过程

In USB communication, the transfer process is typically initiated by the USB master device.(所有的通信都应该由主设备法起)。 The USB master device, also known as the host, is responsible for controlling the USB bus and managing communication with connected USB devices.

The USB master device takes the initiative to initiate various USB transactions such as data(数据) transfers, control commands(命令), and enumeration(枚举). It sends requests to the connected USB devices, instructing them to perform specific actions or transfer data.

On the other hand, USB slave devices, also called peripherals(通称为外设), respond to the commands and requests from the USB master device. They do not initiate communication actively but instead wait for commands or requests from the master device.

When you connect a USB interface disk (a slave device) to a laptop (the master device), the laptop's operating system, acting as the USB host, recognizes the presence of the USB device and initiates the communication. It sends commands and requests to the USB interface disk to perform actions such as reading or writing data.

The USB master device controls the entire transfer process, including the direction of data flow (from the host to the device or vice versa), the type of transfer (bulk, control, isochronous, or interrupt), and the timing and coordination of the transfer.
总而言之,USB主设备控制一切通信过程!


电气差异,作为主设备时候

  1. 4-Pin USB2.0
  2. 5-Pin USB2.0 OTG
  3. 9-Pin USB 3.0 USB3.0向后兼容USB2.0,另外支持一个SuperSeepd bus。


电气差异,作为从设备时候

               1. 4-Pin USB2.0
               2. 4-Pin USB2.0 OTG
               3. 9-Pin USB3.0

USB3.0 Type A 对应的引脚说明

USB3.0 Type-B的长下面的样子

USB3.0 Type-C,24Pin


发展时间


速度对比


总结

USB的协议发展很快,从USB协议1.0/2.0/3.0/4.0 ...对应的connector也是4pin/5pin/9pin/24pin的演化。

如果9pin的USB3.0 需要支持OTG,那么要将上图中的一路GND_DRAIN设备ID pin. 而我的使用case是设备作为USB3.0 prepherial 和USB2.0 host(支持OTG,并对外供电,5pin)

当我们使用USB3.0时候,不建议带OTG,因为USB2.0已经支持,3.0追求的是更快/更大电流!

万能的WWW,什么知识都有,就看你是否愿意花时间了。Serial port, RS232 and RS485 software. Data logging and monitoring software for COM, RS232, USB and TCP ports, OPC and DDE interfaces

相关文章:

我的NPI项目之Android USB 系列(一) - 遥望和USB的相识

和USB应该是老朋友了,从2011年接触Android开发开始,就天天和USB打交道了。那时候还有不 对称扁头的usb/方口的usb,直到如今使用广泛的防反插USB3.0 type-C。 但是,一直有一个不是很清楚的问题萦绕在心头,那就是。先有…...

K8s进阶之路-命名空间级-服务发现 :

服务发现: Service(东西流量):集群内网络通信、负载均衡(四层负载)内部跨节点,节点与节点之间的通信,以及pod与pod之间的通信,用Service暴露端口即可实现 Ingress&#…...

智慧公厕管理系统:让城市智慧驿站更加智慧舒适

智慧公厕管理系统是城市智慧驿站中不可或缺的一部分,它通过全方位的信息化解决方案,为公共厕所的使用、运营和管理提供了一种智能化的方式。作为城市智慧驿站的重要组成部分,智慧公厕管理系统发挥着重要的作用,为城市社会民生提供…...

图形渲染基础学习

原文链接:游戏开发入门(三)图形渲染_如果一个面只有三个像素进行渲染可以理解为是定点渲染吗?-CSDN博客 游戏开发入门(三)图形渲染笔记: 渲染一般分为离线渲染与实时渲染,游戏中我们用的都是…...

每日学习总结20240219

每日总结 20240219 1.文件类型.csv CSV文件是一种以逗号分隔值(Comma-Separated Values)为标记的文本文件,它可以用来存储表格数据。每一行表示一条记录,而每一条记录中的字段则使用逗号或其他特定的分隔符进行分隔。 常用场景…...

K8s进阶之路-安装部署K8s

参考:(部署过程参考的下面红色字体文档链接就可以,步骤很详细,重点部分在下面做了标注) 安装部署K8S集群文档: 使用kubeadm方式搭建K8S集群 GitBook 本机: master:10.0.0.13 maste…...

springboot集成elk实现日志采集可视化

一、安装ELK 安装ELK组件请参考我这篇博客:windows下安装ELK(踩坑记录)_windows上安装elk教程-CSDN博客 这里不再重复赘述。 二、编写logstash配置 ELK组件均安装好并成功启动,进入到logstash组件下的config文件夹,创建logstash.conf配置…...

leetcode 148. 排序链表 java解法

Problem: 148. 排序链表 思路 这是一个链表排序的问题,由于要求时间复杂度为 O(nlogn),适合使用归并排序(Merge Sort)来解决。 解题方法 首先,使用快慢指针找到链表的中间节点,将链表分成两部分。然后&…...

【MATLAB源码-第140期】基于matlab的深度学习的两用户NOMA-OFDM系统信道估计仿真,对比LS,MMSE,ML。

操作环境: MATLAB 2022a 1、算法描述 深度学习技术在无线通信领域的应用越来越广泛,特别是在非正交多址接入(NOMA)和正交频分复用(OFDM)系统中,深度学习技术被用来提高信道估计的性能和效率。…...

运动重定向学习笔记

目录 深度学习 重定向 2020年的模型: 重定向之后的bvh: 深度学习 重定向 输入是bvh,输出也是bvh...

导出Excel,支持最佳

列表信息导出为Excel文件&#xff0c; 依赖pom&#xff1a; Sheet, Row:<dependency><groupId>org.apache.poi</groupId><artifactId>poi</artifactId> </dependency>XSSFWorkbook <dependency><groupId>org.apache.poi</…...

【WPF】获取父控件数据

MaxHeight"{Binding PathActualHeight, RelativeSource{RelativeSource ModeFindAncestor, AncestorTypeUserControl}}" 参考文献 https://www.cnblogs.com/-Timosthetic/p/16021865.html...

解决Edge浏览器,微博无法查看大图(Edge Image Viewer)

使用Edge浏览器浏览微博或其它带校验的图片时&#xff0c;会导致无法查看。 主要原因为Edge自带了一个Edge Image Viewer, 但是该图片查看器无法查看带校验数据的图片&#xff0c;所以导致查看时一片空白。 解决方法 地址栏输入 edge://flags/搜索 Edge Image Viewer选择 Disa…...

PMP含金量在国内怎么样?

其一、PMP(项目管理师)证书含金量高吗&#xff1f; PMP认证是由美国项目管理学会(PMI)在全球范围内推出的针对项目经理的资格认证体系&#xff0c;其证书含金量可以说是非常高。 统计表明&#xff0c;全球年销售收入在5亿美元以上的企业中有86%聘用了具有项目管理资质的项目经…...

java中容易被忽视的toString()方法

之前一直认为toString就是将数据转换成字符类型&#xff0c;直到最近写出了一个bug才对toString有了新的认识 不同数据类型&#xff0c;toString() 有不同的操作 定义一个student类&#xff0c;包含姓名 String类型、性别 String类型、年龄 int 类型、分数列表 String类型的li…...

如何使用Docker搭建YesPlayMusic网易云音乐播放器并发布至公网访问

文章目录 1. 安装Docker2. 本地安装部署YesPlayMusic3. 安装cpolar内网穿透4. 固定YesPlayMusic公网地址 本篇文章讲解如何使用Docker搭建YesPlayMusic网易云音乐播放器&#xff0c;并且结合cpolar内网穿透实现公网访问音乐播放器。 YesPlayMusic是一款优秀的个人音乐播放器&am…...

java面试题之redis篇

1.redis 中的数据类型有哪些 随着 Redis 版本的更新&#xff0c;后面又支持了四种数据类型&#xff1a; BitMap&#xff08;2.2 版新增&#xff09;、HyperLogLog&#xff08;2.8 版新增&#xff09;、GEO&#xff08;3.2 版新增&#xff09;、Stream&#xff08;5.0 版新增&am…...

effective c++ 笔记 条款18-25

条款18&#xff1a;让接口容易被正确使用&#xff0c;不易误使用 使用外覆类型&#xff08;wrapper&#xff09;提醒调用者传参错误检查&#xff0c;将参数的附加条件限制在类型本身 Data::Data(int month, int day, int year) { ... }三个参数类型相同的函数容易造成误用 Da…...

Nginx学习笔记

Bilibili尚硅谷视频 Nginx 简介 Nginx 概述 Nginx (“engine x”) 是一个高性能的 HTTP 和 反向代理服务器&#xff0c;特点是占有内存少&#xff0c;并发能力强&#xff0c;能经受高负载的考验,有报告表明能支持高达 50,000 个并发连接数 。 正向代理 正向代理&#xff1a;如…...

摆(行列式、杜教筛)

有一个 n n n\times n nn 的矩阵 A A A&#xff0c;满足&#xff1a; A i , j { 1 i j 0 i ̸ j ∧ i ∣ j C otherwise A_{i,j}\begin{cases} 1 &ij\\ 0 &i\notj\land i\mid j\\ C &\text{otherwise} \end{cases} Ai,j​⎩ ⎨ ⎧​10C​ijij∧i∣jotherwi…...

初始中断及实现中断

外部中断基础知识 中断概念&#xff1a;在运行主程序时&#xff0c;外部出现了满足中断触发条件的信号&#xff0c;转而去执行中断处理程序&#xff0c;执行完成后返回主程序stm外部中断框架复用功能与重映射 复用功能概念&#xff1a;引脚本身默认是一个GPIO&#xff0c;但它可…...

CANN调优工具链全景:从profiler到tensorboard的完整观测体系

CANN调优工具链全景&#xff1a;从profiler到tensorboard的完整观测体系 有个团队找我说&#xff0c;他们买了昇腾NPU集群&#xff0c;花了大半年才把调优工具链搭起来。每个人用不同的工具&#xff0c;各看各的数据&#xff0c;互相之间对不上。最后我帮他们梳理了一套统一的工…...

Mythos能力路由引擎:大模型时代的动态门控推理架构

1. 项目概述&#xff1a;一次被刻意“锁住”的能力跃迁如果你最近关注大模型前沿动态&#xff0c;大概率在技术社区、AI从业者群聊或邮件列表里见过“TAI #200”这个编号——它不是某篇论文的DOI&#xff0c;也不是某个开源项目的Release Tag&#xff0c;而是The AI Index Repo…...

UVa 273 Jack Straws

题目分析 本题的题目背景源自一种名为 “Jack Straws\texttt{Jack Straws}Jack Straws” 的游戏&#xff0c;玩家需要从桌上一堆杂乱摆放的塑料或木质 “稻草” 中逐根取出&#xff0c;而不扰动其他稻草。本题不关心游戏过程&#xff0c;只关心一个问题&#xff1a;给定若干根稻…...

大模型零样本学习新突破:USP自适应提示方法原理与实践

1. 项目概述&#xff1a;当大模型“自学成才”成为可能作为一名长期在自然语言处理&#xff08;NLP&#xff09;一线摸爬滚打的从业者&#xff0c;我见过太多关于大语言模型&#xff08;LLMs&#xff09;的“神话”与“现实”之间的落差。其中最让我头疼的一个现实就是&#xf…...

昇腾CANN asc-tools:NPU 运维诊断工具的实战手册

asc-tools 是 CANN 的运维诊断工具包——不在开发阶段用&#xff0c;在部署和运维阶段用。NPU 集群跑了几个月突然性能下降、某张卡频现 ECC 错误、推理延迟从 50ms 涨到 200ms——这些生产环境的问题&#xff0c;asc-tools 帮你定位。 asc-tools 包含哪些工具 asc-tools/ ├─…...

BurpSuite中文乱码根因解析:Java字体渲染与系统编码协同调试

1. 为什么中文设置不是“点一下就完事”——BurpSuite里被低估的本地化陷阱刚接触渗透测试的新手&#xff0c;打开BurpSuite第一反应往往是&#xff1a;界面全是英文&#xff0c;看着费劲。于是搜到“BurpSuite 中文设置”&#xff0c;点开几篇教程&#xff0c;照着复制粘贴几行…...

端侧AI平民化:轻量专家模型+动态调度实现千元机本地大模型推理

1. 项目概述&#xff1a;这不是又一个“AI手机App”&#xff0c;而是一次对算力平民化的重新定义 “Enter Project Gecko: AI in Your Pocket, Without the Premium Price Tag”——这个标题里没有一个生僻词&#xff0c;但每个词都在精准刺向当前AI消费端的痛点。我做终端AI落…...

昇腾CANN asc-devkit:开发者工具包的核心能力和工程化实践

asc-devkit 是 CANN 开发者工具包的入口——它是一个命令行工具&#xff0c;也是一套 IDE 插件&#xff0c;还打包了所有开发所需的脚本和模板。定位类似于 NVIDIA 的 nsys&#xff08;性能分析&#xff09; nvcc&#xff08;编译器封装&#xff09; 项目脚手架工具&#xff0c…...

DownloadButton与Auto Layout完美结合:适配各种屏幕尺寸的下载按钮布局

DownloadButton与Auto Layout完美结合&#xff1a;适配各种屏幕尺寸的下载按钮布局 【免费下载链接】DownloadButton Customizable App Store style download button 项目地址: https://gitcode.com/gh_mirrors/do/DownloadButton DownloadButton是一款高度可定制的App …...