The reason why I first wanted to learn about USB was that I wanted to have a universal programmer very much at the time. Although the commercial programmer had good functions, it was expensive, it seems a pity to buy one just for programming several chips (I have already bought the programmer :)). So I want to make a simple one by myself, using serial ports? Parallel? I don't like the idea of adding a big, stupid external power source. It's good to use USB, and there is a bus power supply. This is very attractive. At that time, I knew nothing about USB, so let's look for information.
At that time, USB technology was just emerging, and USB devices were still rare in the electronics market. After several days on the internet, I decided to use PDIUSBD12 of Philips as the USB controller, the main reason is that the technical documentation provided by Philips is detailed. After reading the relevant information of Philips, it seems that the hardware circuit is not difficult, so I drew a schematic and checked it n times. It should be okay. Then I made a PCB and made preliminary hardware debugging, everything went smoothly. The next step is to consider how to write the software. When it comes to software, it's big. I read the PDIUSBD12 data manual for a few days. Oh, my God, what are so many strange registers. It seems that PDIUSBD12 cannot be programmed without understanding the USB protocol. So I had to go over the USB specification,
The English version of more than 200 pages is not as good as the 74 series of manuals. Fortunately, my professional English is not too bad. At that time, I saw it for nearly a month. It was like entering the maze, and I couldn't figure it out. At that time, the bookstore had only one USB Bus Interface Development Guide for the National Defense University of Science and Technology. After I bought it, I checked it carefully. It was a Simplified Chinese version of the USB specification, some of the English terms I translated are uncomfortable, and many parts are omitted. I cannot read them, so I threw away the book, later, I could not say that the USB books are full of books, but I think the editors of the book do know much about USB, some Editors/translators of most other books can
Pullup resistor of collector is translated into "upward resistance Collector". Hey hey, I won't say much). Continue to study E. At that time, another friend, under my strong advocacy, studied with great enthusiasm for many days and nights with me. Unfortunately, he did not finalize the results later :). At that time, although there were a lot of doctoral professors around, but no one had studied USB, so they had to install the Hound's nose and search around the Internet. There were some clues, but they were not very useful.
At this time, a netizen gave me a piece of the H5 firmware code of Philips. I was overjoyed and excited to compile the code. Every day, there were countless errors. I tried to solve the problem and found that the source file was incomplete and there were very few comments. I tried to complete the code a little bit. During this period, I combined the Code with the USB specification, the program was finally compiled after several months of experience. When I trembling my hand and plugged my board into the USB cable, the miracle turned out to be, after a burst of hard drive, Windows suddenly found a dialog basket of new hardware. My God! I have succeeded !! Joy is not over yet. I have installed the Philips driver. I want to see the switch on my board and the motion of the lamp. Only then can I find that my hardware is not exactly the same as that of Philips, therefore, it is not fully compatible with Philips applications. Even if the driver is installed, the lights and switches on the Board cannot be controlled. It seems that you have to change the program.
This change program only knows that I am only a little bit familiar with the USB protocol. After I make changes according to my own understanding, the PC cannot identify my device correctly. Then I understand that without understanding the USB protocol, I will not write my own programs, let alone develop USB interface products. Fortunately, this period of time has gained some experience and some basic and correct understanding of USB, And I am inspired by it. So I continue to study the USB e specification. One month has passed, and another month has passed. Although I have understood a lot, I still haven't fully understood some key points. It seems that I only have a thin layer of translucent paper, as long as someone clicks it, it will give you an epiphany. Unfortunately, the fairy did not appear, so my program is always faulty. At this time, I am a little desperate, and USB development is temporarily put on hold.
Soon I went to a company to work on USB and came into contact with a Soc USB program design. The pressure of survival forced me to overcome the psychological fear of USB communication, and carefully studied the USB Protocol. At this time, the relevant USB information is gradually enriched, now, I have a logical analyzer, high-end oscilloscope, and other devices at hand. I even used a logical analyzer to carefully capture the physical process implemented by the USB communication protocol, also, the behavior simulation model of USB Host written by Using OpenGL is provided for FPGA system simulation. Two months later, I finally had a qualitative leap in understanding USB, and I was very familiar with the USB data transmission process, and I was very familiar with the SOC, I can use less than 600 bytes of code to make the PC discover new hardware.
Later, I picked up the previous PDIUSBD12 USB board and completely re-designed the program based on my understanding of USB. This time it went very smoothly, it is easy to complete the USB device enumeration process for PC hosts. However, to completely complete the design of a USB device, this is just the first phase, the next hard process is the design of the driver, no driver, using PC software to control USB devices is simply a theme. At first, I used WinDriver for hardware diagnosis. After everything was OK, I could choose to use WinDriver to generate a driver and test platform application. However, the installation method of WinDriver driver made me feel awkward, I don't think this method should be used for a commercially available USB device. In addition, windriver502 seems to be in conflict with Xilinx's ise6.1 software. The Ise installation process is often blue screen, and the WinDriver of this version is in Win2k
The installation of Sp3 and above will inevitably lead to a black screen of the system. In addition, there is a driver development tool similar to the Professional-level DriverStudio. I have seen it for a while and I feel it looks completely different from Windows DDK, but in fact it does not make the DDK too strict encapsulation, we can see the shadows of DDK everywhere. Mastering DriverStudio also requires a lot of understanding of DDK. I chose Windows DDK as the driver design tool. Although I have not planned to become a professional driver designer, there is no harm in doing more in-depth troubleshooting. DDK has many driver examples, one of which is the bulkusb example. After reading it carefully, you can change it to the driver of your own device, this is exactly how Microsoft recommends driver designers to develop device drivers. DDK is indeed too broad and profound. I think it is enough to achieve the goal that the driver of the device can work normally. There is no need to figure out every detail in the driver program design. At that time, I also spent a lot of effort to achieve this goal, it is difficult for readers to experience it by themselves (You may say Microsoft is a very stable Win2k :)). Well, now is the last phase: design the application. This should be the easiest stage in the design. VC ++ is a good tool to control hardware devices through drivers. Of course, this is not an inevitable choice for everyone. When you write the last line of code, run the program, and see that the device is under your control at any time between the mouse and keyboard, that kind of sense of accomplishment is really hard to describe.
Now there are a lot of devices with USB interfaces, and many are already USB High Speed devices. I am fortunate to have seen many applications of USB devices. Whether it is USB full speed or high speed, whether the device is just a USB controller or a complex SoC, in fact, USB communication is similar. Now, after several years of silence, the usb otg technology has finally become a hotspot in the next phase of USB communication technology. There was also a type of USB host device, which makes up for the temporary gap between USB 1.1 and usb otg.
Maybe I have a poor understanding, and it is really difficult to learn about USB. Many friends may suffer the same pain as I did. I wrote out my USB learning experience, I hope to give some helpful inspiration to the later users, and I also hope to give you some encouragement: if you are willing to work hard, you can overcome the difficulties. USB communication is completely different from RS232 communication, to be able to read e-paper with a hard head, to have a friend who understands USB, to have a good reference code, to be willing to think, to have a strong interest and perseverance, in this way, even if the time is a little longer, you will be able to master the USB.
I don't want my experience to make friends who want to learn USB feel terrible. Before you learn USB, you should first set a standard to be met: if you want to be able to fully master the USB communication technology and design the USB physical and sie parts, then this is the highest level of the USB hardware design, however, it takes several years for an icdesign company to invest a certain amount of manpower. If you want to master Hardware/Firmware Programming and driver design, you need to prepare for a bitter time. If you do not need to care about the specific process of USB communication, it's just a simple data exchange between the firmware application and the underlying layer, or a PC application design. Congratulations, you will find that USB communication is actually very simple.