Design of USB/PS2 MOUSE using 4BIT OTP microcontroller

Publisher:翠绿山水Latest update time:2006-07-06 Source: E代电子Keywords:resistor  usb  device  pc Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  Introduction:

The design of   USB low-speed devices has reached considerable maturity. Various IC companies have launched USB DEVICE-side solutions, generally using 8 BIT CPU CORE + USB SIE as the mainstream architecture. SH69P04 is a 4BIT OTP microcontroller designed by Sinowealth to enrich USB product applications and reduce USB IC costs. It is used to develop USB DEVICE devices.

  SH69P04 functions and features

  

                    Figure 1 
  As shown in Figure 1, SH69P04 integrates USB SIE and supports USB and PS2 port multiplexing. The built-in 1.5K controllable pull-up resistor saves costs for users and can establish stable communication with the PC. I/O port specially designed for MOUSE. The dual CLOCK system makes the IC consume less power and easily meets the USB-IF requirements for SUSPEND current. 8K×16 BIT OTP ROM, convenient for user development. It can support a maximum of 40×8 LCD display or 31 I/Os to meet various user applications. In addition, it also has built-in Watch Dog and Low Power Detect functions.

  1. USB and PS2 ports are shared

  Switching between USB port and PS2 port through register

  

  PS2PU = 1: If PS2IS = 1, the internal PS2 dedicated pull-up resistor takes effect. When the USB port needs to be used, just set PS2IS = 0 to turn off the PS2 port and its pull-up resistor.

  

  2. 1.5KΩ controllable pull-up resistor

  As shown in Figure 2, with this 1.5KΩ controllable pull-up resistor, on the one hand, it can save costs, and on the other hand, it can achieve soft switching to ensure that the PC recognizes DEVICE.

  When the USB DEVICE is connected to the PC, the internal 1.5KΩ pull-up resistor is not turned on, so the PC does not think that a new device is connected. Users can safely complete program initialization and other client programs before turning on the pull-up resistor, without having to worry about responding to signals on the USB bus in time. This is because if there is no controllable pull-up resistor but is directly added, then when the DEVICE is connected to the PC, the PC will immediately know that a new device is connected, and will send a signal to the DEVICE after a certain period of time. If the DEVICE continues for several If the communication fails, the PC will think that the DEVICE has an error and will no longer communicate with it.

  In addition, combining with Watch Dog can further ensure the connection of DEVICE. Users can calculate the time required for the entire USB initialization process in advance and set up Watch Dog. In the event of a USB initialization error, a Watch Dog Reset will occur, the 1.5KΩ pull-up will be turned off, and the program will restart. The PC will think that the DEVICE has a plug and unplug action. Program deadlocks can also be solved using this method.

  

                     Figure 3
  3. The I/O port specially designed for MOUSE

  
is shown in Figure 3. During the principle analysis, Q1.1 and Q1.3 output square waves. In fact, since Photo Transistors use phototransistors, when the grating rotates, the light received by the phototransistors also changes continuously, so the output waveform also changes continuously. And because the grating cannot completely block the light, an OFFSET level will be generated. The actual waveform is shown in Figure 4.

  

  VIH in the figure indicates that once the input level is higher than VIH, the MCU considers it to be a high level. VIL means that once the input level is lower than VIL, the MCU considers it to be a low level. In this state shown in Figure 4, the MCU can easily read the grating rotation. However, due to interference or component aging, the OFFSET level changes, making the input signal level unable to intersect with VIH and VIL (as shown in Figure 5). The MCU will think that the input signal is always high or always low.

  

  SH69P04 provides three levels of pull-down resistors (as shown in Figure 4) for each MOUSE port to control the OFFSET level. The resistance value of the pull-down resistor is selected through the register to solve errors caused by changes in the OFFSET level.

  software design

  Although the USB protocol is very complex, the programs that need to be written on the MOUSE side are very limited. Users can easily establish contact with the PC. (Windows HID driver is provided by the operating system)

  1. USB/PS2 port monitoring

  Step 1: Power on, delay 50ms Step 2: Monitor the level of D- within 2ms. If it is high level 4 times, it is the PS2 interface. Otherwise, go to step 3. Step 3: Turn on the USB pull-up resistor, delay500us, and repeatedly monitor the levels of D+ and D- until one of them appears high level. If D+ is high level, it is the PS2 interface. If D- is low, go to step 4. Step 4: Turn off the USB pull-up resistor, delay 100us. If D+/D- are both low level, it is a USB interface.

  Otherwise it's the PS2 interface.

  2. USB Enumeration Process

  The whole process is a bit like taking a test. PC asked, MOUSE answered. The key is to tell the PC that it is a MOUSE and supports the HID protocol. Due to limited space, they will not be listed in detail.

  3. Send MOUSE information to PC

  During the Enumeration process, MOUSE will tell the PC the format of subsequent X, Y, Z, and key press information. When MOUSE takes action, it only needs to return the data to the PC in this format. The PC HID driver will do the rest.

