Welcome Guest ( Log In | Register )


Bump Topic Add Reply RSS Feed New Topic New Poll

Outline · [ Standard ] · Linear+

> USB programming, Anyone? Both HW and SW

views
     
TSmentalhealth.my
post Mar 2 2019, 10:18 PM, updated 3 months ago

Getting Started
**
Group: Junior Member
Posts: 107

Joined: Sep 2015
HW includes the circuit diagram, SW includes the device driver.
Have to get a Vendor ID for the USB device for several thousands of USD from usb.org

AFAIK, the USB device is not easy to be a certified one, not the one you see in night market like USB lights.
From my initial findings, the USB has 4 pins (+5, D-, D+, Gnd), connects the +5 and Gnd will make USB lights work WITHOUT being recognized by PC.... To be recognized by PC, must use at least D- and D+ to 3.3V.

Anyway, long story short, here's the USB LED I built:
(Two resistors, two LED -each 80 cents, and USB female jack RM 3)

user posted image
user posted image

This post has been edited by mentalhealth.my: Mar 2 2019, 10:25 PM
quadcube
post Mar 2 2019, 11:26 PM

Regular
******
Group: Senior Member
Posts: 1,509

Joined: May 2009


there's quite a number of VID, PID that are available for open source hardware. for example, some of my custom mechanical keyboard projects uses the ones that are provided by obdev v-usb
TSmentalhealth.my
post Mar 3 2019, 12:47 AM

Getting Started
**
Group: Junior Member
Posts: 107

Joined: Sep 2015
QUOTE(quadcube @ Mar 2 2019, 11:26 PM)
there's quite a number of VID, PID that are available for open source hardware. for example, some of my custom mechanical keyboard projects uses the ones that are provided by obdev v-usb
*
I didn't know that. I am beginner in USB making and programming. Hope to learn from you!
narf03
post Mar 3 2019, 07:46 PM

Look at all my stars!!
*******
Group: Senior Member
Posts: 3,880

Joined: Dec 2004
From: Metro Prima, Kuala Lumpur, Malaysia, Earth, Sol


2 pins are power 2 pins are data, the usb device will need to communicate with pc in order to get the vendor Id or anything. The 2 power pins are dumb, it's not controllable by the pc, as long as the pc has power that 2 pin will have power, and u dont need these 2 power pins if the device is self powered, so technically these 2 power pins has nothing to do with usb communication.
TSmentalhealth.my
post Mar 3 2019, 10:17 PM

Getting Started
**
Group: Junior Member
Posts: 107

Joined: Sep 2015
QUOTE(narf03 @ Mar 3 2019, 07:46 PM)
2 pins are power 2 pins are data, the usb device will need to communicate with pc in order to get the vendor Id or anything. The 2 power pins are dumb, it's not controllable by the pc, as long as the pc has power that 2 pin will have power, and u dont need these 2 power pins if the device is self powered, so technically these 2 power pins has nothing to do with usb communication.
*
Sounds like you know quite well about USB communication. The USB LED which I built is just the beginning. I will start to look further into it, like microcontroller of the USB device, not easy as compared to serial communication.

rd33
post Mar 4 2019, 01:32 AM

Enthusiast
*****
Group: Senior Member
Posts: 738

Joined: May 2008
From: Classified


What are you trying to achieve with the USB actually?

Hardware:
-Nowadays most 32-bit MCU already has built in USB PHY. Some even has the USB OTG built-in.
-Note that the D+ and D- is differential line.
-USB OTG has another pin called ID, it is used to detect the USB device is connected or not so that the USB host can supply power to USB device.
-Add ESD protection circuit to protect your host/device.

Software:
-You can program your USB as MSC, HID, or CDC.
-MCU SDK should provide the library above.
-Common USB is full speed or high speed, depends on USB PHY
-You need to have VID/PID if you plan to sell your product with USB
TSmentalhealth.my
post Mar 4 2019, 03:18 AM

Getting Started
**
Group: Junior Member
Posts: 107

Joined: Sep 2015
QUOTE(rd33 @ Mar 4 2019, 01:32 AM)
What are you trying to achieve with the USB actually?

Hardware:
-Nowadays most 32-bit MCU already has built in USB PHY. Some even has the USB OTG built-in.
-Note that the D+ and D- is differential line.
-USB OTG has another pin called ID, it is used to detect the USB device is connected or not so that the USB host can supply power to USB device.
-Add ESD protection circuit to protect your host/device.

