Question

I am trying to learn to write drivers in Linux. I wired up an LED on a breadboard that has been tested and works (resistor in series with an LED). I connected it to a cut USB cable so that the positive data end is connected to one end of the circuit and the ground cable to the other. I ran it through a powered USB hub to avoid pulling too much current from my computer, but even when I direct connect it, it doesn't seem to cause any problems.

http://en.wikipedia.org/wiki/USB#Pinouts

Anyways, what I want to do it send signals through the USB cable to make the light blink, turn on, or something else. I don't want to use a FPGA board, or special hardware. I would like to control the bits being sent over the USB cable.

I went through the tutorial below, but it didn't work for me. I tried to modify the code according to my intuition (I have been programming for about 7 years, just never drivers or hardware). Apparently my intuition doesn't apply to drivers ... oh well.

My code. On Pastebin

I would appreciate tutorials, etc. I am doing this to learn, therefore I really don't want to use an FPGA board. I would prefer to change my circuit rather than get a board. If I am being dumb, tell me kindly :)

Was it helpful?

Solution

USB ports are not intended to directly interface with simple circuitry, but only with fairly complicated USB transceivers as found inside of USB-enabled microcontrollers or peripheral chips.

However, you are just using the USB power lines. A small minority of systems / hubs permit software control of individual ports' power. If your system or hub has that capability you can possibly use that to turn the LED on and off. But you may have to look for quite a while to find a hub which actually has the pass transistors (even when hub ic's may have the pins to control such transistors, typically none actually get installed on the board).

For a portable project which does not require extremely careful selection of host hardware, you will have to use a USB-enabled microcontroller or interface chip.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top