Keywords:resistor  usb  device  pc Reference address:Design of USB/PS2 MOUSE using 4BIT OTP microcontroller

Previous article:Design of USB/PS2 MOUSE using 4BIT OTP microcontroller
Next article:High-precision frequency regulator based on AVR microcontroller

Recommended ReadingLatest update time:2024-11-16 19:40

From PC bus to ARM internal bus
When I was studying Chapter 9 and Hardware Communication in "Linux Device Drivers (3rd Edition)", I was not very clear about the concept of IO bus, so I looked for relevant information. Now I summarize it as follows: References for this article: 1. "Introduction to AMBA, AHB, APB Buses" Author: adamzhao Date: 2006-11
[Microcontroller]
Realization of Command Batch Processing in Serial Communication between PC and Single Chip Microcomputer
When the PC and the MCS-51 microcontroller communicate serially, it is basically one-to-one, that is, when the PC sends a command to the microcontroller, it waits for a response from the microcontroller. This may waste a lot of time in the communication process between the PC and the microcontroller. For this reason, t
[Microcontroller]
Realization of Command Batch Processing in Serial Communication between PC and Single Chip Microcomputer
STM32 USB Learning Notes 5
Host environment: Windows 7 SP1 Development environment: MDK5.14 Target board: STM32F103C8T6 Development library: STM32F1Cube library and STM32_USB_Device_Library Following the previous article, for the upper-layer application, only the CDC class interface file, usbd_cdc_interface, is left. This file is mainly
[Microcontroller]
STM32 USB Learning Notes 5
Embedded USB image acquisition and display solution based on ARM
  introduction   At present, most of the image acquisition and processing systems on the market are based on DSP chips. Such image acquisition and processing systems are not suitable for some simple applications due to their high cost, high power consumption, and volume constraints. With the popularity of USB cameras
[Microcontroller]
Embedded USB image acquisition and display solution based on ARM
USB-C: The Evolution of Power Standards for Portable Smart Devices
Translated from - electronicspoint   USB-C charging has become the charging standard on all premium smartphones, but not so much on more budget models. But the European Union is moving forward with a regulation that will force all portable smart devices to use USB-C as the standard for both power and data connections.
[Internet of Things]
USB-C: The Evolution of Power Standards for Portable Smart Devices
The evolution and survival of PC
Preface Back on January 27, 2010, a very great thinker declared the death of the PC (personal computer). Ten years later, the PC is still alive and well, although a time traveler from 2010 would not recognize it. This is undoubtedly how this "endangered species" evolves and survives.   text   It wasn’t that long ago
[Embedded]
The evolution and survival of PC
Circuit design of car USB charger with line compensation function
  With the popularity of smartphones and tablets and the high power consumption that comes with them, the batteries of such devices can only last for one day of use. More and more occasions and devices are equipped with one or more USB charging ports, and car USB chargers are an important part of them. Due to the larg
[Power Management]
Circuit design of car USB charger with line compensation function
Design Considerations for USB 3.0 Interface Applications
USB 3.0 is gradually becoming one of the most promising data transmission interfaces. Compared with USB 2.0, USB 3.0 is 10 times faster, up to 5.0Gbps; provides an asynchronous mechanism to send and receive data synchronously; and provides a power output of up to 900mA. New applications such as 3D cameras across lapto
[Power Management]
Design Considerations for USB 3.0 Interface Applications
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号