CN103810127B - USB low-speed devices data transfer control method and controller - Google Patents
USB low-speed devices data transfer control method and controller Download PDFInfo
- Publication number
- CN103810127B CN103810127B CN201210453547.8A CN201210453547A CN103810127B CN 103810127 B CN103810127 B CN 103810127B CN 201210453547 A CN201210453547 A CN 201210453547A CN 103810127 B CN103810127 B CN 103810127B
- Authority
- CN
- China
- Prior art keywords
- packet
- data
- token
- controller
- usb
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims abstract description 45
- 238000012546 transfer Methods 0.000 title claims description 19
- 230000005540 biological transmission Effects 0.000 claims abstract description 131
- 238000001514 detection method Methods 0.000 claims abstract description 11
- 238000012545 processing Methods 0.000 claims description 31
- 230000004044 response Effects 0.000 claims description 15
- 238000012937 correction Methods 0.000 claims description 5
- 235000013399 edible fruits Nutrition 0.000 claims 2
- 230000002093 peripheral effect Effects 0.000 abstract description 20
- 238000004891 communication Methods 0.000 abstract description 6
- 230000006870 function Effects 0.000 description 20
- 238000010586 diagram Methods 0.000 description 16
- 238000013461 design Methods 0.000 description 7
- 125000004122 cyclic group Chemical group 0.000 description 4
- 238000012795 verification Methods 0.000 description 3
- 239000000872 buffer Substances 0.000 description 2
- 238000004590 computer program Methods 0.000 description 2
- 239000000284 extract Substances 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 238000000429 assembly Methods 0.000 description 1
- 230000003542 behavioural effect Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/42—Bus transfer protocol, e.g. handshake; Synchronisation
- G06F13/4282—Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
- G06F13/4295—Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus using an embedded synchronisation
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Transfer Systems (AREA)
Abstract
本发明公开了一种USB低速设备数据传输控制方法及控制器。该方法包括:在传输开始时,检测USB低速设备的D+信号线和D‑信号线,如果D+信号线和D‑信号线均处于空闲状态,则拉高D+信号线;在主机侧将D+信号线拉低后,直接进入复位状态,并拉高D+信号线;在主机侧复位完成后,控制数据传输通道EP并与主机侧进行数据传输,在传输结束后,将D+信号线和D‑信号线均设置为空闲状态。借助于本发明的技术方案,使原兼容USB低速的USB装置仅支持USB低速的外设功能,控制器的面积减少了50%,并按照USB的协议要求正确实现了物理层之间的接口通信传输及传输中通道的检测握手。
The invention discloses a USB low-speed device data transmission control method and a controller. The method includes: at the beginning of transmission, detecting the D+ signal line and the D-signal line of the USB low-speed device, and if the D+ signal line and the D-signal line are in an idle state, then pulling the D+ signal line high; After the line is pulled low, it directly enters the reset state and pulls up the D+ signal line; after the reset on the host side is completed, it controls the data transmission channel EP and performs data transmission with the host side. All lines are set to idle state. With the help of the technical solution of the present invention, the original USB low-speed compatible USB device only supports the USB low-speed peripheral function, the area of the controller is reduced by 50%, and the interface communication between the physical layers is correctly realized according to the USB protocol requirements Detection handshaking of transmissions and in-transit channels.
Description
技术领域technical field
本发明涉及移动通讯领域,特别是涉及一种通用串行总线(IntelUniversalSerial Bus,简称为USB)低速设备数据传输控制方法及控制器。The present invention relates to the field of mobile communication, in particular to a universal serial bus (Intel Universal Serial Bus, referred to as USB) low-speed device data transmission control method and controller.
背景技术Background technique
USB是家喻户晓的数据传输接口,自1994年11月诞生第一个草案至今,USB接口以其即插即用(Plug&Play)、接口电路简单、成本低、以及传输速度快的特点,已成为几乎所有需要进行数据传输的电子设备的标准配备;应用领域包括个人计算机、消费及移动类产品的快速同步即时传输;USB接口发展到今天应用最广的是USB2.0和USB3.0两个版本,USB3.0向下兼容USB2.0,二者的性能对比如表1所示:USB is a well-known data transmission interface. Since the first draft was born in November 1994, the USB interface has become the The standard configuration of electronic equipment that requires data transmission; the application field includes fast synchronous and instant transmission of personal computers, consumer and mobile products; USB2.0 and USB3.0 are the most widely used versions of the USB interface today. .0 is backward compatible with USB2.0, and the performance comparison between the two is shown in Table 1:
表1Table 1
在现有技术中,USB的设备类型(device class)都会表现出一些USB的基本特征,但USB设备还是可以分成一些共同的类型,同类型的设备可以拥有一些共同的行为特征和工作协议,表2为一些基本的USB的设备类型分类。In the prior art, USB device classes (device classes) all exhibit some basic characteristics of USB, but USB devices can still be divided into some common types, and devices of the same type can have some common behavioral characteristics and working protocols, which are represented by 2 Classify some basic USB device types.
表2Table 2
从表2中可以看出,USB人机接口设备(Human Interface Device,简称为HID)类是一个比较大的类,HID类主要用于计算机操作的一些方面,例如:USB鼠标、USB键盘、USB游戏操作杆、USB触摸板、USB轨迹球、电话拨号设备、模拟式磁带录放机(Video CassetteRecorder,简称为VCR)遥控等设备;HID的交换数据存储存在称为报表(report)的结构内。主机在控制传输和中断传输中发送及请求报表,从而发送和接收数据,报表的格式非常有弹性,可以处理任何类型的数据;设备可以在未预期的时间发送信息给主机,例如:键盘的按键或是鼠标的移动,所以主机会定时轮询设备,来取得最新的数据;对于HID设备来说,其传输速度为1.5Mbps,属于低速外设;在大部分的USB2.0装置中,低速外设都是作为可兼容的装置存在,但是对于HID设备来说,只需要低速的设备装置即可,因此在USB2.0的基础上提取USB的低速外设部分,去除USB高速、全速、以及功能受限主机(OTG)的功能,使得USB的低速外设装置面积更小,效率更高;设计一种低速(LS)的传输外设装置是一种理想的方案。It can be seen from Table 2 that the USB Human Interface Device (Human Interface Device, HID for short) class is a relatively large class, and the HID class is mainly used in some aspects of computer operation, such as: USB mouse, USB keyboard, USB Game joystick, USB touchpad, USB trackball, telephone dialing equipment, analog tape recorder (Video Cassette Recorder, referred to as VCR) remote control and other equipment; HID exchange data storage exists in a structure called report. The host sends and requests reports in control transfers and interrupt transfers, thereby sending and receiving data. The report format is very flexible and can handle any type of data; the device can send information to the host at unexpected times, such as: keyboard keys Or the movement of the mouse, so the host will regularly poll the device to obtain the latest data; for HID devices, the transmission speed is 1.5Mbps, which belongs to low-speed peripherals; in most USB2.0 devices, low-speed peripherals Devices exist as compatible devices, but for HID devices, only low-speed device devices are required, so the low-speed peripheral parts of USB are extracted on the basis of USB2.0, and USB high-speed, full-speed, and functions are removed. The limited host (OTG) function makes the USB low-speed peripheral device smaller and more efficient; designing a low-speed (LS) transmission peripheral device is an ideal solution.
USB LS的传输外设装置的具体应用目标包括:实现协议层的LS外设传输控制,通过UTMI(USB2.0 Transceiver Macrocell Interface)接口和物理层进行数据传输过程中的控制和检错,进行物理层和内部缓冲寄存器(buffer)的数据交换,通过高级微控制器总线(Advanced Microcontroller Bus Architecture,简称为AMBA)的高级高性能总线(Advanced High performance Bus,简称为AHB)接口和核控制器进行通信,从而完成基本的bulk IN/OUT、控制传输、以及中断传输等。The specific application goals of the USB LS transmission peripheral device include: realizing the transmission control of the LS peripheral device at the protocol layer, controlling and detecting errors during data transmission through the UTMI (USB2.0 Transceiver Macrocell Interface) interface and the physical layer, and performing physical The data exchange between layers and internal buffer registers (buffers) communicates with the core controller through the Advanced High Performance Bus (AHB) interface of the Advanced Microcontroller Bus Architecture (AMBA) , so as to complete the basic bulk IN/OUT, control transmission, and interrupt transmission.
图1是现有技术中USB LS的模块示意图,如图1所示,主要包括UTM数据同步、包解码和译码,RAM控制,数据传输通道(EP)控制、CPU接口四个部分;由于通常物理层的时钟和控制器的时钟不属于同一个时钟域,所以数据首先由UTM进行数据同步,随后解码/译码模块处理传输包,包括包头的处理、数据传输以及CRC校验;EP是USB中的数据传输管道,EP控制模块控制分为一般EP控制和EP0控制两部分,进行数据传输时的EP控制;CPU接口允许CPU通过总线访问装置内部的控制、状态寄存器,以及每个EP的FIFO,CPU接口可以支持32bit的数据;RAM控制模块控制USB和CPU之间的单端口RAM的访问。Figure 1 is a schematic diagram of the module of the USB LS in the prior art, as shown in Figure 1, mainly including UTM data synchronization, packet decoding and decoding, RAM control, data transmission channel (EP) control, CPU interface four parts; because usually The clock of the physical layer and the clock of the controller do not belong to the same clock domain, so the data is first synchronized by UTM, and then the decoding/decoding module processes the transmission packet, including the processing of the packet header, data transmission and CRC check; EP is USB The data transmission pipeline in the EP control module is divided into two parts: general EP control and EP0 control, and EP control during data transmission; the CPU interface allows the CPU to access the internal control and status registers of the device through the bus, as well as the FIFO of each EP , CPU interface can support 32bit data; RAM control module controls the access of single-port RAM between USB and CPU.
现有技术中的USB2.0的控制器可以支持高速、全速/低速,并且可以作为主机(HOST)和设备(DEVICE),或者功能受限主机(OTG),这样的控制器可以完成USB2.0协议规定的主要功能,其基本的控制状态机步骤如下(异常未列出):The USB2.0 controller in the prior art can support high-speed, full-speed/low-speed, and can be used as a host (HOST) and a device (DEVICE), or a function-limited host (OTG), such a controller can complete USB2.0 The main functions stipulated by the protocol, and its basic control state machine steps are as follows (exceptions are not listed):
步骤1、传输开始时,检测D+/D-信号线,如果二者处于空闲状态,检测自身的ID,根据物理层(Physical Layer,简称为PHY)提供的数据,可以判断控制器自己是DEVICE还是HOST,如果是HOST,进入步骤2;否则,进入步骤5;其中,D+信号线和D-信号线是USB用户数据传输的差分线。Step 1. When the transmission starts, detect the D+/D- signal line. If the two are in an idle state, detect its own ID. According to the data provided by the physical layer (Physical Layer, PHY), you can judge whether the controller itself is a DEVICE or a HOST, if it is HOST, go to step 2; otherwise, go to step 5; wherein, D+ signal line and D- signal line are differential lines for USB user data transmission.
步骤2、HOST通过控制UTMI信号线,通过PHY对D+/D-线进行拉高和拉低的操作,与DEVICE进行连接;进入步骤3;Step 2. HOST controls the UTMI signal line and pulls up and down the D+/D- line through the PHY to connect with DEVICE; go to step 3;
步骤3、连接成功后进行复位操作,复位的过程可以通过DEVICE端对D+/D-线上的操作判断DEVICE是哪一种速度;进入步骤4;Step 3. Perform a reset operation after the connection is successful. During the reset process, you can judge which speed the DEVICE is through the operation on the D+/D- line of the DEVICE terminal; go to step 4;
步骤4、复位完成后,控制器按照判断好的速度进行控制信息和数据包的传递;传输结束,回到IDLE状态,等待下一次传输;Step 4. After the reset is completed, the controller transmits the control information and data packets according to the determined speed; after the transmission is completed, it returns to the IDLE state and waits for the next transmission;
步骤5、如果检测到控制器为DEVICE,会进入OTG的模式,发起SRP(USB2.0的OTG协议中的唤醒部分),对HOST方进行唤醒操作,当主机被成功唤醒后,控制器退出OTG模式,与HOST侧进行连接;进入步骤6;Step 5. If it detects that the controller is DEVICE, it will enter OTG mode, initiate SRP (the wake-up part in the OTG protocol of USB2.0), and perform a wake-up operation on the HOST. When the host is successfully woken up, the controller exits OTG mode, connect to the HOST side; go to step 6;
步骤6、主机和DEVICE连接,DEVICE按照寄存器配置的速度进行复位操作,如果是高速,那么DEVCIE会首先拉高D-线,表示高速复位,如果是全速和低速,那么DEVICE会首先拉高D+线,表示全速/低速复位;进入步骤7;Step 6. The host is connected to DEVICE. DEVICE resets according to the speed configured by the register. If it is high speed, then DEVCIE will first pull up the D- line, indicating high-speed reset. If it is full speed and low speed, then DEVICE will first pull up the D+ line. , means full speed/low speed reset; go to step 7;
步骤7、复位完成后,HOST按照判断好的速度进行控制信息和数据包的传递;DEVIE控制器接收命令令牌包,按照命令包做出响应,例如,传输数据包或者握手等信息,同时进行数据包正确传输的判断,包括:CRC检验,传输数据包是否符合协议中传输类型的要求等;传输结束,回到IDLE状态,等待下一次传输。Step 7. After the reset is completed, HOST transmits the control information and data packets according to the determined speed; the DEVIE controller receives the command token packet and responds according to the command packet, for example, transmitting data packets or handshaking and other information, and at the same time The judgment of the correct transmission of the data packet includes: CRC check, whether the transmitted data packet meets the requirements of the transmission type in the protocol, etc.; after the transmission is completed, return to the IDLE state and wait for the next transmission.
从上述处理可以看出,在现有技术中,USB LS的控制都是和全速的状态机在一起完成的,这样对于只要求LS的设备浪费了大量的设计资源,对于仅需要运用USB的LS的外设而言,并不需要全速和高速的功能。It can be seen from the above processing that in the prior art, the control of USB LS is completed together with the full-speed state machine, which wastes a lot of design resources for devices that only require LS, and for LS that only needs to use USB As far as the peripherals are concerned, full-speed and high-speed functions are not required.
发明内容Contents of the invention
本发明提供一种USB低速设备数据传输控制方法及控制器,以解决现有技术中由于USB LS的控制与全速和高速的控制在一起完成而导致的USB LS的设备浪费了大量的设计资源的问题。The present invention provides a USB low-speed device data transmission control method and controller to solve the problem of wasting a lot of design resources for USB LS devices caused by the completion of USB LS control and full-speed and high-speed control together in the prior art question.
本发明提供一种USB低速设备数据传输控制方法,包括:在传输开始时,检测USB低速设备的D+信号线和D-信号线,如果D+信号线和D-信号线均处于空闲状态,则拉高D+信号线;在主机侧将D+信号线拉低后,直接进入复位状态,并拉高D+信号线;在主机侧复位完成后,控制数据传输通道EP并与主机侧进行数据传输,在传输结束后,将D+信号线和D-信号线均设置为空闲状态。The present invention provides a USB low-speed device data transmission control method, including: at the beginning of the transmission, detect the D+ signal line and the D- signal line of the USB low-speed device, and if the D+ signal line and the D- signal line are both in an idle state, pull High D+ signal line; after pulling down the D+ signal line on the host side, it will directly enter the reset state and pull up the D+ signal line; after the host side reset is completed, control the data transmission channel EP and perform data transmission with the host side. After finishing, set both D+ signal line and D- signal line to idle state.
优选地,控制EP具体包括:步骤1,判断EP是否准备好接收令牌包,如果判断为是,则执行步骤2,如果判断为否,则将EP设置为空闲状态;步骤2,更新EP的先入先出队列FIFO中存储的数据,接收令牌包,并对令牌包进行译码解析;步骤3,判断令牌包是否携带有数据包,如果判断为是,执行步骤4,否则执行步骤5;步骤4,处理令牌包,返回正确的响应,并将EP设置为空闲状态;步骤5,处理令牌包,如果令牌包为IN事务传输令牌,则将EP设置为发送状态;如果令牌包为OUT事务传输令牌,则将EP设置为接收状态。Preferably, controlling the EP specifically includes: step 1, judging whether the EP is ready to receive the token packet, if it is judged to be yes, then performing step 2, if it is judged to be no, then setting the EP to an idle state; step 2, updating the EP's The data stored in the first-in-first-out queue FIFO receives the token packet, and decodes and analyzes the token packet; step 3, judges whether the token packet carries a data packet, if it is judged to be yes, execute step 4, otherwise execute step 5; Step 4, process the token packet, return the correct response, and set the EP to the idle state; Step 5, process the token packet, if the token packet is an IN transaction transfer token, then set the EP to the sending state; If the token package transmits a token for an OUT transaction, set the EP to receive state.
优选地,在EP为发送状态时,与主机侧进行数据传输具体包括:判断EP是否准备好发送数据包,如果判断为是,则接收OUT令牌包,并发送数据包,同时产生发送数据中断给主机侧,否则,结束发送,并通知主机侧。Preferably, when the EP is in the sending state, the data transmission with the host side specifically includes: judging whether the EP is ready to send a data packet, if it is judged to be yes, then receiving the OUT token packet, and sending the data packet, and generating a data sending interruption at the same time to the host side, otherwise, end sending and notify the host side.
优选地,在EP为接收状态时,与主机侧进行数据传输具体包括:在EP为接收状态时,判断EP是否准备好接收数据包,如果判断为是,则接收IN令牌包,并发送数据包,同时产生发送数据中断给主机侧,否则,结束接收,并通知主机侧。Preferably, when the EP is in the receiving state, performing data transmission with the host side specifically includes: when the EP is in the receiving state, judging whether the EP is ready to receive data packets, and if it is judged to be yes, then receiving the IN token packet and sending the data Packet, at the same time generate a send data interrupt to the host side, otherwise, end receiving, and notify the host side.
优选地,上述方法还包括:预先配置EP的数目、以及各个EP的先入先出队列的大小;自动探测数据传输过程中的错误,通知主机侧并产生中断;在数据传输停止预定时间后,产生暂停中断,进入暂停模式,并通过暂停信号通知物理层进入暂停模式,在检测到唤醒信号或复位信号后,退出暂停模式,并通知物理层退出暂停模式。Preferably, the above method also includes: pre-configuring the number of EPs and the size of the first-in-first-out queue of each EP; automatically detecting errors in the data transmission process, notifying the host side and generating an interruption; after the data transmission stops for a predetermined time, generating Suspend interrupt, enter the suspend mode, and notify the physical layer to enter the suspend mode through the suspend signal, and exit the suspend mode after detecting the wake-up signal or reset signal, and notify the physical layer to exit the suspend mode.
本发明还提供了一种控制器,用于控制USB低速设备的数据传输,包括:检测模块,用于在传输开始时,检测USB低速设备的D+信号线和D-信号线,如果D+信号线和D-信号线均处于空闲状态,则拉高D+信号线;复位模块,用于在主机侧将D+信号线拉低后,直接进入复位状态,并拉高D+信号线;传输模块,用于在主机侧复位完成后,控制数据传输通道EP并与主机侧进行数据传输,在传输结束后,将D+信号线和D-信号线均设置为空闲状态。The present invention also provides a controller for controlling the data transmission of the USB low-speed device, including: a detection module for detecting the D+ signal line and the D- signal line of the USB low-speed device when the transmission starts, if the D+ signal line and D- signal lines are both in the idle state, then pull up the D+ signal line; the reset module is used to directly enter the reset state after the D+ signal line is pulled down on the host side, and pull up the D+ signal line; the transmission module is used for After the reset of the host side is completed, control the data transmission channel EP and perform data transmission with the host side. After the transmission is completed, both the D+ signal line and the D- signal line are set to an idle state.
优选地,传输模块具体包括:第一判断子模块,用于判断EP是否准备好接收令牌包,如果判断为是,则调用更新子模块,如果判断为否,则将EP设置为空闲状态;更新子模块,用于更新EP的先入先出队列FIFO中存储的数据;接收子模块,用于接收令牌包;第一处理子模块,用于对令牌包进行译码解析;第二判断子模块,用于根据第一处理子模块的处理结果判断令牌包是否携带有数据包,如果判断为是,调用第二处理子模块,否则,调用第三处理子模块;第二处理子模块,用于处理令牌包,返回正确的响应,并将EP设置为空闲状态;第三处理子模块,用于处理令牌包,如果令牌包为IN事务传输令牌,则将EP设置为发送状态;如果令牌包为OUT事务传输令牌,则将EP设置为接收状态。Preferably, the transmission module specifically includes: a first judging submodule, used to judge whether the EP is ready to receive the token packet, if it is judged to be yes, then call the update submodule, if it is judged to be no, then the EP is set to an idle state; The update submodule is used to update the data stored in the first-in-first-out queue FIFO of the EP; the receiving submodule is used to receive the token packet; the first processing submodule is used to decode and analyze the token packet; the second judgment The submodule is used to judge whether the token packet carries a data packet according to the processing result of the first processing submodule, if it is judged to be yes, call the second processing submodule, otherwise, call the third processing submodule; the second processing submodule , for processing the token packet, returning a correct response, and setting the EP to an idle state; the third processing submodule is used for processing the token packet, if the token packet is an IN transaction transfer token, then the EP is set to Send state; if the token packet transmits tokens for OUT transactions, set the EP to receive state.
优选地,传输模块具体包括:第三判断子模块,用于在EP为发送状态时,判断EP是否准备好发送数据包,如果判断为是,则调用第一发送子模块,否则,结束发送,并通知主机侧;第一发送子模块,用于接收OUT令牌包,并发送数据包,同时产生发送数据中断给主机侧。Preferably, the transmission module specifically includes: a third judging submodule, which is used to judge whether the EP is ready to send a data packet when the EP is in the sending state, and if it is judged to be yes, then call the first sending submodule, otherwise, end the sending, And notify the host side; the first sending sub-module is used to receive the OUT token packet, send the data packet, and generate a data sending interrupt to the host side at the same time.
优选地,传输模块具体包括:第四判断子模块,用于在EP为接收状态时,判断EP是否准备好接收数据包,如果判断为是,则调用第二发送子模块,否则,结束接收,并通知主机侧;第二发送子模块,用于接收IN令牌包,并发送数据包,同时产生发送数据中断给主机侧。Preferably, the transmission module specifically includes: a fourth judging submodule, which is used to judge whether the EP is ready to receive data packets when the EP is in the receiving state, and if it is judged to be yes, then call the second sending submodule, otherwise, end the reception, And notify the host side; the second sending sub-module is used to receive the IN token packet, send the data packet, and generate a data sending interrupt to the host side at the same time.
优选地,上述控制器进一步包括:配置模块,用于配置EP的数目,以及各个EP的先入先出队列的大小;纠错模块,用于自动探测数据传输过程中的错误,通知主机侧并产生中断;暂停模块,用于在数据传输停止预定时间后,产生暂停中断,进入暂停模式,并通过暂停信号通知物理层进入暂停模式,在检测到唤醒信号或复位信号后,退出暂停模式,并通知物理层退出暂停模式。Preferably, the above-mentioned controller further includes: a configuration module, configured to configure the number of EPs, and the size of the first-in-first-out queue of each EP; an error correction module, configured to automatically detect errors in the data transmission process, notify the host side and generate Interrupt; the suspend module is used to generate a suspend interrupt after the data transmission stops for a predetermined time, enter the suspend mode, and notify the physical layer to enter the suspend mode through the suspend signal, and exit the suspend mode after detecting the wake-up signal or reset signal, and notify The physical layer exits suspend mode.
本发明有益效果如下:The beneficial effects of the present invention are as follows:
通过去除控制器中对全速和高速的控制,解决了现有技术中由于USB LS的控制与全速和高速的控制在一起完成而导致的USB LS的设备浪费了大量的设计资源的问题,使原兼容USB低速的USB装置仅支持USB低速的外设功能,控制器的面积减少了50%,并按照USB的协议要求正确实现了物理层之间的接口通信传输及传输中通道的检测握手。By removing the control of full speed and high speed in the controller, the problem of wasting a lot of design resources in USB LS devices due to the completion of USB LS control and full speed and high speed control in the prior art is solved, making the original Compatible USB low-speed USB devices only support USB low-speed peripheral functions, the area of the controller is reduced by 50%, and the interface communication transmission between the physical layers and the detection handshake of the transmission channel are correctly realized according to the USB protocol requirements.
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。The above description is only an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention, it can be implemented according to the contents of the description, and in order to make the above and other purposes, features and advantages of the present invention more obvious and understandable , the specific embodiments of the present invention are enumerated below.
附图说明Description of drawings
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiment. The drawings are only for the purpose of illustrating a preferred embodiment and are not to be considered as limiting the invention. Also throughout the drawings, the same reference numerals are used to designate the same parts. In the attached picture:
图1是现有技术中USB LS的模块示意图;FIG. 1 is a schematic diagram of a module of a USB LS in the prior art;
图2是本发明实施例的USB低速设备数据传输控制方法的流程图;2 is a flowchart of a USB low-speed device data transmission control method according to an embodiment of the present invention;
图3是本发明实施例的USB2.0 LS外设验证环境搭建时的一种可借鉴方案的连接示意图;Fig. 3 is a connection schematic diagram of a reference scheme when the USB2.0 LS peripheral verification environment is set up according to the embodiment of the present invention;
图4是本发明实施例的EP0的控制主状态转移的流程图;Fig. 4 is the flowchart of the control main state transfer of the EPO of the embodiment of the present invention;
图5是本发明实施例的EP0为IDLE模式时的控制流程图;Fig. 5 is the control flowchart when EPO of the embodiment of the present invention is IDLE mode;
图6是本发明实施例的EP0进入发送模式后的控制流程图;Fig. 6 is the control flowchart after the EPO of the embodiment of the present invention enters the sending mode;
图7是本发明实施例的EP0进入接收模式后的控制流程图;Fig. 7 is the control flowchart after EPO of the embodiment of the present invention enters receiving mode;
图8是本发明实施例的初始化时复位的波形示意图;FIG. 8 is a schematic diagram of a waveform reset during initialization according to an embodiment of the present invention;
图9是本发明实施例的EP0进行控制IN控制传输时的波形示意图;9 is a schematic diagram of waveforms when EPO performs control IN control transmission according to an embodiment of the present invention;
图10是本发明实施例的EP4进行OUT传输时的波形示意图;FIG. 10 is a schematic diagram of waveforms when EP4 performs OUT transmission according to an embodiment of the present invention;
图11是本发明实施例的控制器的结构示意图。Fig. 11 is a schematic structural diagram of a controller according to an embodiment of the present invention.
具体实施方式detailed description
下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided for more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
为了解决现有技术中由于USB LS的控制与全速和高速的控制在一起完成而导致的USB LS的设备浪费了大量的设计资源的问题,本发明提供了一种USB低速设备数据传输控制方法及控制器,在本发明实施例中,基于USB2.0的结构和原理,在原有基础上进行改进,使原兼容USB低速的USB2.0装置仅支持USB低速的device功能,使得原来的USB2.0装置可以仅完成USB低速的device(外设)功能,使得面积减少了50%,并按照USB的协议要求正确实现了物理层之间的接口通信传输及传输中通道的检测握手。以下结合附图以及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不限定本发明。In order to solve the problem in the prior art that USB LS equipment wastes a lot of design resources because the USB LS control is completed together with full-speed and high-speed control, the present invention provides a USB low-speed device data transmission control method and In the embodiment of the present invention, the controller, based on the structure and principle of USB2.0, is improved on the original basis, so that the original USB2.0 device compatible with USB low-speed only supports the device function of USB low-speed, so that the original USB2.0 The device can only complete the USB low-speed device (peripheral) function, which reduces the area by 50%, and correctly realizes the interface communication transmission between the physical layers and the detection handshake of the transmission channel according to the USB protocol requirements. The present invention will be described in further detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, not to limit the present invention.
方法实施例method embodiment
根据本发明的实施例,提供了一种USB低速设备数据传输控制方法,图2是本发明实施例的USB低速设备数据传输控制方法的流程图,如图2所示,根据本发明实施例的USB低速设备数据传输控制方法包括如下处理:According to an embodiment of the present invention, a USB low-speed device data transmission control method is provided. FIG. 2 is a flow chart of a USB low-speed device data transmission control method according to an embodiment of the present invention. As shown in FIG. 2 , according to an embodiment of the present invention The USB low-speed device data transmission control method includes the following processing:
步骤201,在传输开始时,检测USB低速设备的D+信号线和D-信号线,如果D+信号线和D-信号线均处于空闲状态,则拉高D+信号线;Step 201, when the transmission starts, detect the D+ signal line and the D- signal line of the USB low-speed device, and if the D+ signal line and the D- signal line are both in an idle state, then pull the D+ signal line high;
步骤202,在主机侧将D+信号线拉低后,直接进入复位状态,并拉高D+信号线;Step 202, after pulling down the D+ signal line on the host side, directly enter the reset state, and pull up the D+ signal line;
步骤203,在主机侧复位完成后,控制数据传输通道EP并与主机侧进行数据传输,在传输结束后,将D+信号线和D-信号线均设置为空闲状态。Step 203 , after the reset of the host side is completed, control the data transmission channel EP and perform data transmission with the host side, and set the D+ signal line and the D− signal line to an idle state after the transmission is completed.
在步骤203中,控制EP具体包括:In step 203, controlling the EP specifically includes:
步骤1,判断EP是否准备好接收令牌包,如果判断为是,则执行步骤2,如果判断为否,则将EP设置为空闲状态;Step 1, judge whether the EP is ready to receive the token packet, if it is judged to be yes, then perform step 2, if it is judged to be no, then the EP is set to an idle state;
步骤2,更新EP的先入先出队列FIFO中存储的数据,接收令牌包,并对令牌包进行译码解析;Step 2, update the data stored in the first-in-first-out queue FIFO of the EP, receive the token packet, and decode and analyze the token packet;
步骤3,判断令牌包是否携带有数据包,如果判断为是,执行步骤4,否则执行步骤5;Step 3, judging whether the token packet carries a data packet, if it is judged to be yes, go to step 4, otherwise go to step 5;
步骤4,处理令牌包,返回正确的响应,并将EP设置为空闲状态;Step 4, process the token packet, return a correct response, and set the EP to an idle state;
步骤5,处理令牌包,如果令牌包为IN事务传输令牌,则将EP设置为发送状态;如果令牌包为OUT事务传输令牌,则将EP设置为接收状态。Step 5, process the token packet, if the token packet is an IN transaction transfer token, set the EP to the sending state; if the token packet is an OUT transaction transfer token, then set the EP to the receiving state.
在EP为发送状态时,与主机侧进行数据传输具体包括:判断EP是否准备好发送数据包,如果判断为是,则接收OUT令牌包,并发送数据包,同时产生发送数据中断给主机侧,否则,结束发送,并通知主机侧。When the EP is in the sending state, the data transmission with the host side specifically includes: judging whether the EP is ready to send a data packet, if it is judged to be yes, then receiving the OUT token packet, sending the data packet, and generating a data sending interrupt to the host side at the same time , otherwise, end sending and notify the host side.
在EP为接收状态时,与主机侧进行数据传输具体包括:在EP为接收状态时,判断EP是否准备好接收数据包,如果判断为是,则接收IN令牌包,并发送数据包,同时产生发送数据中断给主机侧,否则,结束接收,并通知主机侧。When the EP is in the receiving state, data transmission with the host side specifically includes: when the EP is in the receiving state, judging whether the EP is ready to receive the data packet, if it is judged to be yes, then receiving the IN token packet and sending the data packet, at the same time Generate a sending data interrupt to the host side, otherwise, end receiving and notify the host side.
优选地,在本发明实施例中,可以预先配置EP的数目、以及各个EP的先入先出队列的大小;还可以自动探测数据传输过程中的错误,通知主机侧并产生中断;在数据传输停止预定时间后,产生暂停中断,进入暂停模式,并通过暂停信号通知物理层进入暂停模式,在检测到唤醒信号或复位信号后,退出暂停模式,并通知物理层退出暂停模式。Preferably, in the embodiment of the present invention, the number of EPs and the size of the first-in-first-out queue of each EP can be pre-configured; errors in the data transmission process can also be automatically detected, and the host side is notified and interrupted; when the data transmission stops After a predetermined time, generate a suspend interrupt, enter the suspend mode, and notify the physical layer to enter the suspend mode through the suspend signal, and exit the suspend mode after detecting the wake-up signal or reset signal, and notify the physical layer to exit the suspend mode.
从上述处理可以看出,在本发明实施例中,控制器通过UTMI接口和物理层进行数据交换,同步控制器的PHY的时钟域,这样控制器内部就可以工作在总线时钟下,而不需要和PHY保持一致;图3是本发明实施例的USB2.0LS外设验证环境搭建时的一种可借鉴方案的连接示意图,如图3所示,在控制器与PHY连接时,只需要把图3中的MiniAB接口换成HOST的VIP接口,在控制器端通过总线接口(AHB接口)和CPU相连接即可。As can be seen from the above processing, in the embodiment of the present invention, the controller performs data exchange through the UTMI interface and the physical layer, and synchronizes the clock domain of the PHY of the controller, so that the inside of the controller can work under the bus clock without the need to It is consistent with the PHY; Fig. 3 is a connection schematic diagram of a reference scheme when the USB2.0LS peripheral verification environment of the embodiment of the present invention is set up, as shown in Fig. Replace the MiniAB interface in 3 with the VIP interface of HOST, and connect it to the CPU through the bus interface (AHB interface) on the controller side.
本发明实施例的控制器装置能够编码、译码、纠错和控制所有发送和接收到的USB数据包,IN传输的控制数据流通过外设的发送FIFO进行,OUT传输的控制数据流通过外设的接收FIFO进行;本发明实施例的控制器支持动态FIFO。The controller device in the embodiment of the present invention can encode, decode, correct errors and control all sent and received USB data packets. The control data flow transmitted by IN is carried out through the sending FIFO of the peripheral device, and the control data flow transmitted by OUT is carried out by the external device. The receiving FIFO is set; the controller of the embodiment of the present invention supports dynamic FIFO.
此外,本发明实施例支持可配置的EP数目,EP数目是0~4,均可按照传输要求配置,例如:对于BULK OUT操作EP可设置为RX endpoint,对于BULKIN操作EP可设置为TXendpoint;另外,EP的FIFO可以配置为不同的大小,满足不同传输的要求,是传输能力多样化;能够接受主机(HOST)方发出的SOF包,并产生SOF中断;并在数据传输中产生相应的控制中断。In addition, the embodiment of the present invention supports a configurable number of EPs. The number of EPs is 0~4, which can be configured according to the transmission requirements. For example, for BULK OUT operation, EP can be set as RX endpoint, and for BULKIN operation, EP can be set as TXendpoint; in addition , EP's FIFO can be configured in different sizes to meet different transmission requirements, and the transmission capability is diversified; it can accept SOF packets sent by the host (HOST), and generate SOF interrupts; and generate corresponding control interrupts during data transmission .
本发明实施例的控制器还支持DEVICE模式的暂停(SUSPEND)操作,例如,当USB上没有数据传输3ms时,控制器可以产生SUSPEND中断,进入SUSPEND模式,在该模式下,控制器通过SUSPEND信号通知PHY进入SUSPEND模式,此时PHY时钟关断,直到总线上监测到唤醒或者复位信号,控制器退出SUSPEND并通过SUSPEND信号通知PHY,PHY退出SUSPEND状态。The controller of the embodiment of the present invention also supports the suspend (SUSPEND) operation in DEVICE mode. For example, when there is no data transmission on the USB for 3ms, the controller can generate a SUSPEND interrupt and enter the SUSPEND mode. In this mode, the controller passes the SUSPEND signal Notify the PHY to enter the SUSPEND mode. At this time, the PHY clock is turned off until the wake-up or reset signal is detected on the bus. The controller exits SUSPEND and notifies the PHY through the SUSPEND signal, and the PHY exits the SUSPEND state.
本发明实施例的控制器还支持数据的循环冗余校验(Cyclic RedundancyCheck,简称为CRC),具有数据纠错能力,能够自动探测USB传输过程中的协议错误,并返回STALL包,并产生中断,当CPU接收到该中断时,可以终止当前传输,清除STALL的中断位,控制器自动返回IDLE状态。The controller in the embodiment of the present invention also supports data cyclic redundancy check (Cyclic Redundancy Check, referred to as CRC), has data error correction capability, can automatically detect protocol errors in the USB transmission process, and returns STALL packets, and generates interrupts , when the CPU receives the interrupt, it can terminate the current transmission, clear the STALL interrupt bit, and the controller automatically returns to the IDLE state.
以下结合附图,以USB2.0版本为例,对本发明实施例的上述技术方案进行详细的说明。The above technical solution of the embodiment of the present invention will be described in detail below with reference to the accompanying drawings and taking the USB2.0 version as an example.
在现有技术中,针对低速装置,USB的控制器中的很多功能是不需要的,例如,HOST功能、高速部分、以及OTG功能等;本发明实施例为了实现对基于USB2.0低速装置的传输控制,保留了低速部分DEVICE的控制部分,以及CRC检验和协议判断的部分,去除了HOST功能,高速部分以及OTG的部分功能;本发明实施例的基本的控制状态机步骤如下(异常未列出):In the prior art, for low-speed devices, many functions in the USB controller are unnecessary, for example, HOST function, high-speed part, and OTG function; Transmission control retains the control part of the low-speed part DEVICE, and the part of CRC check and protocol judgment, removes the HOST function, high-speed part and some functions of OTG; the basic control state machine steps of the embodiment of the present invention are as follows (exception is not listed out):
步骤1、传输开始时,检测D+/D-信号线,如果二者处于空闲状态,发起SRP操作,即拉高D+线;等待HOST侧响应;Step 1. When the transmission starts, detect the D+/D- signal line. If the two are in an idle state, initiate an SRP operation, that is, pull the D+ line high; wait for the response from the HOST side;
步骤2、HOST侧将D+线拉低,表示被唤醒,DEVICE跳出SRP状态直接进入复位状态,拉高D+线;进入步骤3;Step 2. Pull the D+ line low on the HOST side, indicating that it is awakened. The DEVICE jumps out of the SRP state and enters the reset state directly, and pulls the D+ line high; enter step 3;
步骤3、在本状态中,FS和LS的复位是一致的,都是拉高D+线,HOST接收到复位信号后,开始复位操作,复位完成后,HOST开始进行数据包和命令信息的传输;进入步骤4;Step 3. In this state, the resets of FS and LS are consistent, and both pull the D+ line high. After HOST receives the reset signal, it starts the reset operation. After the reset is completed, HOST starts the transmission of data packets and command information; Go to step 4;
步骤4、在数据传输过程中,低速设备对于D+/D-线的状态判断与全速和高速相反,传统的控制器通过判断UTMI的信号linstate的状态区分全速和低速,本发明实施例不需要进行速度判断;Step 4. During data transmission, the state judgment of the low-speed device for the D+/D- line is opposite to full speed and high speed. The traditional controller distinguishes between full speed and low speed by judging the state of the UTMI signal linstate. Embodiments of the present invention do not need to perform Speed judgment;
步骤5、传输结束,回到IDLE状态,等待下一次传输。Step 5. After the transmission is completed, return to the IDLE state and wait for the next transmission.
通过上述控制器的主状态机的说明,可以看出本发明实施例去掉了大部分的控制状态和判断部分,达到了缩减电路资源的目的。Through the above description of the main state machine of the controller, it can be seen that most of the control state and judgment parts are removed in the embodiment of the present invention, and the purpose of reducing circuit resources is achieved.
基本的USB2.0控制器还需要完成对EP的控制,按照USB2.0协议,EP之间建立连接,形成数据传输的管道;本发明实施例在USB2.0的基础上提取USB的低速外设,并对内部状态机进行控制:包括主状态机,以控制USB装置的整体工作,完成对USB装置内部EP的控制。本发明实施例对于EP的控制采用单独的控制状态机,控制单个EP的数据通道,EP0是EP中比较特殊的一个,用来完成LINK UP等初始化的操作,以EP0的控制传输为例说明本装置对EP的控制过程;The basic USB2.0 controller also needs to complete the control of the EP. According to the USB2.0 protocol, a connection is established between the EPs to form a data transmission pipeline; the embodiment of the present invention extracts the low-speed peripherals of the USB on the basis of the USB2.0 , and control the internal state machine: including the main state machine to control the overall work of the USB device and complete the control of the internal EP of the USB device. The embodiment of the present invention adopts a separate control state machine for the control of EP, and controls the data channel of a single EP. EP0 is a special one in EP, which is used to complete initialization operations such as LINK UP. The control transmission of EP0 is used as an example to illustrate this The control process of the device to EP;
图4是本发明实施例的EP0的控制主状态转移的流程图,传统的USB控制器是软件通过读EP0状态寄存器,判断EP0是否处于空闲,如果是的话,可以挂起,或者发送SETUP令牌包;然后进入IDLE状态;本发明实施例也可以通过软件读EP0的状态,但不会发起SETUP令牌,因为命令令牌只能由HOST发出;本发明实施例的EP0直接处于IDLE状态;之后,传统的USB控制器是可以通过软件配置,使EP0进入发送或者接收模式;本发明实施例会等待接收HOST侧的令牌包,如果是IN操作,则EP进入发送状态,如果是OUT操作,则EP进入接收状态。Fig. 4 is the flow chart of the control main state transfer of EP0 of the embodiment of the present invention, traditional USB controller is that software reads EP0 status register, judges whether EP0 is idle, if so, can hang up, or sends SETUP token Then enter the IDLE state; the embodiment of the present invention can also read the state of EP0 by software, but can not initiate the SETUP token, because the command token can only be sent by HOST; the EP0 of the embodiment of the present invention is directly in the IDLE state; after that , the traditional USB controller can be configured by software to make EP0 enter the sending or receiving mode; the embodiment of the present invention will wait to receive the token packet from the HOST side. If it is an IN operation, EP will enter the sending state. If it is an OUT operation, then EP enters receiving state.
图5是本发明实施例的EP0为IDLE模式时的控制流程图,如图5所示,在本发明实施例中,当上电和复位时,EP进入IDLE模式;在主状态机中,当进行SETUP传输,即USB进行枚举状态时,进入IDLE模式;进入IDLE模式后,进行以下步骤:Fig. 5 is the control flowchart when EP0 of the embodiment of the present invention is IDLE mode, as shown in Fig. 5, in the embodiment of the present invention, when power-on and reset, EP enters IDLE mode; In main state machine, when Perform SETUP transmission, that is, when the USB is in the enumeration state, enter the IDLE mode; after entering the IDLE mode, perform the following steps:
步骤1,准备接收数据包或者令牌包,如果没有准备好,回到IDLE状态,转备好后,进入步骤2;Step 1, prepare to receive data packet or token packet, if not ready, return to IDLE state, after turning to standby, go to step 2;
步骤2,更新FIFO中存储的数据,接收命令;Step 2, update the data stored in the FIFO and receive the command;
步骤3,接收到命令后,进行译码,对命令进行解析,按照USB2.0的协议判断命令令牌是否带有数据包,如果不带有数据包进入步骤4,否则进入步骤5;Step 3, after receiving the command, decode and analyze the command, and judge whether the command token has a data packet according to the protocol of USB2.0, if there is no data packet, go to step 4, otherwise go to step 5;
步骤4,处理令牌包,设置数据,并返回正确的响应,回到IDLE状态;Step 4, process the token packet, set the data, and return the correct response, and return to the IDLE state;
步骤5,处理令牌包,设置数据;判断是否是IN事务传输令牌,是的话进入发送模式(图6),不是则进入步骤6;Step 5, process the token packet and set the data; judge whether it is an IN transaction transfer token, if yes, enter the sending mode (Figure 6), if not, enter step 6;
步骤6,进入OUT事务传输,进入接收模式(图7)。Step 6, enter the OUT transaction transmission, and enter the receiving mode (Figure 7).
图6是本发明实施例的EP0进入发送模式后的控制流程图,如图6所示,如果EP0为TX模式,传统USB控制器可以发送和接收OUT令牌包,本发明实施例只能够接收OUT令牌包;所有接收到的IN令牌包都会被当做数据处理,如果此时接收到SETUP命令或者OUT令牌包,会产生SETUPEND的条件,EP0退出TX模式,另外,如果传输的数据包的长度小于EP0配置的最大包长度,或者接收到空包,USB退出该状态;其它EP的TX模式与此类似,处理步骤如下:Fig. 6 is the control flowchart after EP0 enters the sending mode of the embodiment of the present invention, as shown in Fig. 6, if EP0 is TX mode, traditional USB controller can send and receive OUT token packet, the embodiment of the present invention can only receive OUT token packet; all received IN token packets will be treated as data. If the SETUP command or OUT token packet is received at this time, the SETUPEND condition will be generated, and EP0 will exit the TX mode. In addition, if the transmitted data packet The length of the EP0 is less than the maximum packet length configured by EP0, or the USB exits this state when an empty packet is received; the TX mode of other EPs is similar to this, and the processing steps are as follows:
步骤1,准备发送包判断,如果没有转备好,直接结束发送,返回STALL响应,表示数据没有准备好,否则进入步骤2;Step 1: Judgment of the ready-to-send packet. If it is not ready, end the sending directly and return a STALL response, indicating that the data is not ready, otherwise go to step 2;
步骤2,接收OUT令牌包,发送DATA0数据包,同时产生发送数据中断给CPU;Step 2, receive the OUT token packet, send the DATA0 data packet, and generate a data sending interrupt to the CPU at the same time;
步骤3,OUT事务结束。Step 3, the OUT transaction ends.
图7是本发明实施例的EP0进入接收模式后的控制流程图,如图7所示,EP0在RX模式是,传统USB控制器可以发送和接收IN令牌包,本发明实施例只能够接收IN令牌包;所有接收到的OUT令牌包都会被当做数据处理,如果接收到SETUP或者OUT令牌包,会产生SETUPEND条件,RX模式终止;另外如果主机端发送无效的令牌包或者空包,又或者发送的包长度小于最大包长度,也会产生SETUPEND条件;它EP的TX模式与此类似,处理步骤如下:Fig. 7 is the control flow chart of the EPO of the embodiment of the present invention after entering the receiving mode, as shown in Fig. 7, when EPO is in the RX mode, the traditional USB controller can send and receive the IN token packet, but the embodiment of the present invention can only receive IN token packet; all received OUT token packets will be treated as data, if a SETUP or OUT token packet is received, a SETUPEND condition will be generated, and the RX mode will terminate; in addition, if the host sends an invalid token packet or an empty packet, or the length of the sent packet is less than the maximum packet length, the SETUPEND condition will also be generated; the TX mode of its EP is similar to this, and the processing steps are as follows:
步骤1,准备接收包判断,如果没有转备好,直接结束发送,返回STALL响应,表示数据没有准备好,否则进入步骤2;Step 1: Judgment of ready to receive packets. If it is not turned to standby, stop sending directly and return a STALL response, indicating that the data is not ready, otherwise go to step 2;
步骤2,接收IN令牌包后,发送数据包,同时产生发送数据中断给CPU;Step 2, after receiving the IN token packet, send the data packet, and generate a data sending interrupt to the CPU at the same time;
步骤3,IN事务结束。Step 3, the IN transaction ends.
在本发明实施例中,该控制器的状态受物理层接口信号主要是DP/DM信号的控制,表示为两种状态,K状态和J状态;该状态由UTMI信号接口的linestate表示,具体如下:assign j=linestate[1]&~linestate[0];assign k=~linestate[1]&linestate[0]。图8是本发明实施例的初始化时复位的波形示意图,如图8所示,dm信号拉高,dp不变,经过SE0状态后dm信号拉高;图9是本发明实施例的EP0进行控制IN控制传输时的波形示意图,如图9所示,其中一个SETADDR的数据包如下:HOST端设置地址为5b,控制器回应令牌包为d2,CLK为1.5Mbps;图10是本发明实施例的EP4进行OUT传输时的波形示意图,如图10所示,数据长度为64。In the embodiment of the present invention, the state of the controller is mainly controlled by the physical layer interface signal DP/DM signal, which is expressed as two states, K state and J state; the state is represented by the linestate of the UTMI signal interface, specifically as follows : assign j = linestate[1] &~linestate[0]; assign k = ~linestate[1] & linestate[0]. Fig. 8 is a schematic diagram of the reset waveform during initialization of the embodiment of the present invention. As shown in Fig. 8, the dm signal is pulled high, and dp remains unchanged. After the SE0 state, the dm signal is pulled high; Fig. 9 is the control of EP0 in the embodiment of the present invention The schematic diagram of the waveform during IN control transmission is shown in Figure 9. One of the SETADDR data packets is as follows: the HOST end sets the address to 5b, the controller responds to the token packet as d2, and the CLK is 1.5Mbps; Figure 10 is an embodiment of the present invention The waveform diagram of EP4 performing OUT transmission is shown in Figure 10, and the data length is 64.
综上所述,借助于本发明实施例的技术方案,通过去除控制器中对全速和高速的控制,解决了现有技术中由于USB LS的控制与全速和高速的控制在一起完成而导致的USBLS的设备浪费了大量的设计资源的问题,使原兼容USB低速的USB装置仅支持USB低速的外设功能,控制器的面积减少了50%,并按照USB的协议要求正确实现了物理层之间的接口通信传输及传输中通道的检测握手。To sum up, with the help of the technical solution of the embodiment of the present invention, by removing the control of full speed and high speed in the controller, the problem caused by the completion of USB LS control and full speed and high speed control in the prior art is solved. USBLS equipment wastes a lot of design resources, so that the original USB low-speed compatible USB device only supports USB low-speed peripheral functions, the area of the controller is reduced by 50%, and the physical layer is correctly implemented according to the USB protocol requirements. Inter-interface communication transmission and channel detection handshake during transmission.
装置实施例Device embodiment
根据本发明的实施例,提供了一种控制器,用于控制USB低速设备的数据传输,图11是本发明实施例的控制器的结构示意图,如图11所示,根据本发明实施例的控制器包括:检测模块110、复位模块112、以及传输模块114,以下对本发明实施例的各个模块进行详细的说明。According to an embodiment of the present invention, a controller is provided for controlling data transmission of a USB low-speed device. FIG. 11 is a schematic structural diagram of a controller according to an embodiment of the present invention. As shown in FIG. 11, the The controller includes: a detection module 110, a reset module 112, and a transmission module 114, each module of the embodiment of the present invention will be described in detail below.
检测模块110,用于在传输开始时,检测USB低速设备的D+信号线和D-信号线,如果D+信号线和D-信号线均处于空闲状态,则拉高D+信号线;The detection module 110 is used to detect the D+ signal line and the D-signal line of the USB low-speed device at the beginning of the transmission, and if the D+ signal line and the D-signal line are in an idle state, then pull the D+ signal line high;
复位模块112,用于在主机侧将D+信号线拉低后,直接进入复位状态,并拉高D+信号线;The reset module 112 is used to directly enter the reset state after pulling the D+ signal line low on the host side, and pull the D+ signal line high;
传输模块114,用于在主机侧复位完成后,控制数据传输通道EP并与主机侧进行数据传输,在传输结束后,将D+信号线和D-信号线均设置为空闲状态。The transmission module 114 is used to control the data transmission channel EP and perform data transmission with the host side after the reset of the host side is completed, and set the D+ signal line and the D- signal line to an idle state after the transmission is completed.
传输模块114具体包括:The transmission module 114 specifically includes:
第一判断子模块,用于判断EP是否准备好接收令牌包,如果判断为是,则调用更新子模块,如果判断为否,则将EP设置为空闲状态;The first judging submodule is used to judge whether the EP is ready to receive the token packet, if it is judged to be yes, then call the update submodule, if it is judged to be no, then the EP is set to idle state;
更新子模块,用于更新EP的先入先出队列FIFO中存储的数据;The update submodule is used to update the data stored in the first-in-first-out queue FIFO of the EP;
接收子模块,用于接收令牌包;The receiving submodule is used to receive the token packet;
第一处理子模块,用于对令牌包进行译码解析;The first processing sub-module is used to decode and analyze the token packet;
第二判断子模块,用于根据第一处理子模块的处理结果判断令牌包是否携带有数据包,如果判断为是,调用第二处理子模块,否则,调用第三处理子模块;The second judging submodule is used to judge whether the token packet carries a data packet according to the processing result of the first processing submodule, if it is judged to be yes, call the second processing submodule, otherwise, call the third processing submodule;
第二处理子模块,用于处理令牌包,返回正确的响应,并将EP设置为空闲状态;The second processing submodule is used to process the token packet, return a correct response, and set the EP to an idle state;
第三处理子模块,用于处理令牌包,如果令牌包为IN事务传输令牌,则将EP设置为发送状态;如果令牌包为OUT事务传输令牌,则将EP设置为接收状态。The third processing submodule is used to process the token package, if the token package is an IN transaction transmission token, the EP is set to the sending state; if the token package is an OUT transaction transmission token, the EP is set to the receiving state .
第三判断子模块,用于在EP为发送状态时,判断EP是否准备好发送数据包,如果判断为是,则调用第一发送子模块,否则,结束发送,并通知主机侧;The third judging submodule is used to judge whether the EP is ready to send data packets when the EP is in the sending state, and if it is judged to be yes, then call the first sending submodule, otherwise, end sending and notify the host side;
第一发送子模块,用于接收OUT令牌包,并发送数据包,同时产生发送数据中断给主机侧。The first sending sub-module is used to receive the OUT token packet, send the data packet, and generate a data sending interrupt to the host side at the same time.
第四判断子模块,用于在EP为接收状态时,判断EP是否准备好接收数据包,如果判断为是,则调用第二发送子模块,否则,结束接收,并通知主机侧;The fourth judging submodule is used to judge whether the EP is ready to receive the data packet when the EP is in the receiving state, if it is judged to be yes, then call the second sending submodule, otherwise, end the receiving, and notify the host side;
第二发送子模块,用于接收IN令牌包,并发送数据包,同时产生发送数据中断给主机侧。The second sending sub-module is used to receive the IN token packet, send the data packet, and generate a data sending interrupt to the host side at the same time.
优选地,在本发明实施例中,控制器进一步包括:Preferably, in the embodiment of the present invention, the controller further includes:
配置模块,用于配置EP的数目,以及各个EP的先入先出队列的大小;The configuration module is used to configure the number of EPs and the size of the first-in-first-out queue of each EP;
纠错模块,用于自动探测数据传输过程中的错误,通知主机侧并产生中断;An error correction module is used to automatically detect errors in the data transmission process, notify the host side and generate an interruption;
暂停模块,用于在数据传输停止预定时间后,产生暂停中断,进入暂停模式,并通过暂停信号通知物理层进入暂停模式,在检测到唤醒信号或复位信号后,退出暂停模式,并通知物理层退出暂停模式。The suspend module is used to generate a suspend interrupt after the data transmission stops for a predetermined time, enter the suspend mode, and notify the physical layer to enter the suspend mode through the suspend signal, and exit the suspend mode after detecting the wake-up signal or reset signal, and notify the physical layer Exit suspend mode.
从上述处理可以看出,在本发明实施例中,控制器通过UTMI接口和物理层进行数据交换,同步控制器的PHY的时钟域,这样控制器内部就可以工作在总线时钟下,而不需要和PHY保持一致;图3是本发明实施例的USB2.0 LS外设验证环境搭建时的一种可借鉴方案的连接示意图,如图3所示,在控制器与PHY连接时,只需要把图3中的MiniAB接口换成HOST的VIP接口,在控制器端通过总线接口(AHB接口)和CPU相连接即可。As can be seen from the above processing, in the embodiment of the present invention, the controller performs data exchange through the UTMI interface and the physical layer, and synchronizes the clock domain of the PHY of the controller, so that the inside of the controller can work under the bus clock without the need to It is consistent with the PHY; Fig. 3 is a connection schematic diagram of a reference scheme when the USB2.0 LS peripheral verification environment of the embodiment of the present invention is set up. As shown in Fig. 3, when the controller is connected to the PHY, only the The MiniAB interface in Figure 3 is replaced by the VIP interface of the HOST, and the controller can be connected to the CPU through the bus interface (AHB interface).
本发明实施例的控制器装置能够编码、译码、纠错和控制所有发送和接收到的USB数据包,IN传输的控制数据流通过外设的发送FIFO进行,OUT传输的控制数据流通过外设的接收FIFO进行;本发明实施例的控制器支持动态FIFO。The controller device in the embodiment of the present invention can encode, decode, correct errors and control all sent and received USB data packets. The control data flow transmitted by IN is carried out through the sending FIFO of the peripheral device, and the control data flow transmitted by OUT is carried out by the external device. The receiving FIFO is set; the controller of the embodiment of the present invention supports dynamic FIFO.
此外,本发明实施例支持可配置的EP数目,EP数目是0~4,均可按照传输要求配置,例如:对于BULK OUT操作EP可设置为RX endpoint,对于 BULKIN操作EP可设置为TXendpoint;另外,EP的FIFO可以配置为不同的大小,满足不同传输的要求,是传输能力多样化;能够接受主机(HOST)方发出的SOF包,并产生SOF中断;并在数据传输中产生相应的控制中断。In addition, the embodiment of the present invention supports a configurable number of EPs. The number of EPs is 0~4, which can be configured according to the transmission requirements. For example, for BULK OUT operation, EP can be set as RX endpoint, and for BULKIN operation, EP can be set as TXendpoint; in addition , EP's FIFO can be configured in different sizes to meet different transmission requirements, and the transmission capability is diversified; it can accept SOF packets sent by the host (HOST), and generate SOF interrupts; and generate corresponding control interrupts during data transmission .
本发明实施例的控制器还支持DEVICE模式的暂停(SUSPEND)操作,例如,当USB上没有数据传输3ms时,控制器可以产生SUSPEND中断,进入SUSPEND模式,在该模式下,控制器通过SUSPEND信号通知PHY进入SUSPEND模式,此时PHY时钟关断,直到总线上监测到唤醒或者复位信号,控制器退出SUSPEND并通过SUSPEND信号通知PHY,PHY退出SUSPEND状态。The controller of the embodiment of the present invention also supports the suspend (SUSPEND) operation in DEVICE mode. For example, when there is no data transmission on the USB for 3ms, the controller can generate a SUSPEND interrupt and enter the SUSPEND mode. In this mode, the controller passes the SUSPEND signal Notify the PHY to enter the SUSPEND mode. At this time, the PHY clock is turned off until the wake-up or reset signal is detected on the bus. The controller exits SUSPEND and notifies the PHY through the SUSPEND signal, and the PHY exits the SUSPEND state.
本发明实施例的控制器还支持数据的循环冗余校验(Cyclic RedundancyCheck,简称为CRC),具有数据纠错能力,能够自动探测USB传输过程中的协议错误,并返回STALL包,并产生中断,当CPU接收到该中断时,可以终止当前传输,清除STALL的中断位,控制器自动返回IDLE状态。The controller in the embodiment of the present invention also supports data cyclic redundancy check (Cyclic Redundancy Check, referred to as CRC), has data error correction capability, can automatically detect protocol errors in the USB transmission process, and returns STALL packets, and generates interrupts , when the CPU receives the interrupt, it can terminate the current transmission, clear the STALL interrupt bit, and the controller automatically returns to the IDLE state.
以下结合附图,以USB2.0版本为例,对本发明实施例的上述技术方案进行详细的说明。The above technical solution of the embodiment of the present invention will be described in detail below with reference to the accompanying drawings and taking the USB2.0 version as an example.
在现有技术中,针对低速装置,USB的控制器中的很多功能是不需要的,例如,HOST功能、高速部分、以及OTG功能等;本发明实施例为了实现对基于USB2.0低速装置的传输控制,保留了低速部分DEVICE的控制部分,以及CRC检验和协议判断的部分,去除了HOST功能,高速部分以及OTG的部分功能;本发明实施例的基本的控制状态机步骤如下(异常未列出):In the prior art, for low-speed devices, many functions in the USB controller are unnecessary, for example, HOST function, high-speed part, and OTG function; Transmission control retains the control part of the low-speed part DEVICE, and the part of CRC check and protocol judgment, removes the HOST function, high-speed part and some functions of OTG; the basic control state machine steps of the embodiment of the present invention are as follows (exception is not listed out):
步骤1、传输开始时,检测D+/D-信号线,如果二者处于空闲状态,发起SRP操作,即拉高D+线;等待HOST侧响应;Step 1. When the transmission starts, detect the D+/D- signal line. If the two are in an idle state, initiate an SRP operation, that is, pull the D+ line high; wait for the response from the HOST side;
步骤2、HOST侧将D+线拉低,表示被唤醒,DEVICE跳出SRP状态直接进入复位状态,拉高D+线;进入步骤3;Step 2. Pull the D+ line low on the HOST side, indicating that it is awakened. The DEVICE jumps out of the SRP state and enters the reset state directly, and pulls the D+ line high; enter step 3;
步骤3、在本状态中,FS和LS的复位是一致的,都是拉高D+线,HOST接收到复位信号后,开始复位操作,复位完成后,HOST开始进行数据包和命令信息的传输;进入步骤4;Step 3. In this state, the resets of FS and LS are consistent, and both pull the D+ line high. After HOST receives the reset signal, it starts the reset operation. After the reset is completed, HOST starts the transmission of data packets and command information; Go to step 4;
步骤4、在数据传输过程中,低速设备对于D+/D-线的状态判断与全速和高速相反,传统的控制器通过判断UTMI的信号linstate的状态区分全速和低速,本发明实施例不需要进行速度判断;Step 4. During data transmission, the state judgment of the low-speed device for the D+/D- line is opposite to full speed and high speed. The traditional controller distinguishes between full speed and low speed by judging the state of the UTMI signal linstate. Embodiments of the present invention do not need to perform Speed judgment;
步骤5、传输结束,回到IDLE状态,等待下一次传输。Step 5. After the transmission is completed, return to the IDLE state and wait for the next transmission.
通过上述控制器的主状态机的说明,可以看出本发明实施例去掉了大部分的控制状态和判断部分,达到了缩减电路资源的目的。Through the above description of the main state machine of the controller, it can be seen that most of the control state and judgment parts are removed in the embodiment of the present invention, and the purpose of reducing circuit resources is achieved.
基本的USB2.0控制器还需要完成对EP的控制,按照USB2.0协议,EP之间建立连接,形成数据传输的管道;本发明实施例在USB2.0的基础上提取USB的低速外设,并对内部状态机进行控制:包括主状态机,以控制USB装置的整体工作,完成对USB装置内部EP的控制。本发明实施例对于EP的控制采用单独的控制状态机,控制单个EP的数据通道,EP0是EP中比较特殊的一个,用来完成LINK UP等初始化的操作,以EP0的控制传输为例说明本装置对EP的控制过程;The basic USB2.0 controller also needs to complete the control of the EP. According to the USB2.0 protocol, a connection is established between the EPs to form a data transmission pipeline; the embodiment of the present invention extracts the low-speed peripherals of the USB on the basis of the USB2.0 , and control the internal state machine: including the main state machine to control the overall work of the USB device and complete the control of the internal EP of the USB device. The embodiment of the present invention adopts a separate control state machine for the control of EP, and controls the data channel of a single EP. EP0 is a special one in EP, which is used to complete initialization operations such as LINK UP. The control transmission of EP0 is used as an example to illustrate this The control process of the device to EP;
图4是本发明实施例的EP0的控制主状态转移的流程图,传统的USB控制器是软件通过读EP0状态寄存器,判断EP0是否处于空闲,如果是的话,可以挂起,或者发送SETUP令牌包;然后进入IDLE状态;本发明实施例也可以通过软件读EP0的状态,但不会发起SETUP令牌,因为命令令牌只能由HOST发出;本发明实施例的EP0直接处于IDLE状态;之后,传统的USB控制器是可以通过软件配置,使EP0进入发送或者接收模式;本发明实施例会等待接收HOST侧的令牌包,如果是IN操作,则EP进入发送状态,如果是OUT操作,则EP进入接收状态。Fig. 4 is the flow chart of the control main state transfer of EP0 of the embodiment of the present invention, traditional USB controller is that software reads EP0 status register, judges whether EP0 is idle, if so, can hang up, or sends SETUP token Then enter the IDLE state; the embodiment of the present invention can also read the state of EP0 by software, but can not initiate the SETUP token, because the command token can only be sent by HOST; the EP0 of the embodiment of the present invention is directly in the IDLE state; after that , the traditional USB controller can be configured by software to make EP0 enter the sending or receiving mode; the embodiment of the present invention will wait to receive the token packet from the HOST side. If it is an IN operation, EP will enter the sending state. If it is an OUT operation, then EP enters receiving state.
图5是本发明实施例的EP0为IDLE模式时的控制流程图,如图5所示,在本发明实施例中,当上电和复位时,EP进入IDLE模式;在主状态机中,当进行SETUP传输,即USB进行枚举状态时,进入IDLE模式;进入IDLE模式后,进行以下步骤:Fig. 5 is the control flowchart when EP0 of the embodiment of the present invention is IDLE mode, as shown in Fig. 5, in the embodiment of the present invention, when power-on and reset, EP enters IDLE mode; In main state machine, when Perform SETUP transmission, that is, when the USB is in the enumeration state, enter the IDLE mode; after entering the IDLE mode, perform the following steps:
步骤1,准备接收数据包或者令牌包,如果没有准备好,回到IDLE状态,转备好后,进入步骤2;Step 1, prepare to receive data packet or token packet, if not ready, return to IDLE state, after turning to standby, go to step 2;
步骤2,更新FIFO中存储的数据,接收命令;Step 2, update the data stored in the FIFO and receive the command;
步骤3,接收到命令后,进行译码,对命令进行解析,按照USB2.0的协议判断命令令牌是否带有数据包,如果不带有数据包进入步骤4,否则进入步骤5;Step 3, after receiving the command, decode and analyze the command, and judge whether the command token has a data packet according to the protocol of USB2.0, if there is no data packet, go to step 4, otherwise go to step 5;
步骤4,处理令牌包,设置数据,并返回正确的响应,回到IDLE状态;Step 4, process the token packet, set the data, and return the correct response, and return to the IDLE state;
步骤5,处理令牌包,设置数据;判断是否是IN事务传输令牌,是的话进入发送模式(图6),不是则进入步骤6;Step 5, process the token packet and set the data; judge whether it is an IN transaction transfer token, if yes, enter the sending mode (Figure 6), if not, enter step 6;
步骤6,进入OUT事务传输,进入接收模式(图7)。Step 6, enter the OUT transaction transmission, and enter the receiving mode (Figure 7).
图6是本发明实施例的EP0进入发送模式后的控制流程图,如图6所示,如果EP0为TX模式,传统USB控制器可以发送和接收OUT令牌包,本发明实施例只能够接收OUT令牌包;所有接收到的IN令牌包都会被当做数据处理,如果此时接收到SETUP命令或者OUT令牌包,会产生SETUPEND的条件,EP0退出TX模式,另外,如果传输的数据包的长度小于EP0配置的最大包长度,或者接收到空包,USB退出该状态;其它EP的TX模式与此类似,处理步骤如下:Fig. 6 is the control flowchart after EP0 enters the sending mode of the embodiment of the present invention, as shown in Fig. 6, if EP0 is TX mode, traditional USB controller can send and receive OUT token packet, the embodiment of the present invention can only receive OUT token packet; all received IN token packets will be treated as data. If the SETUP command or OUT token packet is received at this time, the SETUPEND condition will be generated, and EP0 will exit the TX mode. In addition, if the transmitted data packet The length of the EP0 is less than the maximum packet length configured by EP0, or the USB exits this state when an empty packet is received; the TX mode of other EPs is similar to this, and the processing steps are as follows:
步骤1,准备发送包判断,如果没有转备好,直接结束发送,返回STALL响应,表示数据没有准备好,否则进入步骤2;Step 1: Judgment of the ready-to-send packet. If it is not ready, end the sending directly and return a STALL response, indicating that the data is not ready, otherwise go to step 2;
步骤2,接收OUT令牌包,发送DATA0数据包,同时产生发送数据中断给CPU;Step 2, receive the OUT token packet, send the DATA0 data packet, and generate a data sending interrupt to the CPU at the same time;
步骤3,OUT事务结束。Step 3, the OUT transaction ends.
图7是本发明实施例的EP0进入接收模式后的控制流程图,如图7所示,EP0在RX模式是,传统USB控制器可以发送和接收IN令牌包,本发明实施例只能够接收IN令牌包;所有接收到的OUT令牌包都会被当做数据处理,如果接收到SETUP或者OUT令牌包,会产生SETUPEND条件,RX模式终止;另外如果主机端发送无效的令牌包或者空包,又或者发送的包长度小于最大包长度,也会产生SETUPEND条件;它EP的TX模式与此类似,处理 步骤如下:Fig. 7 is the control flow chart of the EPO of the embodiment of the present invention after entering the receiving mode, as shown in Fig. 7, when EPO is in the RX mode, the traditional USB controller can send and receive the IN token packet, but the embodiment of the present invention can only receive IN token packet; all received OUT token packets will be treated as data, if a SETUP or OUT token packet is received, a SETUPEND condition will be generated, and the RX mode will terminate; in addition, if the host sends an invalid token packet or an empty packet, or the length of the sent packet is less than the maximum packet length, the SETUPEND condition will also be generated; the TX mode of its EP is similar to this, and the processing steps are as follows:
步骤1,准备接收包判断,如果没有转备好,直接结束发送,返回STALL响应,表示数据没有准备好,否则进入步骤2;Step 1: Judgment of ready to receive packets. If it is not turned to standby, stop sending directly and return a STALL response, indicating that the data is not ready, otherwise go to step 2;
步骤2,接收IN令牌包后,发送数据包,同时产生发送数据中断给CPU;Step 2, after receiving the IN token packet, send the data packet, and generate a data sending interrupt to the CPU at the same time;
步骤3,IN事务结束。Step 3, the IN transaction ends.
在本发明实施例中,该控制器的状态受物理层接口信号主要是DP/DM信号的控制,表示为两种状态,K状态和J状态;该状态由UTMI信号接口的linestate表示,具体如下:assign j=linestate[1] &~linestate[0];assign k=~linestate[1]&linestate[0]。图8是本发明实施例的初始化时复位的波形示意图,如图8所示,dm信号拉高,dp不变,经过SE0状态后dm信号拉高;图9是本发明实施例的EP0进行控制IN控制传输时的波形示意图,如图9所示,其中一个SETADDR的数据包如下:HOST端设置地址为5b,控制器回应令牌包为d2,CLK为1.5Mbps;图10是本发明实施例的EP4进行OUT传输时的波形示意图,如图10所示,数据长度为64。In the embodiment of the present invention, the state of the controller is mainly controlled by the physical layer interface signal DP/DM signal, which is expressed as two states, K state and J state; the state is represented by the linestate of the UTMI signal interface, specifically as follows : assign j=linestate[1] &~linestate[0]; assign k=~linestate[1]&linestate[0]. Fig. 8 is a schematic diagram of the reset waveform during initialization of the embodiment of the present invention. As shown in Fig. 8, the dm signal is pulled high, and dp remains unchanged. After the SE0 state, the dm signal is pulled high; Fig. 9 is the control of EP0 in the embodiment of the present invention The schematic diagram of the waveform during IN control transmission is shown in Figure 9. One of the SETADDR data packets is as follows: the HOST end sets the address to 5b, the controller responds to the token packet as d2, and the CLK is 1.5Mbps; Figure 10 is an embodiment of the present invention The waveform diagram of EP4 performing OUT transmission is shown in Figure 10, and the data length is 64.
综上所述,借助于本发明实施例的技术方案,通过去除控制器中对全速和高速的控制,解决了现有技术中由于USB LS的控制与全速和高速的控制在一起完成而导致的USBLS的设备浪费了大量的设计资源的问题,使原兼容USB低速的USB装置仅支持USB低速的外设功能,控制器的面积减少了50%,并按照USB的协议要求正确实现了物理层之间的接口通信传输及传输中通道的检测握手。To sum up, with the help of the technical solution of the embodiment of the present invention, by removing the control of full speed and high speed in the controller, the problem caused by the completion of USB LS control and full speed and high speed control in the prior art is solved. USBLS equipment wastes a lot of design resources, so that the original USB low-speed compatible USB device only supports USB low-speed peripheral functions, the area of the controller is reduced by 50%, and the physical layer is correctly implemented according to the USB protocol requirements. Inter-interface communication transmission and channel detection handshake during transmission.
在此提供的算法和显示不与任何特定计算机、虚拟系统或者其它设备固有相关。各种通用系统也可以与基于在此的示教一起使用。根据上面的描述,构造这类系统所要求的结构是显而易见的。此外,本发明也不针对任何特定编程语言。应当明白,可以利用各种编程语言实现在此描述的本发明的内容,并且上面对特定语言所做的描述是为了披露本发明的最佳实施方式。The algorithms and displays presented herein are not inherently related to any particular computer, virtual system, or other device. Various generic systems can also be used with the teachings based on this. The structure required to construct such a system is apparent from the above description. Furthermore, the present invention is not specific to any particular programming language. It should be understood that various programming languages can be used to implement the content of the present invention described herein, and the above description of specific languages is for disclosing the best mode of the present invention.
在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure the understanding of this description.
类似地,应当理解,为了精简本公开并帮助理解各个发明方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, in order to streamline this disclosure and to facilitate an understanding of one or more of the various inventive aspects, various features of the invention are sometimes grouped together in a single embodiment, figure, or its description. This method of disclosure, however, is not to be interpreted as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the Detailed Description are hereby expressly incorporated into this Detailed Description, with each claim standing on its own as a separate embodiment of this invention.
本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。Those skilled in the art can understand that the modules in the device in the embodiment can be adaptively changed and arranged in one or more devices different from the embodiment. Modules or units or components in the embodiments may be combined into one module or unit or component, and furthermore may be divided into a plurality of sub-modules or sub-units or sub-assemblies. All features disclosed in this specification (including accompanying claims, abstract and drawings), as well as any method or method so disclosed, may be used in any combination, except that at least some of such features and/or processes or units are mutually exclusive. All processes or units of equipment are combined. Each feature disclosed in this specification (including accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。例如,在下面的权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。Furthermore, those skilled in the art will understand that although some embodiments described herein include some features included in other embodiments but not others, combinations of features from different embodiments are meant to be within the scope of the invention. and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的控制器中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。The various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art should understand that a microprocessor or a digital signal processor (DSP) may be used in practice to implement some or all functions of some or all components in the controller according to the embodiments of the present invention. The present invention can also be implemented as an apparatus or an apparatus program (for example, a computer program and a computer program product) for performing a part or all of the methods described herein. Such a program for realizing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet site, or provided on a carrier signal, or provided in any other form.
应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means can be embodied by one and the same item of hardware. The use of the words first, second, and third, etc. does not indicate any order. These words can be interpreted as names.
Claims (10)
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210453547.8A CN103810127B (en) | 2012-11-13 | 2012-11-13 | USB low-speed devices data transfer control method and controller |
PCT/CN2013/085995 WO2014075545A1 (en) | 2012-11-13 | 2013-10-25 | Data transmission control method of low-speed usb device and controller |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210453547.8A CN103810127B (en) | 2012-11-13 | 2012-11-13 | USB low-speed devices data transfer control method and controller |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103810127A CN103810127A (en) | 2014-05-21 |
CN103810127B true CN103810127B (en) | 2017-09-08 |
Family
ID=50706919
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201210453547.8A Expired - Fee Related CN103810127B (en) | 2012-11-13 | 2012-11-13 | USB low-speed devices data transfer control method and controller |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN103810127B (en) |
WO (1) | WO2014075545A1 (en) |
Families Citing this family (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106294248A (en) * | 2015-05-19 | 2017-01-04 | 深圳市超越自然多媒体有限公司 | A kind of for the control method between smart machine and USB sound card |
CN106294265A (en) * | 2015-05-19 | 2017-01-04 | 深圳市超越自然多媒体有限公司 | A kind of audio data transmission method between USB sound card and smart machine |
CN106293594A (en) * | 2015-05-19 | 2017-01-04 | 深圳市超越自然多媒体有限公司 | A kind of audio data transmission method for USB sound card |
CN105701049B (en) * | 2016-03-23 | 2019-03-01 | Oppo广东移动通信有限公司 | System, method and device for writing in charging zone bit and mobile terminal |
CN114244485B (en) * | 2021-12-03 | 2023-06-09 | 威创集团股份有限公司 | Data management method for USB signal long-distance transmission |
CN114356815B (en) * | 2021-12-09 | 2024-12-03 | 青岛信芯微电子科技股份有限公司 | USB controller, chip, display device and control method |
CN114564099B (en) * | 2022-01-20 | 2024-06-04 | 珠海亿智电子科技有限公司 | Method for reducing USB transmission power consumption and electronic device |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1650249A (en) * | 2002-12-27 | 2005-08-03 | 富士通株式会社 | USB device and USB device control method |
CN101256452A (en) * | 2007-03-01 | 2008-09-03 | 昆盈企业股份有限公司 | USB input device and method for expanding bandwidth thereof |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TWM240048U (en) * | 2002-01-16 | 2004-08-01 | Elan Microelectronics Corp | USB interface controller chip |
CN1459695A (en) * | 2002-05-15 | 2003-12-03 | 义隆电子股份有限公司 | USB interface controller chip |
DE10239814B4 (en) * | 2002-08-29 | 2008-06-05 | Advanced Micro Devices, Inc., Sunnyvale | Extended test mode support for host controllers |
CN100533419C (en) * | 2007-03-13 | 2009-08-26 | 威盛电子股份有限公司 | USB peripheral device and mode detection method thereof |
CN101339542B (en) * | 2008-06-04 | 2012-08-29 | 炬才微电子(深圳)有限公司 | Data transmission device, control circuit chip and operation mode control method |
CN101520767B (en) * | 2009-04-07 | 2011-02-09 | 上海炬力集成电路设计有限公司 | Data transmission speed self-adapting method and device |
-
2012
- 2012-11-13 CN CN201210453547.8A patent/CN103810127B/en not_active Expired - Fee Related
-
2013
- 2013-10-25 WO PCT/CN2013/085995 patent/WO2014075545A1/en active Application Filing
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1650249A (en) * | 2002-12-27 | 2005-08-03 | 富士通株式会社 | USB device and USB device control method |
CN101256452A (en) * | 2007-03-01 | 2008-09-03 | 昆盈企业股份有限公司 | USB input device and method for expanding bandwidth thereof |
Non-Patent Citations (2)
Title |
---|
USB2.0主机控制器内核SIE的设计;张爱丽;《中国优秀硕士学位论文全文数据库》;20071231(第5期);文献14-26、28-31页 * |
USB电气特性;陈启美等;《电力自动化设备》;20010930;第21卷(第9期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN103810127A (en) | 2014-05-21 |
WO2014075545A1 (en) | 2014-05-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103810127B (en) | USB low-speed devices data transfer control method and controller | |
US10268261B2 (en) | Methods and apparatus for managing power with an inter-processor communication link between independently operable processors | |
US7028109B2 (en) | Data transfer control device including buffer controller with plurality of pipe regions allocated to plurality of endpoints | |
US7349973B2 (en) | Data transfer control device, electronic equipment, and data transfer control method | |
CN103914424B (en) | LPC peripheral expansion method based on GPIO interface and device | |
US8799532B2 (en) | High speed USB hub with full speed to high speed transaction translator | |
US10831700B2 (en) | Methods and apparatus for reducing power consumption within embedded systems | |
CN112639755B (en) | Slave-to-slave direct communication | |
CN101087235A (en) | A FPGA-based multi-functional communication interface conversion device and method | |
JP2004334417A (en) | Data transfer control device, electronic device, and data transfer control method | |
US7337382B2 (en) | Data transfer control device, electronic instrument, and data transfer control method | |
CN106933760A (en) | A kind of dma controller and data uploading method based on AXI protocol | |
US7409471B2 (en) | Data transfer control device for data transfer over a bus, electronic equipment and method for data transfer over a bus | |
CN101000593A (en) | Device and method for implementing communication between processes | |
US7469304B2 (en) | Data transfer control device, electronic equipment, and method for a data transfer through a bus, the data transfer control device including a register and a packet buffer that are commonly used during a host operation and a peripheral operation | |
US7359996B2 (en) | Data transfer control device, electronic equipment, and data transfer control method | |
CN105718396B (en) | A kind of I of big data master transmissions2C bus units and its means of communication | |
US7428600B2 (en) | Data transfer control device, electronic equipment, and data transfer control method | |
CN106372019B (en) | A system bus device response timeout processing method and timeout processing device | |
TWI316662B (en) | Computer system with non-support hyper-transport processor and controlling method of hyper-transport bus thereof | |
McDowell et al. | USB explained | |
JP4127071B2 (en) | Data transfer control device, electronic device, and data transfer control method | |
CN205318375U (en) | A kind of I2C bus transmission device | |
TW591523B (en) | Virtual input/output device connected to a memory controller | |
CN111639049A (en) | Two-way handshake communication circuit and method between single-chip microcomputers |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
EE01 | Entry into force of recordation of patent licensing contract | ||
EE01 | Entry into force of recordation of patent licensing contract |
Application publication date: 20140521 Assignee: Xi'an Chris Semiconductor Technology Co.,Ltd. Assignor: SANECHIPS TECHNOLOGY Co.,Ltd. Contract record no.: 2019440020036 Denomination of invention: Data transmission control method and controller for USB (universal serial bus) low-speed device Granted publication date: 20170908 License type: Common License Record date: 20190619 |
|
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20170908 Termination date: 20211113 |