Software:
-You can program your USB as MSC, HID, or CDC.
-MCU SDK should provide the library above.
-Common USB is full speed or high speed, depends on USB PHY
-You need to have VID/PID if you plan to sell your product with USB
*
First of all, thank you for your willingness to give these information. Looks like you already own your USB device (and its driver)?

I am trying to design a simple controllable LED lights as the beginning, such as which LED to turn on /off, option to make them flash, directly controlled from software. I am currently having difficulty with the circuit design because I have limited knowledge in electronics, and even though in programming, I have never built a device driver. I would be thankful if you can point me further in the right direction. Thanks in advance!
Eventless
post Mar 4 2019, 07:36 AM

Look at all my stars!!
*******
Group: Senior Member
Posts: 2,536

Joined: Jan 2003
QUOTE(mentalhealth.my @ Mar 4 2019, 03:18 AM)
First of all, thank you for your willingness to give these information. Looks like you already own your USB device (and its driver)?

I am trying to design a simple controllable LED lights as the beginning, such as which LED to turn on /off, option to make them flash, directly controlled from software. I am currently having difficulty with the circuit design because I have limited knowledge in electronics, and even though in programming, I have never built a device driver. I would be thankful if you can point me further in the right direction. Thanks in advance!
*
Maybe you should be looking into arduino boards instead designing everything from scratch? It has libraries for serial communication via USB and programmable pins that you can use for your project. Their examples page have LED control and serial communication projects.
https://www.arduino.cc/
https://www.arduino.cc/en/Tutorial/BuiltInExamples
narf03
post Mar 4 2019, 07:51 AM

Look at all my stars!!
*******
Group: Senior Member
Posts: 3,880

Joined: Dec 2004
From: Metro Prima, Kuala Lumpur, Malaysia, Earth, Sol


QUOTE(mentalhealth.my @ Mar 3 2019, 10:17 PM)
Sounds like you know quite well about USB communication.  The USB LED which I built is just the beginning. I will start to look further into it, like microcontroller of the USB device, not easy as compared to serial communication.
*
Nope I know nothing about usb programming, just know a bit about schematic, or pinouts, I've done some projects using rs232 aka commport and rs485(long distance, and daisy chain), usb is unlike rs232 or rs485 which it need driver in order for hardware identify b4 any communication, and different driver needed for different version of os could be pain in da ass.
rd33
post Mar 4 2019, 08:47 AM

Enthusiast
*****
Group: Senior Member
Posts: 738

Joined: May 2008
From: Classified


QUOTE(mentalhealth.my @ Mar 4 2019, 03:18 AM)
First of all, thank you for your willingness to give these information. Looks like you already own your USB device (and its driver)?

I am trying to design a simple controllable LED lights as the beginning, such as which LED to turn on /off, option to make them flash, directly controlled from software. I am currently having difficulty with the circuit design because I have limited knowledge in electronics, and even though in programming, I have never built a device driver. I would be thankful if you can point me further in the right direction. Thanks in advance!
*
USB is just a serial communication peripheral. Usually LED is controlled using GPIO or PWM peripheral, you don't connect LED directly to USB pins (except to indicate USB power/data is running). What u wana do is, PC with ur software -> PC USB -> MCU USB -> MCU GPIO/PWM -> LED.

Buy an Arduino and play with it. Arduino Nano is a good start if you just wana play with USB and GPIO/PWM.

USB circuit is very easy. Firstly find your right MCU and then you can start to design.
viknela
post Apr 14 2019, 02:12 AM

Getting Started
**
Group: Junior Member
Posts: 60

Joined: Nov 2010


Depending on your purpose you can use an arm m4 mcu like teensy 3.5 or for stuff like video processing,opencv, you can use a Linux sbc like pocket beagle.. high-speed data collection(eg:HDMI to USB) to USB you can get fpga like spartan6.. as for pid and vid while you are developing just pinjam from existing vendor with similar hardware.. if you move to production then can spend the 4k USD to get your own



Bump Topic Add ReplyOptions New Topic
 

Switch to:
| Lo-Fi Version
0.0802sec    5.73    5 queries    GZIP Disabled
Time is now: 23rd May 2019 - 10:53 AM