USB device and it's Programming

Thread Starter

champ1

Joined Jun 4, 2018
101
Hi there

I do not have clarity on USB protocol. I am looking information on USB device and it's Programming.

Let's consider one example if I want to make a communication between microcontroller and PC using USB protocol. so I have to access serial port via USB protocol. I do not have idea on the programming. so I did some homework and found that I will have to write code for both PC and Micro-controller. You I have gone through previous thread and found that it's not easy to develop your own firmware or PC drivers. It's okay I will not dare to develop PC driver

My question is regarding microcontroller programming Can any one tell me what is USB Protocol in the terms of programming

Thanks
champ
 

John P

Joined Oct 14, 2008
1,763
Most people will avoid doing their own programming of USB, and will buy an interface chip, like the well-known FTDI products. A chip like this communicates with the processor via a UART, and also looks like a UART at the computer side. If the stars align properly for you, it will install its own drivers, and leave you with simple interfaces at both ends of the line.

One problem if you're a hobbyist is that the FTDI chips only come in surface mount versions with very fine pin spacing. An alternative is to buy an adapter which communicates with the computer via USB and with the processor via UART. You can get these in the form of a cable with the interface components inside the plug that attaches to the computer, so you hardly know anything is there.
 

MrChips

Joined Oct 2, 2009
19,420
USB appears to be a seamless way to transfer data from one device to another. You plug in a USB cable between your camera or smart phone to a PC and bingo, you can access the files with a click of a button.

However, behind the scene is a billion pieces of transactions that occur between the two devices. This is the USB protocol. You do not want to have to learn or develop code to do this unless this is specifically your task.

The hobbyist route is to use a USB-to-UART bridge such as FTDI and Silicon Labs chips. The USB drivers are already written and installed for you. This is no longer USB protocol. You are now using UART protocol which is the same as old fashion IBM PC serial COMM port protocol. It is like transporting the space shuttle with a horse and buggy.
 

BobaMosfet

Joined Jul 1, 2009
839
Hi there

I do not have clarity on USB protocol. I am looking information on USB device and it's Programming.

Let's consider one example if I want to make a communication between microcontroller and PC using USB protocol. so I have to access serial port via USB protocol. I do not have idea on the programming. so I did some homework and found that I will have to write code for both PC and Micro-controller. You I have gone through previous thread and found that it's not easy to develop your own firmware or PC drivers. It's okay I will not dare to develop PC driver

My question is regarding microcontroller programming Can any one tell me what is USB Protocol in the terms of programming

Thanks
champ
All signaling on any microcontrollers (and any CPU) comes down to raising or lowering a voltage on a pin, or pins if in parallel. It's that simple. The pattern and timing of those raisings and lowerings is the magic.

For USB, don't waste cycles with your MCU, simply use it's TTL TX/RX pins and output to a USB chip, like an FT232RL. Very few components needed to use it and it makes USB communications simple. Those few extra components are:

10K Resistor
4K7 Resistor
100uF Capacitor (non-polarized)

If you want to put LEDs on the TX & RX part, that's a few more, but that's easy.
 
Top